@galacean/engine-core 2.0.0-alpha.59 → 2.0.0-alpha.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -439,10 +439,6 @@ registerDefaultCloneMode(ReferResource, CloneMode.Assignment);
439
439
  /** 32-bit depth format. */ TextureFormat[TextureFormat["Depth32"] = 32] = "Depth32";
440
440
  /** 16-bit depth + 8-bit stencil format. */ TextureFormat[TextureFormat["Depth24Stencil8"] = 33] = "Depth24Stencil8";
441
441
  /** 32-bit depth + 8-bit stencil format. */ TextureFormat[TextureFormat["Depth32Stencil8"] = 34] = "Depth32Stencil8";
442
- /** @deprecated Use 'TextureFormat.R8' instead. */ TextureFormat[TextureFormat["Alpha8"] = 5] = "Alpha8";
443
- /** @deprecated Use 'TextureFormat.R8G8' instead. */ TextureFormat[TextureFormat["LuminanceAlpha"] = 6] = "LuminanceAlpha";
444
- /** @deprecated Use `TextureFormat.BC1` instead. */ TextureFormat[TextureFormat["DXT1"] = 10] = "DXT1";
445
- /** @deprecated Use `TextureFormat.BC3` instead. */ TextureFormat[TextureFormat["DXT5"] = 11] = "DXT5";
446
442
  return TextureFormat;
447
443
  }({});
448
444
 
@@ -1082,18 +1078,14 @@ SystemInfo._webpSupported = null;
1082
1078
  function TextureUtils() {}
1083
1079
  /**
1084
1080
  * Check if the texture config supports auto mipmap generation with real correction for mipmap and isSRGBColorSpace.
1085
- */ TextureUtils.supportGenerateMipmapsWithCorrection = function supportGenerateMipmapsWithCorrection(engine, width, height, format, mipmap, isSRGBColorSpace) {
1086
- var isWebGL2 = engine._hardwareRenderer.isWebGL2;
1081
+ */ TextureUtils.supportGenerateMipmapsWithCorrection = function supportGenerateMipmapsWithCorrection(format, mipmap, isSRGBColorSpace) {
1087
1082
  if (!mipmap) {
1088
1083
  return false;
1089
1084
  }
1090
1085
  if (isSRGBColorSpace && !TextureUtils.supportSRGB(format)) {
1091
1086
  isSRGBColorSpace = false;
1092
1087
  }
1093
- if (!TextureUtils.supportMipmaps(width, height, isWebGL2)) {
1094
- mipmap = false;
1095
- }
1096
- return TextureUtils.supportGenerateMipmaps(format, mipmap, isSRGBColorSpace, isWebGL2);
1088
+ return TextureUtils.supportGenerateMipmaps(format, mipmap, isSRGBColorSpace);
1097
1089
  };
1098
1090
  TextureUtils.isHDRFormat = function isHDRFormat(format) {
1099
1091
  return format === TextureFormat.R16G16B16A16 || format === TextureFormat.R32G32B32A32 || format === TextureFormat.R11G11B10_UFloat;
@@ -1119,12 +1111,9 @@ SystemInfo._webpSupported = null;
1119
1111
  return false;
1120
1112
  }
1121
1113
  };
1122
- TextureUtils.supportMipmaps = function supportMipmaps(width, height, isWebGL2) {
1123
- return isWebGL2 || engineMath.MathUtil.isPowerOf2(width) && engineMath.MathUtil.isPowerOf2(height);
1124
- };
1125
- TextureUtils.supportGenerateMipmaps = function supportGenerateMipmaps(format, mipmap, isSRGBColorSpace, isWebGL2) {
1114
+ TextureUtils.supportGenerateMipmaps = function supportGenerateMipmaps(format, mipmap, isSRGBColorSpace) {
1126
1115
  // Auto generating mipmaps for sRGB textures is only supported in [WebGL2 + RGBA]
1127
- if (mipmap && isSRGBColorSpace && !(isWebGL2 && format === TextureFormat.R8G8B8A8)) {
1116
+ if (mipmap && isSRGBColorSpace && format !== TextureFormat.R8G8B8A8) {
1128
1117
  return false;
1129
1118
  }
1130
1119
  return true;
@@ -1142,10 +1131,8 @@ SystemInfo._webpSupported = null;
1142
1131
  switch(format){
1143
1132
  // Uncompressed formats
1144
1133
  case TextureFormat.R8:
1145
- case TextureFormat.Alpha8:
1146
1134
  return width * height;
1147
1135
  case TextureFormat.R8G8:
1148
- case TextureFormat.LuminanceAlpha:
1149
1136
  return width * height * 2;
1150
1137
  case TextureFormat.R8G8B8:
1151
1138
  return width * height * 3;
@@ -1240,7 +1227,6 @@ SystemInfo._webpSupported = null;
1240
1227
  var _proto = TextureCube.prototype;
1241
1228
  /**
1242
1229
  * Setting pixels data through cube face,color buffer data, designated area and texture mipmapping level,it's also applicable to compressed formats.
1243
- * @remarks When compressed texture is in WebGL1, the texture must be filled first before writing the sub-region
1244
1230
  * @param face - Cube face
1245
1231
  * @param colorBuffer - Color buffer data
1246
1232
  * @param mipLevel - Texture mipmapping level
@@ -1493,7 +1479,6 @@ SystemInfo._webpSupported = null;
1493
1479
  var _proto = Texture2D.prototype;
1494
1480
  /**
1495
1481
  * Setting pixels data through color buffer data, designated area and texture mipmapping level,it's also applicable to compressed formats.
1496
- * @remarks If it is the WebGL1.0 platform and the texture format is compressed, the first upload must be filled with textures.
1497
1482
  * @param colorBuffer - Color buffer data
1498
1483
  * @param mipLevel - Texture mipmapping level
1499
1484
  * @param x - X coordinate of area start
@@ -1569,7 +1554,6 @@ SystemInfo._webpSupported = null;
1569
1554
  var _proto = Texture2DArray.prototype;
1570
1555
  /**
1571
1556
  * Setting pixels data through color buffer data, designated area and texture mipmapping level,it's also applicable to compressed formats.
1572
- * @remarks If it is the WebGL1.0 platform and the texture format is compressed, the first upload must be filled with textures.
1573
1557
  * @param offsetIndex - The texture array element offset index
1574
1558
  * @param colorBuffer - Color buffer data
1575
1559
  * @param mipLevel - Texture mipmapping level
@@ -1643,8 +1627,7 @@ SystemInfo._webpSupported = null;
1643
1627
  var _this;
1644
1628
  _this = ReferResource.call(this, engine) || this, _this._charInfoMap = {}, _this._space = 1, _this._curX = 1, _this._curY = 1, _this._nextY = 1;
1645
1629
  _this.isGCIgnored = true;
1646
- var format = engine._hardwareRenderer.isWebGL2 ? TextureFormat.R8 : TextureFormat.Alpha8;
1647
- var texture = new Texture2D(engine, 512, 512, format, false, false);
1630
+ var texture = new Texture2D(engine, 512, 512, TextureFormat.R8, false, false);
1648
1631
  texture.filterMode = TextureFilterMode.Bilinear;
1649
1632
  texture.isGCIgnored = true;
1650
1633
  _this.texture = texture;
@@ -2073,7 +2056,7 @@ SystemInfo._webpSupported = null;
2073
2056
  if (isChar) {
2074
2057
  var data = null;
2075
2058
  if (size > 0) {
2076
- // Extract alpha channel only for Alpha8 texture format.
2059
+ // Store glyph coverage from the canvas alpha channel in the R8 atlas.
2077
2060
  var alphaPixelCount = size * integerW;
2078
2061
  data = new Uint8Array(alphaPixelCount);
2079
2062
  var offset = top * integerW * 4 + 3;
@@ -2947,28 +2930,12 @@ registerDefaultCloneMode(DataObject, CloneMode.Deep);
2947
2930
  return DataType;
2948
2931
  }({});
2949
2932
  /**
2950
- * GL Capabilities
2951
- * Some capabilities can be smoothed out by extension, and some capabilities must use WebGL 2.0.
2933
+ * Optional GL capabilities.
2952
2934
  * */ var GLCapabilityType = /*#__PURE__*/ function(GLCapabilityType) {
2953
- GLCapabilityType["shaderVertexID"] = "shaderVertexID";
2954
- GLCapabilityType["standardDerivatives"] = "OES_standard_derivatives";
2955
- GLCapabilityType["shaderTextureLod"] = "EXT_shader_texture_lod";
2956
- GLCapabilityType["elementIndexUint"] = "OES_element_index_uint";
2957
- GLCapabilityType["depthTexture"] = "WEBGL_depth_texture";
2958
- GLCapabilityType["drawBuffers"] = "WEBGL_draw_buffers";
2959
- GLCapabilityType["vertexArrayObject"] = "OES_vertex_array_object";
2960
- GLCapabilityType["instancedArrays"] = "ANGLE_instanced_arrays";
2961
- GLCapabilityType["multipleSample"] = "multipleSampleOnlySupportedInWebGL2";
2962
- GLCapabilityType["textureFloat"] = "OES_texture_float";
2963
2935
  GLCapabilityType["textureFloatLinear"] = "OES_texture_float_linear";
2964
- GLCapabilityType["textureHalfFloat"] = "OES_texture_half_float";
2965
- GLCapabilityType["textureHalfFloatLinear"] = "OES_texture_half_float_linear";
2966
- GLCapabilityType["WEBGL_colorBufferFloat"] = "WEBGL_color_buffer_float";
2967
2936
  GLCapabilityType["colorBufferFloat"] = "EXT_color_buffer_float";
2968
2937
  GLCapabilityType["colorBufferHalfFloat"] = "EXT_color_buffer_half_float";
2969
2938
  GLCapabilityType["textureFilterAnisotropic"] = "EXT_texture_filter_anisotropic";
2970
- GLCapabilityType["blendMinMax"] = "EXT_blend_minmax";
2971
- GLCapabilityType["fragDepth"] = "EXT_frag_depth";
2972
2939
  GLCapabilityType["astc"] = "WEBGL_compressed_texture_astc";
2973
2940
  GLCapabilityType["astc_webkit"] = "WEBKIT_WEBGL_compressed_texture_astc";
2974
2941
  GLCapabilityType["astc_hdr"] = "WEBGL_compressed_texture_astc_hdr";
@@ -2983,7 +2950,6 @@ registerDefaultCloneMode(DataObject, CloneMode.Deep);
2983
2950
  GLCapabilityType["s3tc_srgb"] = "WEBGL_compressed_texture_s3tc_srgb";
2984
2951
  GLCapabilityType["bptc"] = "EXT_texture_compression_bptc";
2985
2952
  GLCapabilityType["WEBGL_lose_context"] = "WEBGL_lose_context";
2986
- GLCapabilityType["sRGB"] = "EXT_sRGB";
2987
2953
  return GLCapabilityType;
2988
2954
  }({});
2989
2955
 
@@ -4352,8 +4318,7 @@ var RenderStateElementKey = /*#__PURE__*/ function(RenderStateElementKey) {
4352
4318
  /**
4353
4319
  * Shader language belongs to.
4354
4320
  */ var ShaderLanguage = /*#__PURE__*/ function(ShaderLanguage) {
4355
- /** GLSL ES 100. */ ShaderLanguage[ShaderLanguage["GLSLES100"] = 0] = "GLSLES100";
4356
- /** GLSL ES 300. */ ShaderLanguage[ShaderLanguage["GLSLES300"] = 1] = "GLSLES300";
4321
+ /** GLSL ES 300. */ ShaderLanguage[ShaderLanguage["GLSLES300"] = 0] = "GLSLES300";
4357
4322
  return ShaderLanguage;
4358
4323
  }({});
4359
4324
 
@@ -6908,8 +6873,7 @@ ShaderBlockProperty._nameMap = Object.create(null);
6908
6873
 
6909
6874
  /**
6910
6875
  * Shader registry and GLSL utilities. Holds the `#include` lookup table
6911
- * the runtime preprocessor reads, the GLSL ES 100 → 300 syntax converter
6912
- * the WebGL2 path uses, and the GPU-instancing UBO injector that
6876
+ * the runtime preprocessor reads and the GPU-instancing UBO injector that
6913
6877
  * `ShaderPass` runs over compiled GLSL source.
6914
6878
  */ var ShaderFactory = /*#__PURE__*/ function() {
6915
6879
  function ShaderFactory() {}
@@ -6946,36 +6910,6 @@ ShaderBlockProperty._nameMap = Object.create(null);
6946
6910
  ShaderFactory.unregisterInclude(includeName);
6947
6911
  };
6948
6912
  /**
6949
- * Convert lower GLSL version to GLSL 300 es.
6950
- * @param shader - code
6951
- * @param isFrag - Whether it is a fragment shader.
6952
- */ ShaderFactory.convertTo300 = function convertTo300(shader, isFrag) {
6953
- shader = shader.replace(/\bvarying\b/g, isFrag ? "in" : "out");
6954
- shader = shader.replace(/\btexture(2D|Cube)\b/g, "texture");
6955
- shader = shader.replace(/\btexture2DProj\b/g, "textureProj");
6956
- shader = shader.replace(/\btexture(2D|Cube)LodEXT\b/g, "textureLod");
6957
- shader = shader.replace(/\btexture(2D|Cube)GradEXT\b/g, "textureGrad");
6958
- shader = shader.replace(/\btexture2DProjLodEXT\b/g, "textureProjLod");
6959
- shader = shader.replace(/\btexture2DProjGradEXT\b/g, "textureProjGrad");
6960
- if (isFrag) {
6961
- shader = shader.replace(/\bgl_FragDepthEXT\b/g, "gl_FragDepth");
6962
- if (!ShaderFactory._has300OutInFragReg.test(shader)) {
6963
- var isMRT = /\bgl_FragData\[.+?\]/g.test(shader);
6964
- if (isMRT) {
6965
- shader = shader.replace(/\bgl_FragColor\b/g, "gl_FragData[0]");
6966
- var result = shader.match(/\bgl_FragData\[.+?\]/g);
6967
- shader = ShaderFactory._replaceMRTShader(shader, result);
6968
- } else {
6969
- shader = "out vec4 glFragColor;\n" + shader;
6970
- shader = shader.replace(/\bgl_FragColor\b/g, "glFragColor");
6971
- }
6972
- }
6973
- } else {
6974
- shader = shader.replace(/\battribute\b/g, "in");
6975
- }
6976
- return shader;
6977
- };
6978
- /**
6979
6913
  * Scan VS/FS for renderer-group `uniform` declarations, replace them with a shared
6980
6914
  * std140 UBO (instanced array), and emit `#define` remapping so original uniform
6981
6915
  * names resolve to `rendererData[instanceID].field`.
@@ -7112,33 +7046,12 @@ ShaderBlockProperty._nameMap = Object.create(null);
7112
7046
  }
7113
7047
  return lines.join("\n");
7114
7048
  };
7115
- ShaderFactory._replaceMRTShader = function _replaceMRTShader(shader, result) {
7116
- var declaration = "";
7117
- var mrtIndexSet = new Set();
7118
- for(var i = 0; i < result.length; i++){
7119
- var res = result[i].match(/\bgl_FragData\[(.+?)\]/);
7120
- mrtIndexSet.add(res[1]);
7121
- }
7122
- mrtIndexSet.forEach(function(index) {
7123
- declaration += "layout(location=" + index + ") out vec4 fragOutColor" + index + ";\n";
7124
- });
7125
- shader = shader.replace(/\bgl_FragData\[(.+?)\]/g, "fragOutColor$1");
7126
- return declaration + shader;
7127
- };
7128
7049
  return ShaderFactory;
7129
7050
  }();
7130
7051
  ShaderFactory.RENDERER_INSTANCE_BLOCK_NAME = "RendererInstanceData";
7131
7052
  var _obj;
7132
7053
  ShaderFactory.uniformBlockBindingMap = (_obj = {}, _obj[ShaderBlockProperty.getByName(ShaderFactory.RENDERER_INSTANCE_BLOCK_NAME)._uniqueId] = ConstantBufferBindingPoint.RendererInstance, _obj);
7133
7054
  ShaderFactory.includeMap = Object.create(null);
7134
- ShaderFactory.shaderExtension = [
7135
- "GL_EXT_shader_texture_lod",
7136
- "GL_OES_standard_derivatives",
7137
- "GL_EXT_draw_buffers",
7138
- "GL_EXT_frag_depth"
7139
- ].map(function(e) {
7140
- return "#extension " + e + " : enable\n";
7141
- }).join("");
7142
7055
  ShaderFactory._std140TypeInfoMap = {
7143
7056
  float: {
7144
7057
  size: 4,
@@ -7201,8 +7114,6 @@ ShaderFactory._std140TypeInfoMap = {
7201
7114
  align: 16
7202
7115
  }
7203
7116
  };
7204
- // [layout(location = 0)] out [highp] vec4 [color];
7205
- ShaderFactory._has300OutInFragReg = /\bout\s+(?:\w+\s+)?vec4\s+\w+\s*;/;
7206
7117
  // Derived built-ins re-exposed on top of `renderer_ModelMat`.
7207
7118
  // `renderer_NormalMat` uses the cofactor (cross-product) form, which algebraically equals
7208
7119
  // `det(M) · transpose(inverse(M))`. After `normalize()` it's directionally identical to the
@@ -7945,18 +7856,16 @@ ShaderTagKey._nameMap = Object.create(null);
7945
7856
  _this.attributeLocation[name] = gl.getAttribLocation(program, name);
7946
7857
  });
7947
7858
  // Record uniform block indices and bind binding points (WebGL2 only)
7948
- if (this._engine._hardwareRenderer.isWebGL2) {
7949
- var gl2 = gl;
7950
- var bindingMap = ShaderFactory.uniformBlockBindingMap;
7951
- var _gl2_getProgramParameter;
7952
- var blockCount = (_gl2_getProgramParameter = gl2.getProgramParameter(program, gl2.ACTIVE_UNIFORM_BLOCKS)) != null ? _gl2_getProgramParameter : 0;
7953
- for(var i = 0; i < blockCount; i++){
7954
- var id = ShaderBlockProperty.getByName(gl2.getActiveUniformBlockName(program, i))._uniqueId;
7955
- this.uniformBlockIds[i] = id;
7956
- var bindingPoint = bindingMap[id];
7957
- if (bindingPoint !== undefined) {
7958
- gl2.uniformBlockBinding(program, i, bindingPoint);
7959
- }
7859
+ var gl2 = gl;
7860
+ var bindingMap = ShaderFactory.uniformBlockBindingMap;
7861
+ var _gl2_getProgramParameter;
7862
+ var blockCount = (_gl2_getProgramParameter = gl2.getProgramParameter(program, gl2.ACTIVE_UNIFORM_BLOCKS)) != null ? _gl2_getProgramParameter : 0;
7863
+ for(var i = 0; i < blockCount; i++){
7864
+ var id = ShaderBlockProperty.getByName(gl2.getActiveUniformBlockName(program, i))._uniqueId;
7865
+ this.uniformBlockIds[i] = id;
7866
+ var bindingPoint = bindingMap[id];
7867
+ if (bindingPoint !== undefined) {
7868
+ gl2.uniformBlockBinding(program, i, bindingPoint);
7960
7869
  }
7961
7870
  }
7962
7871
  };
@@ -8549,15 +8458,9 @@ ShaderMacroProcessor._expressionContext = {
8549
8458
  case BlendOperation.ReverseSubtract:
8550
8459
  return gl.FUNC_REVERSE_SUBTRACT;
8551
8460
  case BlendOperation.Min:
8552
- if (!rhi.canIUse(GLCapabilityType.blendMinMax)) {
8553
- throw new Error("BlendOperation.Min is not supported in this context");
8554
- }
8555
- return gl.MIN; // in webgl1.0 is an extension
8461
+ return gl.MIN;
8556
8462
  case BlendOperation.Max:
8557
- if (!rhi.canIUse(GLCapabilityType.blendMinMax)) {
8558
- throw new Error("BlendOperation.Max is not supported in this context");
8559
- }
8560
- return gl.MAX; // in webgl1.0 is an extension
8463
+ return gl.MAX;
8561
8464
  }
8562
8465
  };
8563
8466
  return BlendState;
@@ -8973,14 +8876,13 @@ var precisionStr = "\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision hig
8973
8876
  * Shader pass containing vertex and fragment source.
8974
8877
  */ var ShaderPass = /*#__PURE__*/ function(ShaderPart) {
8975
8878
  _inherits(ShaderPass, ShaderPart);
8976
- function ShaderPass(name, vertexShaderInstructions, fragmentShaderInstructions, platformTarget, tags, vertexOutputNames) {
8879
+ function ShaderPass(name, vertexShaderInstructions, fragmentShaderInstructions, _platformTarget, tags, vertexOutputNames) {
8977
8880
  var _this;
8978
8881
  _this = ShaderPart.call(this) || this, /** @internal */ _this._shaderPassId = 0, /** @internal Pass-level render state — always present, populated from ShaderLab declarations. */ _this._renderState = new RenderState(), /** @internal */ _this._renderStateDataMap = {}, /** @internal */ _this._shaderProgramMaps = [];
8979
8882
  _this._shaderPassId = ShaderPass._shaderPassCounter++;
8980
8883
  _this._name = name;
8981
8884
  _this._vertexShaderInstructions = vertexShaderInstructions;
8982
8885
  _this._fragmentShaderInstructions = fragmentShaderInstructions;
8983
- _this._platformTarget = platformTarget;
8984
8886
  _this._vertexOutputNames = vertexOutputNames;
8985
8887
  var mergedTags = _extends({
8986
8888
  pipelineStage: PipelineStage.Forward
@@ -9030,17 +8932,12 @@ var precisionStr = "\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision hig
9030
8932
  return program;
9031
8933
  };
9032
8934
  _proto._compileShaderSource = function _compileShaderSource(engine, macroCollection, isGPUInstance) {
9033
- var isWebGL2 = engine._hardwareRenderer.isWebGL2;
9034
8935
  var shaderMacroList = ShaderPass._shaderMacroList;
9035
8936
  shaderMacroList.length = 0;
9036
8937
  ShaderMacro._getMacrosElements(macroCollection, shaderMacroList);
9037
- shaderMacroList.push(ShaderMacro.getByName(isWebGL2 ? "GRAPHICS_API_WEBGL2" : "GRAPHICS_API_WEBGL1"));
9038
- if (engine._hardwareRenderer.canIUse(GLCapabilityType.shaderTextureLod)) {
9039
- shaderMacroList.push(ShaderMacro.getByName("HAS_TEX_LOD"));
9040
- }
9041
- if (engine._hardwareRenderer.canIUse(GLCapabilityType.standardDerivatives)) {
9042
- shaderMacroList.push(ShaderMacro.getByName("HAS_DERIVATIVES"));
9043
- }
8938
+ shaderMacroList.push(ShaderMacro.getByName("GRAPHICS_API_WEBGL2"));
8939
+ shaderMacroList.push(ShaderMacro.getByName("HAS_TEX_LOD"));
8940
+ shaderMacroList.push(ShaderMacro.getByName("HAS_DERIVATIVES"));
9044
8941
  var macroMap = ShaderPass._macroMap;
9045
8942
  macroMap.clear();
9046
8943
  for(var i = 0, n = shaderMacroList.length; i < n; i++){
@@ -9057,14 +8954,10 @@ var precisionStr = "\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision hig
9057
8954
  fragmentSource = injected.fragmentSource;
9058
8955
  instanceLayout = injected.instanceLayout;
9059
8956
  }
9060
- if (isWebGL2 && this._platformTarget === ShaderLanguage.GLSLES100) {
9061
- vertexSource = ShaderFactory.convertTo300(vertexSource);
9062
- fragmentSource = ShaderFactory.convertTo300(fragmentSource, true);
9063
- }
9064
- var versionStr = isWebGL2 ? "#version 300 es" : "#version 100";
8957
+ var versionStr = "#version 300 es";
9065
8958
  return {
9066
8959
  vertexSource: " " + versionStr + "\n " + vertexSource + "\n ",
9067
- fragmentSource: " " + versionStr + "\n " + (isWebGL2 ? "" : ShaderFactory.shaderExtension) + "\n " + precisionStr + "\n " + fragmentSource + "\n ",
8960
+ fragmentSource: " " + versionStr + "\n " + precisionStr + "\n " + fragmentSource + "\n ",
9068
8961
  instanceLayout: instanceLayout
9069
8962
  };
9070
8963
  };
@@ -9186,7 +9079,7 @@ ShaderPass._macroMap = new Map();
9186
9079
  };
9187
9080
  Shader.create = function create(nameOrShaderSource, shaderPassesOrSubShadersOrPlatformTarget) {
9188
9081
  if (shaderPassesOrSubShadersOrPlatformTarget == undefined || typeof shaderPassesOrSubShadersOrPlatformTarget === "number") {
9189
- var platformTarget = typeof shaderPassesOrSubShadersOrPlatformTarget === "number" ? shaderPassesOrSubShadersOrPlatformTarget : ShaderLanguage.GLSLES100;
9082
+ var platformTarget = typeof shaderPassesOrSubShadersOrPlatformTarget === "number" ? shaderPassesOrSubShadersOrPlatformTarget : ShaderLanguage.GLSLES300;
9190
9083
  return Shader._createFromSource(nameOrShaderSource, platformTarget);
9191
9084
  }
9192
9085
  if (shaderPassesOrSubShadersOrPlatformTarget.length === 0) {
@@ -9208,7 +9101,7 @@ ShaderPass._macroMap = new Map();
9208
9101
  * @throws When the shader compiler is unavailable or a pass cannot be compiled.
9209
9102
  * @internal
9210
9103
  */ Shader._createFromSource = function _createFromSource(shaderSource, platformTarget, sourceFile) {
9211
- if (platformTarget === void 0) platformTarget = ShaderLanguage.GLSLES100;
9104
+ if (platformTarget === void 0) platformTarget = ShaderLanguage.GLSLES300;
9212
9105
  var shaderCompiler = Shader._shaderCompiler;
9213
9106
  if (!shaderCompiler) {
9214
9107
  throw "ShaderCompiler has not been set up yet.";
@@ -13221,7 +13114,6 @@ var BlendShapeFrameDirty = /*#__PURE__*/ function(BlendShapeFrameDirty) {
13221
13114
  /**
13222
13115
  * @internal
13223
13116
  */ _proto._canBatch = function _canBatch(preElement, curElement) {
13224
- if (!this._engine._hardwareRenderer.isWebGL2) return false;
13225
13117
  var curShaderData = curElement.component.shaderData;
13226
13118
  return preElement.primitive === curElement.primitive && preElement.subPrimitive === curElement.subPrimitive && preElement.material === curElement.material && this._isFrontFaceInvert() === curElement.component._isFrontFaceInvert() && this.shaderData._macroCollection.isEqual(curShaderData._macroCollection) && // Renderer-group samplers/arrays are shared across the whole instanced draw call
13227
13119
  this.shaderData._matchesRendererBatchShared(curShaderData);
@@ -13314,11 +13206,9 @@ __decorate([
13314
13206
  this._maxCountSingleVertexBuffer = 0;
13315
13207
  this._lastHostCreatedInfo = new engineMath.Vector4() // x: blendShapeCount, y: useNormal, z: useBlendTangent, w: vertexCount
13316
13208
  ;
13317
- this._canUseTextureStoreData = true;
13318
13209
  this._dataTextureInfo = new engineMath.Vector3();
13319
13210
  this._engine = engine;
13320
13211
  this._modelMesh = modelMesh;
13321
- this._canUseTextureStoreData = this._engine._hardwareRenderer.capability.canUseFloatTextureBlendShape;
13322
13212
  this._updateLayoutChange = this._updateLayoutChange.bind(this);
13323
13213
  }
13324
13214
  var _proto = BlendShapeManager.prototype;
@@ -13400,10 +13290,7 @@ __decorate([
13400
13290
  /**
13401
13291
  * @internal
13402
13292
  */ _proto._useTextureMode = function _useTextureMode() {
13403
- if (!this._canUseTextureStoreData) {
13404
- return false;
13405
- }
13406
- return this._blendShapeCount > this._getVertexBufferModeSupportCount();
13293
+ return this._blendShapeCount > this._getVertexBufferModeSupportCount() && this._engine._hardwareRenderer.supportsRendering;
13407
13294
  };
13408
13295
  /**
13409
13296
  * @internal
@@ -17246,9 +17133,6 @@ var TriangulationNode = function TriangulationNode(i, x, y) {
17246
17133
  }
17247
17134
  var data = generate.apply(void 0, [].concat(args));
17248
17135
  data.trim();
17249
- if (data.vertexCount > 65535 && !engine._hardwareRenderer.canIUse(GLCapabilityType.elementIndexUint)) {
17250
- throw new Error("The vertex count is over limit.");
17251
- }
17252
17136
  var mesh = new ModelMesh(engine);
17253
17137
  var vertices = data.vertices;
17254
17138
  var indices = data.indices;
@@ -17931,21 +17815,16 @@ var SkinUpdateFlag = /*#__PURE__*/ function(SkinUpdateFlag) {
17931
17815
  // directly use max joint count to avoid shader recompile
17932
17816
  var remainUniformJointCount = Math.ceil((this._maxVertexUniformVectors - (SkinnedMeshRenderer._baseVertexUniformVectorCount + bsUniformOccupiesCount)) / 4);
17933
17817
  if (boneCount > remainUniformJointCount) {
17934
- var engine = this.engine;
17935
- if (engine._hardwareRenderer.canIUseMoreJoints) {
17936
- if (boneCountChange) {
17937
- var _this__jointTexture;
17938
- (_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
17939
- this._jointTexture = new Texture2D(engine, 4, boneCount, TextureFormat.R32G32B32A32, false, false);
17940
- this._jointTexture.filterMode = TextureFilterMode.Point;
17941
- this._jointTexture.isGCIgnored = true;
17942
- }
17943
- shaderData.disableMacro("RENDERER_JOINTS_NUM");
17944
- shaderData.enableMacro("RENDERER_USE_JOINT_TEXTURE");
17945
- shaderData.setTexture(SkinnedMeshRenderer._jointSamplerProperty, this._jointTexture);
17946
- } else {
17947
- Logger.error("component's joints count(" + boneCount + ") greater than device's MAX_VERTEX_UNIFORM_VECTORS number " + this._maxVertexUniformVectors + ", and don't support jointTexture in this device. suggest joint count less than " + remainUniformJointCount + ".", this);
17818
+ if (boneCountChange) {
17819
+ var _this__jointTexture;
17820
+ (_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
17821
+ this._jointTexture = new Texture2D(this.engine, 4, boneCount, TextureFormat.R32G32B32A32, false, false);
17822
+ this._jointTexture.filterMode = TextureFilterMode.Point;
17823
+ this._jointTexture.isGCIgnored = true;
17948
17824
  }
17825
+ shaderData.disableMacro("RENDERER_JOINTS_NUM");
17826
+ shaderData.enableMacro("RENDERER_USE_JOINT_TEXTURE");
17827
+ shaderData.setTexture(SkinnedMeshRenderer._jointSamplerProperty, this._jointTexture);
17949
17828
  } else {
17950
17829
  var _this__jointTexture1;
17951
17830
  (_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
@@ -18304,17 +18183,14 @@ __decorate([
18304
18183
  ]);
18305
18184
  this.whiteTexture2D = this._create1x1Texture(engine, 0, TextureFormat.R8G8B8A8, whitePixel, true);
18306
18185
  this.whiteTextureCube = this._create1x1Texture(engine, 1, TextureFormat.R8G8B8A8, whitePixel, true);
18307
- var isWebGL2 = engine._hardwareRenderer.isWebGL2;
18308
- if (isWebGL2) {
18309
- this.whiteTexture2DArray = this._create1x1Texture(engine, 2, TextureFormat.R8G8B8A8, whitePixel, true);
18310
- var whitePixel32 = new Uint32Array([
18311
- 255,
18312
- 255,
18313
- 255,
18314
- 255
18315
- ]);
18316
- this.uintWhiteTexture2D = this._create1x1Texture(engine, 0, TextureFormat.R32G32B32A32_UInt, whitePixel32, false);
18317
- }
18186
+ this.whiteTexture2DArray = this._create1x1Texture(engine, 2, TextureFormat.R8G8B8A8, whitePixel, true);
18187
+ var whitePixel32 = new Uint32Array([
18188
+ 255,
18189
+ 255,
18190
+ 255,
18191
+ 255
18192
+ ]);
18193
+ this.uintWhiteTexture2D = this._create1x1Texture(engine, 0, TextureFormat.R32G32B32A32_UInt, whitePixel32, false);
18318
18194
  this.spriteDefaultMaterial = this._create2DMaterial(engine, shaders.sprite);
18319
18195
  this.textDefaultMaterial = this._create2DMaterial(engine, shaders.text);
18320
18196
  this.spriteMaskDefaultMaterial = this._create2DMaterial(engine, shaders.spriteMask);
@@ -26338,7 +26214,6 @@ Scene._prefilterdDFGProperty = ShaderProperty.getByName("scene_PrefilteredDFG");
26338
26214
  /** Texture. */ AssetType["Texture"] = "Texture";
26339
26215
  /** Material. */ AssetType["Material"] = "Material";
26340
26216
  /** Shader. */ AssetType["Shader"] = "Shader";
26341
- /** Mesh. */ AssetType["Mesh"] = "Mesh";
26342
26217
  /** AnimationClip. */ AssetType["AnimationClip"] = "AnimationClip";
26343
26218
  /** AnimatorController. */ AssetType["AnimatorController"] = "AnimatorController";
26344
26219
  /** Prefab.*/ AssetType["Prefab"] = "Prefab";
@@ -29132,10 +29007,6 @@ exports.Camera = /*#__PURE__*/ function(Component) {
29132
29007
  this._updateShaderData();
29133
29008
  // union scene and camera macro.
29134
29009
  ShaderMacroCollection.unionCollection(this.scene.shaderData._macroCollection, this.shaderData._macroCollection, this._globalShaderMacro);
29135
- if (mipLevel > 0 && !engine._hardwareRenderer.isWebGL2) {
29136
- mipLevel = 0;
29137
- Logger.error("mipLevel only take effect in WebGL2.0");
29138
- }
29139
29010
  var ignoreClearFlags;
29140
29011
  if (this._cameraType !== CameraType.Normal && !this._renderTarget) {
29141
29012
  ignoreClearFlags = engine.xrManager._getCameraIgnoreClearFlags(this._cameraType);
@@ -29662,7 +29533,6 @@ exports.Camera = __decorate([
29662
29533
  var material = new Material(engine, shader);
29663
29534
  material._addReferCount(1);
29664
29535
  _this._material = material;
29665
- _this.isSupported = _this.engine._hardwareRenderer.capability.isFragmentHighPrecision;
29666
29536
  return _this;
29667
29537
  }
29668
29538
  var _proto = ScalableAmbientObscurancePass.prototype;
@@ -29830,13 +29700,6 @@ ScalableAmbientObscurancePass._kernelProp = ShaderProperty.getByName("material_k
29830
29700
  return 4096;
29831
29701
  }
29832
29702
  };
29833
- ShadowUtils.shadowDepthFormat = function shadowDepthFormat(value, supportDepthTexture) {
29834
- if (supportDepthTexture) {
29835
- return TextureFormat.Depth16;
29836
- } else {
29837
- return TextureFormat.R8G8B8A8;
29838
- }
29839
- };
29840
29703
  ShadowUtils.cullingRenderBounds = function cullingRenderBounds(bounds, cullPlaneCount, cullPlanes) {
29841
29704
  var min = bounds.min, max = bounds.max;
29842
29705
  for(var i = 0; i < cullPlaneCount; i++){
@@ -30292,7 +30155,6 @@ ShadowUtils.atlasBorderSize = 4.0;
30292
30155
  new engineMath.Vector2()
30293
30156
  ];
30294
30157
  _this._camera = camera;
30295
- _this._supportDepthTexture = camera.engine._hardwareRenderer.canIUse(GLCapabilityType.depthTexture);
30296
30158
  _this._shadowSliceData.virtualCamera.isOrthographic = true;
30297
30159
  return _this;
30298
30160
  }
@@ -30321,26 +30183,14 @@ ShadowUtils.atlasBorderSize = 4.0;
30321
30183
  var lightForward = shadowSliceData.virtualCamera.forward;
30322
30184
  // Prepare render target
30323
30185
  var _this__shadowMapSize = this._shadowMapSize, width = _this__shadowMapSize.z, height = _this__shadowMapSize.w;
30324
- var format = this._shadowMapFormat;
30325
- var renderTarget;
30326
- var shadowTexture;
30327
- if (this._supportDepthTexture) {
30328
- renderTarget = PipelineUtils.recreateRenderTargetIfNeeded(engine, this._renderTarget, width, height, null, format, true, false, false, 1, TextureWrapMode.Clamp, TextureFilterMode.Bilinear);
30329
- shadowTexture = renderTarget.depthTexture;
30330
- } else {
30331
- renderTarget = PipelineUtils.recreateRenderTargetIfNeeded(engine, this._renderTarget, width, height, format, null, false, false, false, 1, TextureWrapMode.Clamp, TextureFilterMode.Bilinear);
30332
- shadowTexture = renderTarget.getColorTexture(0);
30333
- }
30186
+ var renderTarget = PipelineUtils.recreateRenderTargetIfNeeded(engine, this._renderTarget, width, height, null, TextureFormat.Depth16, true, false, false, 1, TextureWrapMode.Clamp, TextureFilterMode.Bilinear);
30187
+ var shadowTexture = renderTarget.depthTexture;
30334
30188
  shadowTexture.depthCompareFunction = TextureDepthCompareFunction.Less;
30335
30189
  this._renderTarget = renderTarget;
30336
30190
  this._depthTexture = shadowTexture;
30337
30191
  // @todo: shouldn't set viewport and scissor in activeRenderTarget
30338
30192
  context.setRenderTarget(renderTarget, CascadedShadowCasterPass._viewport, 0);
30339
- if (this._supportDepthTexture) {
30340
- rhi.clearRenderTarget(engine, CameraClearFlags.Depth, null);
30341
- } else {
30342
- rhi.clearRenderTarget(engine, CameraClearFlags.All, CascadedShadowCasterPass._clearColor);
30343
- }
30193
+ rhi.clearRenderTarget(engine, CameraClearFlags.Depth, null);
30344
30194
  // prepare light and camera direction
30345
30195
  engineMath.Matrix.rotationQuaternion(light.entity.transform.worldRotationQuaternion, lightWorld);
30346
30196
  lightSide.set(lightWorldE[0], lightWorldE[1], lightWorldE[2]);
@@ -30448,13 +30298,11 @@ ShadowUtils.atlasBorderSize = 4.0;
30448
30298
  _proto._updateShadowSettings = function _updateShadowSettings() {
30449
30299
  var camera = this._camera;
30450
30300
  var scene = camera.scene;
30451
- var shadowFormat = ShadowUtils.shadowDepthFormat(scene.shadowResolution, this._supportDepthTexture);
30452
30301
  var shadowResolution = ShadowUtils.shadowResolution(scene.shadowResolution);
30453
30302
  var shadowCascades = scene.shadowCascades;
30454
30303
  var shadowFar = Math.min(scene.shadowDistance, camera.farClipPlane);
30455
30304
  this._getCascadesSplitDistance(shadowFar);
30456
- if (shadowFormat !== this._shadowMapFormat || shadowResolution !== this._shadowMapResolution || shadowCascades !== this._shadowCascadeMode) {
30457
- this._shadowMapFormat = shadowFormat;
30305
+ if (shadowResolution !== this._shadowMapResolution || shadowCascades !== this._shadowCascadeMode) {
30458
30306
  this._shadowMapResolution = shadowResolution;
30459
30307
  this._shadowCascadeMode = shadowCascades;
30460
30308
  if (shadowCascades == ShadowCascadesMode.NoCascades) {
@@ -30510,7 +30358,6 @@ CascadedShadowCasterPass._shadowSplitSpheresProperty = ShaderProperty.getByName(
30510
30358
  CascadedShadowCasterPass._maxCascades = 4;
30511
30359
  CascadedShadowCasterPass._cascadesSplitDistance = new Array(CascadedShadowCasterPass._maxCascades + 1);
30512
30360
  CascadedShadowCasterPass._viewport = new engineMath.Vector4(0, 0, 1, 1);
30513
- CascadedShadowCasterPass._clearColor = new engineMath.Color(1, 1, 1, 1);
30514
30361
  CascadedShadowCasterPass._tempVector = new engineMath.Vector3();
30515
30362
  CascadedShadowCasterPass._tempMatrix0 = new engineMath.Matrix();
30516
30363
 
@@ -30552,17 +30399,13 @@ CascadedShadowCasterPass._tempMatrix0 = new engineMath.Matrix();
30552
30399
  * Depth only pass.
30553
30400
  */ var DepthOnlyPass = /*#__PURE__*/ function(PipelinePass) {
30554
30401
  _inherits(DepthOnlyPass, PipelinePass);
30555
- function DepthOnlyPass(engine) {
30556
- var _this;
30557
- _this = PipelinePass.call(this, engine) || this;
30558
- _this.supportDepthTexture = engine._hardwareRenderer.canIUse(GLCapabilityType.depthTexture);
30559
- return _this;
30402
+ function DepthOnlyPass() {
30403
+ return PipelinePass.apply(this, arguments) || this;
30560
30404
  }
30561
30405
  var _proto = DepthOnlyPass.prototype;
30562
30406
  _proto.onConfig = function onConfig(camera) {
30563
- var engine = this.engine;
30564
30407
  var _camera_pixelViewport = camera.pixelViewport, width = _camera_pixelViewport.width, height = _camera_pixelViewport.height;
30565
- var renderTarget = PipelineUtils.recreateRenderTargetIfNeeded(engine, this.renderTarget, width, height, null, engine._hardwareRenderer.isWebGL2 ? TextureFormat.Depth24 : TextureFormat.Depth24Stencil8, true, false, false, 1, TextureWrapMode.Clamp, TextureFilterMode.Point);
30408
+ var renderTarget = PipelineUtils.recreateRenderTargetIfNeeded(this.engine, this.renderTarget, width, height, null, TextureFormat.Depth24, true, false, false, 1, TextureWrapMode.Clamp, TextureFilterMode.Point);
30566
30409
  this.renderTarget = renderTarget;
30567
30410
  };
30568
30411
  _proto.onRender = function onRender(context, cullingResults) {
@@ -30618,7 +30461,6 @@ CascadedShadowCasterPass._tempMatrix0 = new engineMath.Matrix();
30618
30461
  function BasicRenderPipeline(camera) {
30619
30462
  this._lastCanvasSize = new engineMath.Vector2();
30620
30463
  this._internalColorTarget = null;
30621
- this._canUseBlitFrameBuffer = false;
30622
30464
  this._shouldCopyBackgroundColor = false;
30623
30465
  this._camera = camera;
30624
30466
  var engine = camera.engine;
@@ -30663,20 +30505,13 @@ CascadedShadowCasterPass._tempMatrix0 = new engineMath.Matrix();
30663
30505
  var sunlight = scene._lightManager._sunlight;
30664
30506
  var depthOnlyPass = this._depthOnlyPass;
30665
30507
  var ambientOcclusionEnabled = scene.ambientOcclusion._isValid();
30666
- var supportDepthTexture = depthOnlyPass.supportDepthTexture;
30667
30508
  // Ambient occlusion enable will force enable depth prepass
30668
- var depthPassEnabled = (camera.depthTextureMode === DepthTextureMode.PrePass || ambientOcclusionEnabled) && supportDepthTexture;
30509
+ var depthPassEnabled = camera.depthTextureMode === DepthTextureMode.PrePass || ambientOcclusionEnabled;
30669
30510
  var finalClearFlags = camera.clearFlags & ~(ignoreClear != null ? ignoreClear : CameraClearFlags.None);
30670
30511
  var msaaSamples = Math.min(renderTarget ? renderTarget.antiAliasing : camera.msaaSamples, rhi.capability.maxAntiAliasing);
30671
- // Check whether can use `blitFramebuffer` to blit internal render target, source maybe screen canvas or camera's render target
30672
- // Our screen canvas's anti-aliasing is always disable, so blit source and dest is always same by below rules:
30673
- // 1. Only support blitFramebuffer in webgl2 context
30674
- // 2. Can't blit normal FBO to MSAA FBO
30675
- // 3. Can't blit screen MSAA FBO to normal FBO in mac safari platform and mobile, but mac chrome and firfox is OK
30676
- this._canUseBlitFrameBuffer = rhi.isWebGL2 && msaaSamples === 1;
30677
- // Because internal render target is linear color space, so we should convert srgb background color to linear color space
30512
+ // Copy the background when MSAA prevents a direct blit or sRGB needs conversion to linear.
30678
30513
  var isSRGBBackground = !renderTarget || renderTarget.getColorTexture(0).isSRGBColorSpace;
30679
- this._shouldCopyBackgroundColor = independentCanvasEnabled && !(finalClearFlags & CameraClearFlags.Color) && (!this._canUseBlitFrameBuffer || isSRGBBackground);
30514
+ this._shouldCopyBackgroundColor = independentCanvasEnabled && !(finalClearFlags & CameraClearFlags.Color) && (msaaSamples !== 1 || isSRGBBackground);
30680
30515
  if (scene.castShadows && sunlight && sunlight.shadowType !== ShadowType.None) {
30681
30516
  this._cascadedShadowCasterPass.onRender(context);
30682
30517
  }
@@ -30722,7 +30557,7 @@ CascadedShadowCasterPass._tempMatrix0 = new engineMath.Matrix();
30722
30557
  // Scalable ambient obscurance pass
30723
30558
  // Before opaque pass so materials can sample ambient occlusion in BRDF
30724
30559
  var saoPass = this._saoPass;
30725
- if (ambientOcclusionEnabled && supportDepthTexture && saoPass.isSupported) {
30560
+ if (ambientOcclusionEnabled) {
30726
30561
  saoPass.onConfig(camera, this._depthOnlyPass.renderTarget);
30727
30562
  saoPass.onRender(context);
30728
30563
  } else {
@@ -31101,16 +30936,9 @@ var OverlayCamera = function OverlayCamera() {
31101
30936
  _this.xrManager = new XRManager();
31102
30937
  _this.xrManager._initialize(_this, xrDevice);
31103
30938
  }
31104
- if (!hardwareRenderer.canIUse(GLCapabilityType.depthTexture)) {
31105
- _this._macroCollection.enable(Engine._noDepthTextureMacro);
31106
- } else {
31107
- var depthTexture2D = new Texture2D(_this, 1, 1, TextureFormat.Depth16, false, false);
31108
- depthTexture2D.isGCIgnored = true;
31109
- _this._depthTexture2D = depthTexture2D;
31110
- }
31111
- if (!hardwareRenderer.canIUse(GLCapabilityType.sRGB)) {
31112
- _this._macroCollection.enable(Engine._noSRGBSupportMacro);
31113
- }
30939
+ var depthTexture2D = new Texture2D(_this, 1, 1, TextureFormat.Depth16, false, false);
30940
+ depthTexture2D.isGCIgnored = true;
30941
+ _this._depthTexture2D = depthTexture2D;
31114
30942
  _this._basicResources = new BasicResources(_this, Engine._builtinShaders);
31115
30943
  _this._particleBufferUtils = new ParticleBufferUtils(_this);
31116
30944
  var uberPass = new PostProcessUberPass(_this);
@@ -31595,8 +31423,6 @@ var OverlayCamera = function OverlayCamera() {
31595
31423
  ]);
31596
31424
  return Engine;
31597
31425
  }(EventDispatcher);
31598
- /** @internal */ Engine._noDepthTextureMacro = ShaderMacro.getByName("ENGINE_NO_DEPTH_TEXTURE");
31599
- /** @internal */ Engine._noSRGBSupportMacro = ShaderMacro.getByName("ENGINE_NO_SRGB");
31600
31426
  /** @internal */ Engine._outputSRGBCorrectMacro = ShaderMacro.getByName("ENGINE_OUTPUT_SRGB_CORRECT");
31601
31427
  /** @internal Conversion of space units to pixel units for 2D. */ Engine._pixelsPerUnit = 100;
31602
31428
  /** @internal */ Engine._physicalObjectsMap = {};
@@ -36981,7 +36807,6 @@ var ParticleStopMode = /*#__PURE__*/ function(ParticleStopMode) {
36981
36807
  _this.generator = new ParticleGenerator(_this);
36982
36808
  _this._currentRenderModeMacro = ParticleRenderer._billboardModeMacro;
36983
36809
  _this.shaderData.enableMacro(ParticleRenderer._billboardModeMacro);
36984
- _this._supportInstancedArrays = _this.engine._hardwareRenderer.canIUse(GLCapabilityType.instancedArrays);
36985
36810
  _this._onGeneratorParamsChanged();
36986
36811
  return _this;
36987
36812
  }
@@ -37005,9 +36830,7 @@ var ParticleStopMode = /*#__PURE__*/ function(ParticleStopMode) {
37005
36830
  * @internal
37006
36831
  */ _proto._onEnableInScene = function _onEnableInScene() {
37007
36832
  Renderer.prototype._onEnableInScene.call(this);
37008
- if (this._supportInstancedArrays) {
37009
- this.scene._componentsManager._particleSystemManager.add(this);
37010
- }
36833
+ this.scene._componentsManager._particleSystemManager.add(this);
37011
36834
  };
37012
36835
  /**
37013
36836
  * @internal
@@ -37018,14 +36841,6 @@ var ParticleStopMode = /*#__PURE__*/ function(ParticleStopMode) {
37018
36841
  };
37019
36842
  /**
37020
36843
  * @internal
37021
- */ _proto._prepareRender = function _prepareRender(context) {
37022
- if (!this._supportInstancedArrays) {
37023
- return;
37024
- }
37025
- Renderer.prototype._prepareRender.call(this, context);
37026
- };
37027
- /**
37028
- * @internal
37029
36844
  */ _proto._updateTransformShaderData = function _updateTransformShaderData(context, onlyMVP) {
37030
36845
  //@todo: Don't need to update transform shader data, temp solution
37031
36846
  this._updateWorldSpaceTransformShaderData(context, onlyMVP);
@@ -39187,12 +39002,11 @@ __decorate([
39187
39002
  /**
39188
39003
  * @internal
39189
39004
  */ _proto._updateEmitterVelocity = function _updateEmitterVelocity(elapsedTime) {
39190
- var renderer = this._generator._renderer;
39191
- if (this._generator.main.simulationSpace !== ParticleSimulationSpace.World || this._mode !== ParticleInheritVelocityMode.Initial && !renderer.engine._hardwareRenderer.isWebGL2) {
39005
+ if (this._generator.main.simulationSpace !== ParticleSimulationSpace.World) {
39192
39006
  this._resyncEmitterVelocity();
39193
39007
  return;
39194
39008
  }
39195
- var worldPosition = renderer.entity.transform.worldPosition;
39009
+ var worldPosition = this._generator._renderer.entity.transform.worldPosition;
39196
39010
  if (this._hasPreviousWorldPosition && elapsedTime > engineMath.MathUtil.zeroTolerance) {
39197
39011
  var previous = this._previousWorldPosition;
39198
39012
  this._emitterVelocity.set((worldPosition.x - previous.x) / elapsedTime, (worldPosition.y - previous.y) / elapsedTime, (worldPosition.z - previous.z) / elapsedTime);
@@ -39289,7 +39103,7 @@ __decorate([
39289
39103
  /**
39290
39104
  * @internal
39291
39105
  */ _proto._needTransformFeedback = function _needTransformFeedback() {
39292
- return this._enabled && this._mode === ParticleInheritVelocityMode.Current && this._generator.main.simulationSpace === ParticleSimulationSpace.World && this._generator._renderer.engine._hardwareRenderer.isWebGL2;
39106
+ return this._enabled && this._mode === ParticleInheritVelocityMode.Current && this._generator.main.simulationSpace === ParticleSimulationSpace.World;
39293
39107
  };
39294
39108
  /**
39295
39109
  * @internal
@@ -39855,15 +39669,11 @@ __decorate([
39855
39669
  key: "enabled",
39856
39670
  get: /**
39857
39671
  * Specifies whether the module is enabled.
39858
- * @remarks This module requires WebGL2, On WebGL1, enabling will be silently ignored.
39859
39672
  */ function get() {
39860
39673
  return this._enabled;
39861
39674
  },
39862
39675
  set: function set(value) {
39863
39676
  if (value !== this._enabled) {
39864
- if (value && !this._generator._renderer.engine._hardwareRenderer.isWebGL2) {
39865
- return;
39866
- }
39867
39677
  this._enabled = value;
39868
39678
  this._generator._setTransformFeedback();
39869
39679
  this._generator._renderer._onGeneratorParamsChanged();
@@ -41018,9 +40828,6 @@ __decorate([
41018
40828
  },
41019
40829
  set: function set(value) {
41020
40830
  if (value !== this._enabled) {
41021
- if (value && !this._generator._renderer.engine._hardwareRenderer.isWebGL2) {
41022
- return;
41023
- }
41024
40831
  this._enabled = value;
41025
40832
  this._generator._setTransformFeedback();
41026
40833
  this._generator._renderer._onGeneratorParamsChanged();
@@ -41126,9 +40933,8 @@ __decorate([
41126
40933
  }
41127
40934
  }
41128
40935
  shaderData.setInt(VelocityOverLifetimeModule._spaceProperty, this.space);
41129
- var supportsTransformFeedback = this._generator._renderer.engine._hardwareRenderer.isWebGL2;
41130
- var orbitalActive = supportsTransformFeedback && this._isOrbitalActive();
41131
- var radialActive = supportsTransformFeedback && this._isRadialActive();
40936
+ var orbitalActive = this._isOrbitalActive();
40937
+ var radialActive = this._isRadialActive();
41132
40938
  if (orbitalActive) {
41133
40939
  var orbitalX = this._orbitalX;
41134
40940
  var orbitalY = this._orbitalY;
@@ -41194,7 +41000,7 @@ __decorate([
41194
41000
  /**
41195
41001
  * @internal
41196
41002
  */ _proto._needTransformFeedback = function _needTransformFeedback() {
41197
- if (!this._enabled || !this._generator._renderer.engine._hardwareRenderer.isWebGL2) {
41003
+ if (!this._enabled) {
41198
41004
  return false;
41199
41005
  }
41200
41006
  return this._isOrbitalActive() || this._isRadialActive();
@@ -41219,7 +41025,7 @@ __decorate([
41219
41025
  if (isLinearRandomMode) {
41220
41026
  return true;
41221
41027
  }
41222
- if (!this._enabled || !this._generator._renderer.engine._hardwareRenderer.isWebGL2) {
41028
+ if (!this._enabled) {
41223
41029
  return false;
41224
41030
  }
41225
41031
  var orbitalX = this._orbitalX;
@@ -41970,7 +41776,7 @@ __decorate([
41970
41776
  {
41971
41777
  key: "enabled",
41972
41778
  get: function get() {
41973
- return this._enabled && this._generator._renderer.engine._hardwareRenderer.isWebGL2;
41779
+ return this._enabled;
41974
41780
  },
41975
41781
  set: function set(value) {
41976
41782
  if (value !== this._enabled) {
@@ -42370,9 +42176,9 @@ __decorate([
42370
42176
  */ _proto._setTransformFeedback = function _setTransformFeedback() {
42371
42177
  var _this__feedbackSimulator, _this__feedbackSimulator1;
42372
42178
  var engine = this._renderer.engine;
42373
- var isWebGL2 = engine._hardwareRenderer.isWebGL2;
42374
- var useTrajectory = isWebGL2 && (this.subEmitters._hasSubEmitterOfType(ParticleSubEmitterType.Death, false) || this.subEmitters._hasSubEmitterOfType(ParticleSubEmitterType.Birth, false));
42375
- var useFeedback = isWebGL2 && (useTrajectory || this.limitVelocityOverLifetime.enabled || this.noise.enabled || this.inheritVelocity._needTransformFeedback() || this.velocityOverLifetime._needTransformFeedback());
42179
+ var supportsRendering = engine._hardwareRenderer.supportsRendering;
42180
+ var useTrajectory = supportsRendering && (this.subEmitters._hasSubEmitterOfType(ParticleSubEmitterType.Death, false) || this.subEmitters._hasSubEmitterOfType(ParticleSubEmitterType.Birth, false));
42181
+ var useFeedback = supportsRendering && (useTrajectory || this.limitVelocityOverLifetime.enabled || this.noise.enabled || this.inheritVelocity._needTransformFeedback() || this.velocityOverLifetime._needTransformFeedback());
42376
42182
  var _this__feedbackSimulator_trajectoryEnabled;
42377
42183
  var feedbackLayoutChanged = useTrajectory !== ((_this__feedbackSimulator_trajectoryEnabled = (_this__feedbackSimulator = this._feedbackSimulator) == null ? void 0 : _this__feedbackSimulator.trajectoryEnabled) != null ? _this__feedbackSimulator_trajectoryEnabled : false);
42378
42184
  if (useFeedback === (this._feedbackSimulator !== null) && !feedbackLayoutChanged) {