@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/module.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Vector4, MathUtil, Vector2, Matrix, BoundingBox, Rect, Quaternion, Vector3, Matrix3x3, Color, BoundingFrustum, BoundingSphere, Plane, Ray, SphericalHarmonics3, FrustumFace, CollisionUtil, Rand } from '@galacean/engine-math';
1
+ import { Vector4, Vector2, Matrix, BoundingBox, MathUtil, Rect, Quaternion, Vector3, Matrix3x3, Color, BoundingFrustum, BoundingSphere, Plane, Ray, SphericalHarmonics3, FrustumFace, CollisionUtil, Rand } from '@galacean/engine-math';
2
2
  import { normalizeShaderIncludeKey, expandShaderMacros, evaluatePreprocessorExpression, resolvePreprocessorDefinedOperators, expandPreprocessorExpressionMacros, parsePreprocessorExpression } from '@galacean/engine-design';
3
3
 
4
4
  /**
@@ -435,10 +435,6 @@ registerDefaultCloneMode(ReferResource, CloneMode.Assignment);
435
435
  /** 32-bit depth format. */ TextureFormat[TextureFormat["Depth32"] = 32] = "Depth32";
436
436
  /** 16-bit depth + 8-bit stencil format. */ TextureFormat[TextureFormat["Depth24Stencil8"] = 33] = "Depth24Stencil8";
437
437
  /** 32-bit depth + 8-bit stencil format. */ TextureFormat[TextureFormat["Depth32Stencil8"] = 34] = "Depth32Stencil8";
438
- /** @deprecated Use 'TextureFormat.R8' instead. */ TextureFormat[TextureFormat["Alpha8"] = 5] = "Alpha8";
439
- /** @deprecated Use 'TextureFormat.R8G8' instead. */ TextureFormat[TextureFormat["LuminanceAlpha"] = 6] = "LuminanceAlpha";
440
- /** @deprecated Use `TextureFormat.BC1` instead. */ TextureFormat[TextureFormat["DXT1"] = 10] = "DXT1";
441
- /** @deprecated Use `TextureFormat.BC3` instead. */ TextureFormat[TextureFormat["DXT5"] = 11] = "DXT5";
442
438
  return TextureFormat;
443
439
  }({});
444
440
 
@@ -1078,18 +1074,14 @@ SystemInfo._webpSupported = null;
1078
1074
  function TextureUtils() {}
1079
1075
  /**
1080
1076
  * Check if the texture config supports auto mipmap generation with real correction for mipmap and isSRGBColorSpace.
1081
- */ TextureUtils.supportGenerateMipmapsWithCorrection = function supportGenerateMipmapsWithCorrection(engine, width, height, format, mipmap, isSRGBColorSpace) {
1082
- var isWebGL2 = engine._hardwareRenderer.isWebGL2;
1077
+ */ TextureUtils.supportGenerateMipmapsWithCorrection = function supportGenerateMipmapsWithCorrection(format, mipmap, isSRGBColorSpace) {
1083
1078
  if (!mipmap) {
1084
1079
  return false;
1085
1080
  }
1086
1081
  if (isSRGBColorSpace && !TextureUtils.supportSRGB(format)) {
1087
1082
  isSRGBColorSpace = false;
1088
1083
  }
1089
- if (!TextureUtils.supportMipmaps(width, height, isWebGL2)) {
1090
- mipmap = false;
1091
- }
1092
- return TextureUtils.supportGenerateMipmaps(format, mipmap, isSRGBColorSpace, isWebGL2);
1084
+ return TextureUtils.supportGenerateMipmaps(format, mipmap, isSRGBColorSpace);
1093
1085
  };
1094
1086
  TextureUtils.isHDRFormat = function isHDRFormat(format) {
1095
1087
  return format === TextureFormat.R16G16B16A16 || format === TextureFormat.R32G32B32A32 || format === TextureFormat.R11G11B10_UFloat;
@@ -1115,12 +1107,9 @@ SystemInfo._webpSupported = null;
1115
1107
  return false;
1116
1108
  }
1117
1109
  };
1118
- TextureUtils.supportMipmaps = function supportMipmaps(width, height, isWebGL2) {
1119
- return isWebGL2 || MathUtil.isPowerOf2(width) && MathUtil.isPowerOf2(height);
1120
- };
1121
- TextureUtils.supportGenerateMipmaps = function supportGenerateMipmaps(format, mipmap, isSRGBColorSpace, isWebGL2) {
1110
+ TextureUtils.supportGenerateMipmaps = function supportGenerateMipmaps(format, mipmap, isSRGBColorSpace) {
1122
1111
  // Auto generating mipmaps for sRGB textures is only supported in [WebGL2 + RGBA]
1123
- if (mipmap && isSRGBColorSpace && !(isWebGL2 && format === TextureFormat.R8G8B8A8)) {
1112
+ if (mipmap && isSRGBColorSpace && format !== TextureFormat.R8G8B8A8) {
1124
1113
  return false;
1125
1114
  }
1126
1115
  return true;
@@ -1138,10 +1127,8 @@ SystemInfo._webpSupported = null;
1138
1127
  switch(format){
1139
1128
  // Uncompressed formats
1140
1129
  case TextureFormat.R8:
1141
- case TextureFormat.Alpha8:
1142
1130
  return width * height;
1143
1131
  case TextureFormat.R8G8:
1144
- case TextureFormat.LuminanceAlpha:
1145
1132
  return width * height * 2;
1146
1133
  case TextureFormat.R8G8B8:
1147
1134
  return width * height * 3;
@@ -1236,7 +1223,6 @@ SystemInfo._webpSupported = null;
1236
1223
  var _proto = TextureCube.prototype;
1237
1224
  /**
1238
1225
  * Setting pixels data through cube face,color buffer data, designated area and texture mipmapping level,it's also applicable to compressed formats.
1239
- * @remarks When compressed texture is in WebGL1, the texture must be filled first before writing the sub-region
1240
1226
  * @param face - Cube face
1241
1227
  * @param colorBuffer - Color buffer data
1242
1228
  * @param mipLevel - Texture mipmapping level
@@ -1489,7 +1475,6 @@ SystemInfo._webpSupported = null;
1489
1475
  var _proto = Texture2D.prototype;
1490
1476
  /**
1491
1477
  * Setting pixels data through color buffer data, designated area and texture mipmapping level,it's also applicable to compressed formats.
1492
- * @remarks If it is the WebGL1.0 platform and the texture format is compressed, the first upload must be filled with textures.
1493
1478
  * @param colorBuffer - Color buffer data
1494
1479
  * @param mipLevel - Texture mipmapping level
1495
1480
  * @param x - X coordinate of area start
@@ -1565,7 +1550,6 @@ SystemInfo._webpSupported = null;
1565
1550
  var _proto = Texture2DArray.prototype;
1566
1551
  /**
1567
1552
  * Setting pixels data through color buffer data, designated area and texture mipmapping level,it's also applicable to compressed formats.
1568
- * @remarks If it is the WebGL1.0 platform and the texture format is compressed, the first upload must be filled with textures.
1569
1553
  * @param offsetIndex - The texture array element offset index
1570
1554
  * @param colorBuffer - Color buffer data
1571
1555
  * @param mipLevel - Texture mipmapping level
@@ -1639,8 +1623,7 @@ SystemInfo._webpSupported = null;
1639
1623
  var _this;
1640
1624
  _this = ReferResource.call(this, engine) || this, _this._charInfoMap = {}, _this._space = 1, _this._curX = 1, _this._curY = 1, _this._nextY = 1;
1641
1625
  _this.isGCIgnored = true;
1642
- var format = engine._hardwareRenderer.isWebGL2 ? TextureFormat.R8 : TextureFormat.Alpha8;
1643
- var texture = new Texture2D(engine, 512, 512, format, false, false);
1626
+ var texture = new Texture2D(engine, 512, 512, TextureFormat.R8, false, false);
1644
1627
  texture.filterMode = TextureFilterMode.Bilinear;
1645
1628
  texture.isGCIgnored = true;
1646
1629
  _this.texture = texture;
@@ -2069,7 +2052,7 @@ SystemInfo._webpSupported = null;
2069
2052
  if (isChar) {
2070
2053
  var data = null;
2071
2054
  if (size > 0) {
2072
- // Extract alpha channel only for Alpha8 texture format.
2055
+ // Store glyph coverage from the canvas alpha channel in the R8 atlas.
2073
2056
  var alphaPixelCount = size * integerW;
2074
2057
  data = new Uint8Array(alphaPixelCount);
2075
2058
  var offset = top * integerW * 4 + 3;
@@ -2943,28 +2926,12 @@ registerDefaultCloneMode(DataObject, CloneMode.Deep);
2943
2926
  return DataType;
2944
2927
  }({});
2945
2928
  /**
2946
- * GL Capabilities
2947
- * Some capabilities can be smoothed out by extension, and some capabilities must use WebGL 2.0.
2929
+ * Optional GL capabilities.
2948
2930
  * */ var GLCapabilityType = /*#__PURE__*/ function(GLCapabilityType) {
2949
- GLCapabilityType["shaderVertexID"] = "shaderVertexID";
2950
- GLCapabilityType["standardDerivatives"] = "OES_standard_derivatives";
2951
- GLCapabilityType["shaderTextureLod"] = "EXT_shader_texture_lod";
2952
- GLCapabilityType["elementIndexUint"] = "OES_element_index_uint";
2953
- GLCapabilityType["depthTexture"] = "WEBGL_depth_texture";
2954
- GLCapabilityType["drawBuffers"] = "WEBGL_draw_buffers";
2955
- GLCapabilityType["vertexArrayObject"] = "OES_vertex_array_object";
2956
- GLCapabilityType["instancedArrays"] = "ANGLE_instanced_arrays";
2957
- GLCapabilityType["multipleSample"] = "multipleSampleOnlySupportedInWebGL2";
2958
- GLCapabilityType["textureFloat"] = "OES_texture_float";
2959
2931
  GLCapabilityType["textureFloatLinear"] = "OES_texture_float_linear";
2960
- GLCapabilityType["textureHalfFloat"] = "OES_texture_half_float";
2961
- GLCapabilityType["textureHalfFloatLinear"] = "OES_texture_half_float_linear";
2962
- GLCapabilityType["WEBGL_colorBufferFloat"] = "WEBGL_color_buffer_float";
2963
2932
  GLCapabilityType["colorBufferFloat"] = "EXT_color_buffer_float";
2964
2933
  GLCapabilityType["colorBufferHalfFloat"] = "EXT_color_buffer_half_float";
2965
2934
  GLCapabilityType["textureFilterAnisotropic"] = "EXT_texture_filter_anisotropic";
2966
- GLCapabilityType["blendMinMax"] = "EXT_blend_minmax";
2967
- GLCapabilityType["fragDepth"] = "EXT_frag_depth";
2968
2935
  GLCapabilityType["astc"] = "WEBGL_compressed_texture_astc";
2969
2936
  GLCapabilityType["astc_webkit"] = "WEBKIT_WEBGL_compressed_texture_astc";
2970
2937
  GLCapabilityType["astc_hdr"] = "WEBGL_compressed_texture_astc_hdr";
@@ -2979,7 +2946,6 @@ registerDefaultCloneMode(DataObject, CloneMode.Deep);
2979
2946
  GLCapabilityType["s3tc_srgb"] = "WEBGL_compressed_texture_s3tc_srgb";
2980
2947
  GLCapabilityType["bptc"] = "EXT_texture_compression_bptc";
2981
2948
  GLCapabilityType["WEBGL_lose_context"] = "WEBGL_lose_context";
2982
- GLCapabilityType["sRGB"] = "EXT_sRGB";
2983
2949
  return GLCapabilityType;
2984
2950
  }({});
2985
2951
 
@@ -4348,8 +4314,7 @@ var RenderStateElementKey = /*#__PURE__*/ function(RenderStateElementKey) {
4348
4314
  /**
4349
4315
  * Shader language belongs to.
4350
4316
  */ var ShaderLanguage = /*#__PURE__*/ function(ShaderLanguage) {
4351
- /** GLSL ES 100. */ ShaderLanguage[ShaderLanguage["GLSLES100"] = 0] = "GLSLES100";
4352
- /** GLSL ES 300. */ ShaderLanguage[ShaderLanguage["GLSLES300"] = 1] = "GLSLES300";
4317
+ /** GLSL ES 300. */ ShaderLanguage[ShaderLanguage["GLSLES300"] = 0] = "GLSLES300";
4353
4318
  return ShaderLanguage;
4354
4319
  }({});
4355
4320
 
@@ -6904,8 +6869,7 @@ ShaderBlockProperty._nameMap = Object.create(null);
6904
6869
 
6905
6870
  /**
6906
6871
  * Shader registry and GLSL utilities. Holds the `#include` lookup table
6907
- * the runtime preprocessor reads, the GLSL ES 100 → 300 syntax converter
6908
- * the WebGL2 path uses, and the GPU-instancing UBO injector that
6872
+ * the runtime preprocessor reads and the GPU-instancing UBO injector that
6909
6873
  * `ShaderPass` runs over compiled GLSL source.
6910
6874
  */ var ShaderFactory = /*#__PURE__*/ function() {
6911
6875
  function ShaderFactory() {}
@@ -6942,36 +6906,6 @@ ShaderBlockProperty._nameMap = Object.create(null);
6942
6906
  ShaderFactory.unregisterInclude(includeName);
6943
6907
  };
6944
6908
  /**
6945
- * Convert lower GLSL version to GLSL 300 es.
6946
- * @param shader - code
6947
- * @param isFrag - Whether it is a fragment shader.
6948
- */ ShaderFactory.convertTo300 = function convertTo300(shader, isFrag) {
6949
- shader = shader.replace(/\bvarying\b/g, isFrag ? "in" : "out");
6950
- shader = shader.replace(/\btexture(2D|Cube)\b/g, "texture");
6951
- shader = shader.replace(/\btexture2DProj\b/g, "textureProj");
6952
- shader = shader.replace(/\btexture(2D|Cube)LodEXT\b/g, "textureLod");
6953
- shader = shader.replace(/\btexture(2D|Cube)GradEXT\b/g, "textureGrad");
6954
- shader = shader.replace(/\btexture2DProjLodEXT\b/g, "textureProjLod");
6955
- shader = shader.replace(/\btexture2DProjGradEXT\b/g, "textureProjGrad");
6956
- if (isFrag) {
6957
- shader = shader.replace(/\bgl_FragDepthEXT\b/g, "gl_FragDepth");
6958
- if (!ShaderFactory._has300OutInFragReg.test(shader)) {
6959
- var isMRT = /\bgl_FragData\[.+?\]/g.test(shader);
6960
- if (isMRT) {
6961
- shader = shader.replace(/\bgl_FragColor\b/g, "gl_FragData[0]");
6962
- var result = shader.match(/\bgl_FragData\[.+?\]/g);
6963
- shader = ShaderFactory._replaceMRTShader(shader, result);
6964
- } else {
6965
- shader = "out vec4 glFragColor;\n" + shader;
6966
- shader = shader.replace(/\bgl_FragColor\b/g, "glFragColor");
6967
- }
6968
- }
6969
- } else {
6970
- shader = shader.replace(/\battribute\b/g, "in");
6971
- }
6972
- return shader;
6973
- };
6974
- /**
6975
6909
  * Scan VS/FS for renderer-group `uniform` declarations, replace them with a shared
6976
6910
  * std140 UBO (instanced array), and emit `#define` remapping so original uniform
6977
6911
  * names resolve to `rendererData[instanceID].field`.
@@ -7108,33 +7042,12 @@ ShaderBlockProperty._nameMap = Object.create(null);
7108
7042
  }
7109
7043
  return lines.join("\n");
7110
7044
  };
7111
- ShaderFactory._replaceMRTShader = function _replaceMRTShader(shader, result) {
7112
- var declaration = "";
7113
- var mrtIndexSet = new Set();
7114
- for(var i = 0; i < result.length; i++){
7115
- var res = result[i].match(/\bgl_FragData\[(.+?)\]/);
7116
- mrtIndexSet.add(res[1]);
7117
- }
7118
- mrtIndexSet.forEach(function(index) {
7119
- declaration += "layout(location=" + index + ") out vec4 fragOutColor" + index + ";\n";
7120
- });
7121
- shader = shader.replace(/\bgl_FragData\[(.+?)\]/g, "fragOutColor$1");
7122
- return declaration + shader;
7123
- };
7124
7045
  return ShaderFactory;
7125
7046
  }();
7126
7047
  ShaderFactory.RENDERER_INSTANCE_BLOCK_NAME = "RendererInstanceData";
7127
7048
  var _obj;
7128
7049
  ShaderFactory.uniformBlockBindingMap = (_obj = {}, _obj[ShaderBlockProperty.getByName(ShaderFactory.RENDERER_INSTANCE_BLOCK_NAME)._uniqueId] = ConstantBufferBindingPoint.RendererInstance, _obj);
7129
7050
  ShaderFactory.includeMap = Object.create(null);
7130
- ShaderFactory.shaderExtension = [
7131
- "GL_EXT_shader_texture_lod",
7132
- "GL_OES_standard_derivatives",
7133
- "GL_EXT_draw_buffers",
7134
- "GL_EXT_frag_depth"
7135
- ].map(function(e) {
7136
- return "#extension " + e + " : enable\n";
7137
- }).join("");
7138
7051
  ShaderFactory._std140TypeInfoMap = {
7139
7052
  float: {
7140
7053
  size: 4,
@@ -7197,8 +7110,6 @@ ShaderFactory._std140TypeInfoMap = {
7197
7110
  align: 16
7198
7111
  }
7199
7112
  };
7200
- // [layout(location = 0)] out [highp] vec4 [color];
7201
- ShaderFactory._has300OutInFragReg = /\bout\s+(?:\w+\s+)?vec4\s+\w+\s*;/;
7202
7113
  // Derived built-ins re-exposed on top of `renderer_ModelMat`.
7203
7114
  // `renderer_NormalMat` uses the cofactor (cross-product) form, which algebraically equals
7204
7115
  // `det(M) · transpose(inverse(M))`. After `normalize()` it's directionally identical to the
@@ -7941,18 +7852,16 @@ ShaderTagKey._nameMap = Object.create(null);
7941
7852
  _this.attributeLocation[name] = gl.getAttribLocation(program, name);
7942
7853
  });
7943
7854
  // Record uniform block indices and bind binding points (WebGL2 only)
7944
- if (this._engine._hardwareRenderer.isWebGL2) {
7945
- var gl2 = gl;
7946
- var bindingMap = ShaderFactory.uniformBlockBindingMap;
7947
- var _gl2_getProgramParameter;
7948
- var blockCount = (_gl2_getProgramParameter = gl2.getProgramParameter(program, gl2.ACTIVE_UNIFORM_BLOCKS)) != null ? _gl2_getProgramParameter : 0;
7949
- for(var i = 0; i < blockCount; i++){
7950
- var id = ShaderBlockProperty.getByName(gl2.getActiveUniformBlockName(program, i))._uniqueId;
7951
- this.uniformBlockIds[i] = id;
7952
- var bindingPoint = bindingMap[id];
7953
- if (bindingPoint !== undefined) {
7954
- gl2.uniformBlockBinding(program, i, bindingPoint);
7955
- }
7855
+ var gl2 = gl;
7856
+ var bindingMap = ShaderFactory.uniformBlockBindingMap;
7857
+ var _gl2_getProgramParameter;
7858
+ var blockCount = (_gl2_getProgramParameter = gl2.getProgramParameter(program, gl2.ACTIVE_UNIFORM_BLOCKS)) != null ? _gl2_getProgramParameter : 0;
7859
+ for(var i = 0; i < blockCount; i++){
7860
+ var id = ShaderBlockProperty.getByName(gl2.getActiveUniformBlockName(program, i))._uniqueId;
7861
+ this.uniformBlockIds[i] = id;
7862
+ var bindingPoint = bindingMap[id];
7863
+ if (bindingPoint !== undefined) {
7864
+ gl2.uniformBlockBinding(program, i, bindingPoint);
7956
7865
  }
7957
7866
  }
7958
7867
  };
@@ -8545,15 +8454,9 @@ ShaderMacroProcessor._expressionContext = {
8545
8454
  case BlendOperation.ReverseSubtract:
8546
8455
  return gl.FUNC_REVERSE_SUBTRACT;
8547
8456
  case BlendOperation.Min:
8548
- if (!rhi.canIUse(GLCapabilityType.blendMinMax)) {
8549
- throw new Error("BlendOperation.Min is not supported in this context");
8550
- }
8551
- return gl.MIN; // in webgl1.0 is an extension
8457
+ return gl.MIN;
8552
8458
  case BlendOperation.Max:
8553
- if (!rhi.canIUse(GLCapabilityType.blendMinMax)) {
8554
- throw new Error("BlendOperation.Max is not supported in this context");
8555
- }
8556
- return gl.MAX; // in webgl1.0 is an extension
8459
+ return gl.MAX;
8557
8460
  }
8558
8461
  };
8559
8462
  return BlendState;
@@ -8969,14 +8872,13 @@ var precisionStr = "\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision hig
8969
8872
  * Shader pass containing vertex and fragment source.
8970
8873
  */ var ShaderPass = /*#__PURE__*/ function(ShaderPart) {
8971
8874
  _inherits(ShaderPass, ShaderPart);
8972
- function ShaderPass(name, vertexShaderInstructions, fragmentShaderInstructions, platformTarget, tags, vertexOutputNames) {
8875
+ function ShaderPass(name, vertexShaderInstructions, fragmentShaderInstructions, _platformTarget, tags, vertexOutputNames) {
8973
8876
  var _this;
8974
8877
  _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 = [];
8975
8878
  _this._shaderPassId = ShaderPass._shaderPassCounter++;
8976
8879
  _this._name = name;
8977
8880
  _this._vertexShaderInstructions = vertexShaderInstructions;
8978
8881
  _this._fragmentShaderInstructions = fragmentShaderInstructions;
8979
- _this._platformTarget = platformTarget;
8980
8882
  _this._vertexOutputNames = vertexOutputNames;
8981
8883
  var mergedTags = _extends({
8982
8884
  pipelineStage: PipelineStage.Forward
@@ -9026,17 +8928,12 @@ var precisionStr = "\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision hig
9026
8928
  return program;
9027
8929
  };
9028
8930
  _proto._compileShaderSource = function _compileShaderSource(engine, macroCollection, isGPUInstance) {
9029
- var isWebGL2 = engine._hardwareRenderer.isWebGL2;
9030
8931
  var shaderMacroList = ShaderPass._shaderMacroList;
9031
8932
  shaderMacroList.length = 0;
9032
8933
  ShaderMacro._getMacrosElements(macroCollection, shaderMacroList);
9033
- shaderMacroList.push(ShaderMacro.getByName(isWebGL2 ? "GRAPHICS_API_WEBGL2" : "GRAPHICS_API_WEBGL1"));
9034
- if (engine._hardwareRenderer.canIUse(GLCapabilityType.shaderTextureLod)) {
9035
- shaderMacroList.push(ShaderMacro.getByName("HAS_TEX_LOD"));
9036
- }
9037
- if (engine._hardwareRenderer.canIUse(GLCapabilityType.standardDerivatives)) {
9038
- shaderMacroList.push(ShaderMacro.getByName("HAS_DERIVATIVES"));
9039
- }
8934
+ shaderMacroList.push(ShaderMacro.getByName("GRAPHICS_API_WEBGL2"));
8935
+ shaderMacroList.push(ShaderMacro.getByName("HAS_TEX_LOD"));
8936
+ shaderMacroList.push(ShaderMacro.getByName("HAS_DERIVATIVES"));
9040
8937
  var macroMap = ShaderPass._macroMap;
9041
8938
  macroMap.clear();
9042
8939
  for(var i = 0, n = shaderMacroList.length; i < n; i++){
@@ -9053,14 +8950,10 @@ var precisionStr = "\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision hig
9053
8950
  fragmentSource = injected.fragmentSource;
9054
8951
  instanceLayout = injected.instanceLayout;
9055
8952
  }
9056
- if (isWebGL2 && this._platformTarget === ShaderLanguage.GLSLES100) {
9057
- vertexSource = ShaderFactory.convertTo300(vertexSource);
9058
- fragmentSource = ShaderFactory.convertTo300(fragmentSource, true);
9059
- }
9060
- var versionStr = isWebGL2 ? "#version 300 es" : "#version 100";
8953
+ var versionStr = "#version 300 es";
9061
8954
  return {
9062
8955
  vertexSource: " " + versionStr + "\n " + vertexSource + "\n ",
9063
- fragmentSource: " " + versionStr + "\n " + (isWebGL2 ? "" : ShaderFactory.shaderExtension) + "\n " + precisionStr + "\n " + fragmentSource + "\n ",
8956
+ fragmentSource: " " + versionStr + "\n " + precisionStr + "\n " + fragmentSource + "\n ",
9064
8957
  instanceLayout: instanceLayout
9065
8958
  };
9066
8959
  };
@@ -9182,7 +9075,7 @@ ShaderPass._macroMap = new Map();
9182
9075
  };
9183
9076
  Shader.create = function create(nameOrShaderSource, shaderPassesOrSubShadersOrPlatformTarget) {
9184
9077
  if (shaderPassesOrSubShadersOrPlatformTarget == undefined || typeof shaderPassesOrSubShadersOrPlatformTarget === "number") {
9185
- var platformTarget = typeof shaderPassesOrSubShadersOrPlatformTarget === "number" ? shaderPassesOrSubShadersOrPlatformTarget : ShaderLanguage.GLSLES100;
9078
+ var platformTarget = typeof shaderPassesOrSubShadersOrPlatformTarget === "number" ? shaderPassesOrSubShadersOrPlatformTarget : ShaderLanguage.GLSLES300;
9186
9079
  return Shader._createFromSource(nameOrShaderSource, platformTarget);
9187
9080
  }
9188
9081
  if (shaderPassesOrSubShadersOrPlatformTarget.length === 0) {
@@ -9204,7 +9097,7 @@ ShaderPass._macroMap = new Map();
9204
9097
  * @throws When the shader compiler is unavailable or a pass cannot be compiled.
9205
9098
  * @internal
9206
9099
  */ Shader._createFromSource = function _createFromSource(shaderSource, platformTarget, sourceFile) {
9207
- if (platformTarget === void 0) platformTarget = ShaderLanguage.GLSLES100;
9100
+ if (platformTarget === void 0) platformTarget = ShaderLanguage.GLSLES300;
9208
9101
  var shaderCompiler = Shader._shaderCompiler;
9209
9102
  if (!shaderCompiler) {
9210
9103
  throw "ShaderCompiler has not been set up yet.";
@@ -13217,7 +13110,6 @@ var BlendShapeFrameDirty = /*#__PURE__*/ function(BlendShapeFrameDirty) {
13217
13110
  /**
13218
13111
  * @internal
13219
13112
  */ _proto._canBatch = function _canBatch(preElement, curElement) {
13220
- if (!this._engine._hardwareRenderer.isWebGL2) return false;
13221
13113
  var curShaderData = curElement.component.shaderData;
13222
13114
  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
13223
13115
  this.shaderData._matchesRendererBatchShared(curShaderData);
@@ -13310,11 +13202,9 @@ __decorate([
13310
13202
  this._maxCountSingleVertexBuffer = 0;
13311
13203
  this._lastHostCreatedInfo = new Vector4() // x: blendShapeCount, y: useNormal, z: useBlendTangent, w: vertexCount
13312
13204
  ;
13313
- this._canUseTextureStoreData = true;
13314
13205
  this._dataTextureInfo = new Vector3();
13315
13206
  this._engine = engine;
13316
13207
  this._modelMesh = modelMesh;
13317
- this._canUseTextureStoreData = this._engine._hardwareRenderer.capability.canUseFloatTextureBlendShape;
13318
13208
  this._updateLayoutChange = this._updateLayoutChange.bind(this);
13319
13209
  }
13320
13210
  var _proto = BlendShapeManager.prototype;
@@ -13396,10 +13286,7 @@ __decorate([
13396
13286
  /**
13397
13287
  * @internal
13398
13288
  */ _proto._useTextureMode = function _useTextureMode() {
13399
- if (!this._canUseTextureStoreData) {
13400
- return false;
13401
- }
13402
- return this._blendShapeCount > this._getVertexBufferModeSupportCount();
13289
+ return this._blendShapeCount > this._getVertexBufferModeSupportCount() && this._engine._hardwareRenderer.supportsRendering;
13403
13290
  };
13404
13291
  /**
13405
13292
  * @internal
@@ -17242,9 +17129,6 @@ var TriangulationNode = function TriangulationNode(i, x, y) {
17242
17129
  }
17243
17130
  var data = generate.apply(void 0, [].concat(args));
17244
17131
  data.trim();
17245
- if (data.vertexCount > 65535 && !engine._hardwareRenderer.canIUse(GLCapabilityType.elementIndexUint)) {
17246
- throw new Error("The vertex count is over limit.");
17247
- }
17248
17132
  var mesh = new ModelMesh(engine);
17249
17133
  var vertices = data.vertices;
17250
17134
  var indices = data.indices;
@@ -17927,21 +17811,16 @@ var SkinUpdateFlag = /*#__PURE__*/ function(SkinUpdateFlag) {
17927
17811
  // directly use max joint count to avoid shader recompile
17928
17812
  var remainUniformJointCount = Math.ceil((this._maxVertexUniformVectors - (SkinnedMeshRenderer._baseVertexUniformVectorCount + bsUniformOccupiesCount)) / 4);
17929
17813
  if (boneCount > remainUniformJointCount) {
17930
- var engine = this.engine;
17931
- if (engine._hardwareRenderer.canIUseMoreJoints) {
17932
- if (boneCountChange) {
17933
- var _this__jointTexture;
17934
- (_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
17935
- this._jointTexture = new Texture2D(engine, 4, boneCount, TextureFormat.R32G32B32A32, false, false);
17936
- this._jointTexture.filterMode = TextureFilterMode.Point;
17937
- this._jointTexture.isGCIgnored = true;
17938
- }
17939
- shaderData.disableMacro("RENDERER_JOINTS_NUM");
17940
- shaderData.enableMacro("RENDERER_USE_JOINT_TEXTURE");
17941
- shaderData.setTexture(SkinnedMeshRenderer._jointSamplerProperty, this._jointTexture);
17942
- } else {
17943
- 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);
17814
+ if (boneCountChange) {
17815
+ var _this__jointTexture;
17816
+ (_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
17817
+ this._jointTexture = new Texture2D(this.engine, 4, boneCount, TextureFormat.R32G32B32A32, false, false);
17818
+ this._jointTexture.filterMode = TextureFilterMode.Point;
17819
+ this._jointTexture.isGCIgnored = true;
17944
17820
  }
17821
+ shaderData.disableMacro("RENDERER_JOINTS_NUM");
17822
+ shaderData.enableMacro("RENDERER_USE_JOINT_TEXTURE");
17823
+ shaderData.setTexture(SkinnedMeshRenderer._jointSamplerProperty, this._jointTexture);
17945
17824
  } else {
17946
17825
  var _this__jointTexture1;
17947
17826
  (_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
@@ -18300,17 +18179,14 @@ __decorate([
18300
18179
  ]);
18301
18180
  this.whiteTexture2D = this._create1x1Texture(engine, 0, TextureFormat.R8G8B8A8, whitePixel, true);
18302
18181
  this.whiteTextureCube = this._create1x1Texture(engine, 1, TextureFormat.R8G8B8A8, whitePixel, true);
18303
- var isWebGL2 = engine._hardwareRenderer.isWebGL2;
18304
- if (isWebGL2) {
18305
- this.whiteTexture2DArray = this._create1x1Texture(engine, 2, TextureFormat.R8G8B8A8, whitePixel, true);
18306
- var whitePixel32 = new Uint32Array([
18307
- 255,
18308
- 255,
18309
- 255,
18310
- 255
18311
- ]);
18312
- this.uintWhiteTexture2D = this._create1x1Texture(engine, 0, TextureFormat.R32G32B32A32_UInt, whitePixel32, false);
18313
- }
18182
+ this.whiteTexture2DArray = this._create1x1Texture(engine, 2, TextureFormat.R8G8B8A8, whitePixel, true);
18183
+ var whitePixel32 = new Uint32Array([
18184
+ 255,
18185
+ 255,
18186
+ 255,
18187
+ 255
18188
+ ]);
18189
+ this.uintWhiteTexture2D = this._create1x1Texture(engine, 0, TextureFormat.R32G32B32A32_UInt, whitePixel32, false);
18314
18190
  this.spriteDefaultMaterial = this._create2DMaterial(engine, shaders.sprite);
18315
18191
  this.textDefaultMaterial = this._create2DMaterial(engine, shaders.text);
18316
18192
  this.spriteMaskDefaultMaterial = this._create2DMaterial(engine, shaders.spriteMask);
@@ -26334,7 +26210,6 @@ Scene._prefilterdDFGProperty = ShaderProperty.getByName("scene_PrefilteredDFG");
26334
26210
  /** Texture. */ AssetType["Texture"] = "Texture";
26335
26211
  /** Material. */ AssetType["Material"] = "Material";
26336
26212
  /** Shader. */ AssetType["Shader"] = "Shader";
26337
- /** Mesh. */ AssetType["Mesh"] = "Mesh";
26338
26213
  /** AnimationClip. */ AssetType["AnimationClip"] = "AnimationClip";
26339
26214
  /** AnimatorController. */ AssetType["AnimatorController"] = "AnimatorController";
26340
26215
  /** Prefab.*/ AssetType["Prefab"] = "Prefab";
@@ -29128,10 +29003,6 @@ var Camera = /*#__PURE__*/ function(Component) {
29128
29003
  this._updateShaderData();
29129
29004
  // union scene and camera macro.
29130
29005
  ShaderMacroCollection.unionCollection(this.scene.shaderData._macroCollection, this.shaderData._macroCollection, this._globalShaderMacro);
29131
- if (mipLevel > 0 && !engine._hardwareRenderer.isWebGL2) {
29132
- mipLevel = 0;
29133
- Logger.error("mipLevel only take effect in WebGL2.0");
29134
- }
29135
29006
  var ignoreClearFlags;
29136
29007
  if (this._cameraType !== CameraType.Normal && !this._renderTarget) {
29137
29008
  ignoreClearFlags = engine.xrManager._getCameraIgnoreClearFlags(this._cameraType);
@@ -29658,7 +29529,6 @@ Camera = __decorate([
29658
29529
  var material = new Material(engine, shader);
29659
29530
  material._addReferCount(1);
29660
29531
  _this._material = material;
29661
- _this.isSupported = _this.engine._hardwareRenderer.capability.isFragmentHighPrecision;
29662
29532
  return _this;
29663
29533
  }
29664
29534
  var _proto = ScalableAmbientObscurancePass.prototype;
@@ -29826,13 +29696,6 @@ ScalableAmbientObscurancePass._kernelProp = ShaderProperty.getByName("material_k
29826
29696
  return 4096;
29827
29697
  }
29828
29698
  };
29829
- ShadowUtils.shadowDepthFormat = function shadowDepthFormat(value, supportDepthTexture) {
29830
- if (supportDepthTexture) {
29831
- return TextureFormat.Depth16;
29832
- } else {
29833
- return TextureFormat.R8G8B8A8;
29834
- }
29835
- };
29836
29699
  ShadowUtils.cullingRenderBounds = function cullingRenderBounds(bounds, cullPlaneCount, cullPlanes) {
29837
29700
  var min = bounds.min, max = bounds.max;
29838
29701
  for(var i = 0; i < cullPlaneCount; i++){
@@ -30288,7 +30151,6 @@ ShadowUtils.atlasBorderSize = 4.0;
30288
30151
  new Vector2()
30289
30152
  ];
30290
30153
  _this._camera = camera;
30291
- _this._supportDepthTexture = camera.engine._hardwareRenderer.canIUse(GLCapabilityType.depthTexture);
30292
30154
  _this._shadowSliceData.virtualCamera.isOrthographic = true;
30293
30155
  return _this;
30294
30156
  }
@@ -30317,26 +30179,14 @@ ShadowUtils.atlasBorderSize = 4.0;
30317
30179
  var lightForward = shadowSliceData.virtualCamera.forward;
30318
30180
  // Prepare render target
30319
30181
  var _this__shadowMapSize = this._shadowMapSize, width = _this__shadowMapSize.z, height = _this__shadowMapSize.w;
30320
- var format = this._shadowMapFormat;
30321
- var renderTarget;
30322
- var shadowTexture;
30323
- if (this._supportDepthTexture) {
30324
- renderTarget = PipelineUtils.recreateRenderTargetIfNeeded(engine, this._renderTarget, width, height, null, format, true, false, false, 1, TextureWrapMode.Clamp, TextureFilterMode.Bilinear);
30325
- shadowTexture = renderTarget.depthTexture;
30326
- } else {
30327
- renderTarget = PipelineUtils.recreateRenderTargetIfNeeded(engine, this._renderTarget, width, height, format, null, false, false, false, 1, TextureWrapMode.Clamp, TextureFilterMode.Bilinear);
30328
- shadowTexture = renderTarget.getColorTexture(0);
30329
- }
30182
+ var renderTarget = PipelineUtils.recreateRenderTargetIfNeeded(engine, this._renderTarget, width, height, null, TextureFormat.Depth16, true, false, false, 1, TextureWrapMode.Clamp, TextureFilterMode.Bilinear);
30183
+ var shadowTexture = renderTarget.depthTexture;
30330
30184
  shadowTexture.depthCompareFunction = TextureDepthCompareFunction.Less;
30331
30185
  this._renderTarget = renderTarget;
30332
30186
  this._depthTexture = shadowTexture;
30333
30187
  // @todo: shouldn't set viewport and scissor in activeRenderTarget
30334
30188
  context.setRenderTarget(renderTarget, CascadedShadowCasterPass._viewport, 0);
30335
- if (this._supportDepthTexture) {
30336
- rhi.clearRenderTarget(engine, CameraClearFlags.Depth, null);
30337
- } else {
30338
- rhi.clearRenderTarget(engine, CameraClearFlags.All, CascadedShadowCasterPass._clearColor);
30339
- }
30189
+ rhi.clearRenderTarget(engine, CameraClearFlags.Depth, null);
30340
30190
  // prepare light and camera direction
30341
30191
  Matrix.rotationQuaternion(light.entity.transform.worldRotationQuaternion, lightWorld);
30342
30192
  lightSide.set(lightWorldE[0], lightWorldE[1], lightWorldE[2]);
@@ -30444,13 +30294,11 @@ ShadowUtils.atlasBorderSize = 4.0;
30444
30294
  _proto._updateShadowSettings = function _updateShadowSettings() {
30445
30295
  var camera = this._camera;
30446
30296
  var scene = camera.scene;
30447
- var shadowFormat = ShadowUtils.shadowDepthFormat(scene.shadowResolution, this._supportDepthTexture);
30448
30297
  var shadowResolution = ShadowUtils.shadowResolution(scene.shadowResolution);
30449
30298
  var shadowCascades = scene.shadowCascades;
30450
30299
  var shadowFar = Math.min(scene.shadowDistance, camera.farClipPlane);
30451
30300
  this._getCascadesSplitDistance(shadowFar);
30452
- if (shadowFormat !== this._shadowMapFormat || shadowResolution !== this._shadowMapResolution || shadowCascades !== this._shadowCascadeMode) {
30453
- this._shadowMapFormat = shadowFormat;
30301
+ if (shadowResolution !== this._shadowMapResolution || shadowCascades !== this._shadowCascadeMode) {
30454
30302
  this._shadowMapResolution = shadowResolution;
30455
30303
  this._shadowCascadeMode = shadowCascades;
30456
30304
  if (shadowCascades == ShadowCascadesMode.NoCascades) {
@@ -30506,7 +30354,6 @@ CascadedShadowCasterPass._shadowSplitSpheresProperty = ShaderProperty.getByName(
30506
30354
  CascadedShadowCasterPass._maxCascades = 4;
30507
30355
  CascadedShadowCasterPass._cascadesSplitDistance = new Array(CascadedShadowCasterPass._maxCascades + 1);
30508
30356
  CascadedShadowCasterPass._viewport = new Vector4(0, 0, 1, 1);
30509
- CascadedShadowCasterPass._clearColor = new Color(1, 1, 1, 1);
30510
30357
  CascadedShadowCasterPass._tempVector = new Vector3();
30511
30358
  CascadedShadowCasterPass._tempMatrix0 = new Matrix();
30512
30359
 
@@ -30548,17 +30395,13 @@ CascadedShadowCasterPass._tempMatrix0 = new Matrix();
30548
30395
  * Depth only pass.
30549
30396
  */ var DepthOnlyPass = /*#__PURE__*/ function(PipelinePass) {
30550
30397
  _inherits(DepthOnlyPass, PipelinePass);
30551
- function DepthOnlyPass(engine) {
30552
- var _this;
30553
- _this = PipelinePass.call(this, engine) || this;
30554
- _this.supportDepthTexture = engine._hardwareRenderer.canIUse(GLCapabilityType.depthTexture);
30555
- return _this;
30398
+ function DepthOnlyPass() {
30399
+ return PipelinePass.apply(this, arguments) || this;
30556
30400
  }
30557
30401
  var _proto = DepthOnlyPass.prototype;
30558
30402
  _proto.onConfig = function onConfig(camera) {
30559
- var engine = this.engine;
30560
30403
  var _camera_pixelViewport = camera.pixelViewport, width = _camera_pixelViewport.width, height = _camera_pixelViewport.height;
30561
- 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);
30404
+ var renderTarget = PipelineUtils.recreateRenderTargetIfNeeded(this.engine, this.renderTarget, width, height, null, TextureFormat.Depth24, true, false, false, 1, TextureWrapMode.Clamp, TextureFilterMode.Point);
30562
30405
  this.renderTarget = renderTarget;
30563
30406
  };
30564
30407
  _proto.onRender = function onRender(context, cullingResults) {
@@ -30614,7 +30457,6 @@ CascadedShadowCasterPass._tempMatrix0 = new Matrix();
30614
30457
  function BasicRenderPipeline(camera) {
30615
30458
  this._lastCanvasSize = new Vector2();
30616
30459
  this._internalColorTarget = null;
30617
- this._canUseBlitFrameBuffer = false;
30618
30460
  this._shouldCopyBackgroundColor = false;
30619
30461
  this._camera = camera;
30620
30462
  var engine = camera.engine;
@@ -30659,20 +30501,13 @@ CascadedShadowCasterPass._tempMatrix0 = new Matrix();
30659
30501
  var sunlight = scene._lightManager._sunlight;
30660
30502
  var depthOnlyPass = this._depthOnlyPass;
30661
30503
  var ambientOcclusionEnabled = scene.ambientOcclusion._isValid();
30662
- var supportDepthTexture = depthOnlyPass.supportDepthTexture;
30663
30504
  // Ambient occlusion enable will force enable depth prepass
30664
- var depthPassEnabled = (camera.depthTextureMode === DepthTextureMode.PrePass || ambientOcclusionEnabled) && supportDepthTexture;
30505
+ var depthPassEnabled = camera.depthTextureMode === DepthTextureMode.PrePass || ambientOcclusionEnabled;
30665
30506
  var finalClearFlags = camera.clearFlags & ~(ignoreClear != null ? ignoreClear : CameraClearFlags.None);
30666
30507
  var msaaSamples = Math.min(renderTarget ? renderTarget.antiAliasing : camera.msaaSamples, rhi.capability.maxAntiAliasing);
30667
- // Check whether can use `blitFramebuffer` to blit internal render target, source maybe screen canvas or camera's render target
30668
- // Our screen canvas's anti-aliasing is always disable, so blit source and dest is always same by below rules:
30669
- // 1. Only support blitFramebuffer in webgl2 context
30670
- // 2. Can't blit normal FBO to MSAA FBO
30671
- // 3. Can't blit screen MSAA FBO to normal FBO in mac safari platform and mobile, but mac chrome and firfox is OK
30672
- this._canUseBlitFrameBuffer = rhi.isWebGL2 && msaaSamples === 1;
30673
- // Because internal render target is linear color space, so we should convert srgb background color to linear color space
30508
+ // Copy the background when MSAA prevents a direct blit or sRGB needs conversion to linear.
30674
30509
  var isSRGBBackground = !renderTarget || renderTarget.getColorTexture(0).isSRGBColorSpace;
30675
- this._shouldCopyBackgroundColor = independentCanvasEnabled && !(finalClearFlags & CameraClearFlags.Color) && (!this._canUseBlitFrameBuffer || isSRGBBackground);
30510
+ this._shouldCopyBackgroundColor = independentCanvasEnabled && !(finalClearFlags & CameraClearFlags.Color) && (msaaSamples !== 1 || isSRGBBackground);
30676
30511
  if (scene.castShadows && sunlight && sunlight.shadowType !== ShadowType.None) {
30677
30512
  this._cascadedShadowCasterPass.onRender(context);
30678
30513
  }
@@ -30718,7 +30553,7 @@ CascadedShadowCasterPass._tempMatrix0 = new Matrix();
30718
30553
  // Scalable ambient obscurance pass
30719
30554
  // Before opaque pass so materials can sample ambient occlusion in BRDF
30720
30555
  var saoPass = this._saoPass;
30721
- if (ambientOcclusionEnabled && supportDepthTexture && saoPass.isSupported) {
30556
+ if (ambientOcclusionEnabled) {
30722
30557
  saoPass.onConfig(camera, this._depthOnlyPass.renderTarget);
30723
30558
  saoPass.onRender(context);
30724
30559
  } else {
@@ -31097,16 +30932,9 @@ var OverlayCamera = function OverlayCamera() {
31097
30932
  _this.xrManager = new XRManager();
31098
30933
  _this.xrManager._initialize(_this, xrDevice);
31099
30934
  }
31100
- if (!hardwareRenderer.canIUse(GLCapabilityType.depthTexture)) {
31101
- _this._macroCollection.enable(Engine._noDepthTextureMacro);
31102
- } else {
31103
- var depthTexture2D = new Texture2D(_this, 1, 1, TextureFormat.Depth16, false, false);
31104
- depthTexture2D.isGCIgnored = true;
31105
- _this._depthTexture2D = depthTexture2D;
31106
- }
31107
- if (!hardwareRenderer.canIUse(GLCapabilityType.sRGB)) {
31108
- _this._macroCollection.enable(Engine._noSRGBSupportMacro);
31109
- }
30935
+ var depthTexture2D = new Texture2D(_this, 1, 1, TextureFormat.Depth16, false, false);
30936
+ depthTexture2D.isGCIgnored = true;
30937
+ _this._depthTexture2D = depthTexture2D;
31110
30938
  _this._basicResources = new BasicResources(_this, Engine._builtinShaders);
31111
30939
  _this._particleBufferUtils = new ParticleBufferUtils(_this);
31112
30940
  var uberPass = new PostProcessUberPass(_this);
@@ -31591,8 +31419,6 @@ var OverlayCamera = function OverlayCamera() {
31591
31419
  ]);
31592
31420
  return Engine;
31593
31421
  }(EventDispatcher);
31594
- /** @internal */ Engine._noDepthTextureMacro = ShaderMacro.getByName("ENGINE_NO_DEPTH_TEXTURE");
31595
- /** @internal */ Engine._noSRGBSupportMacro = ShaderMacro.getByName("ENGINE_NO_SRGB");
31596
31422
  /** @internal */ Engine._outputSRGBCorrectMacro = ShaderMacro.getByName("ENGINE_OUTPUT_SRGB_CORRECT");
31597
31423
  /** @internal Conversion of space units to pixel units for 2D. */ Engine._pixelsPerUnit = 100;
31598
31424
  /** @internal */ Engine._physicalObjectsMap = {};
@@ -36977,7 +36803,6 @@ var ParticleStopMode = /*#__PURE__*/ function(ParticleStopMode) {
36977
36803
  _this.generator = new ParticleGenerator(_this);
36978
36804
  _this._currentRenderModeMacro = ParticleRenderer._billboardModeMacro;
36979
36805
  _this.shaderData.enableMacro(ParticleRenderer._billboardModeMacro);
36980
- _this._supportInstancedArrays = _this.engine._hardwareRenderer.canIUse(GLCapabilityType.instancedArrays);
36981
36806
  _this._onGeneratorParamsChanged();
36982
36807
  return _this;
36983
36808
  }
@@ -37001,9 +36826,7 @@ var ParticleStopMode = /*#__PURE__*/ function(ParticleStopMode) {
37001
36826
  * @internal
37002
36827
  */ _proto._onEnableInScene = function _onEnableInScene() {
37003
36828
  Renderer.prototype._onEnableInScene.call(this);
37004
- if (this._supportInstancedArrays) {
37005
- this.scene._componentsManager._particleSystemManager.add(this);
37006
- }
36829
+ this.scene._componentsManager._particleSystemManager.add(this);
37007
36830
  };
37008
36831
  /**
37009
36832
  * @internal
@@ -37014,14 +36837,6 @@ var ParticleStopMode = /*#__PURE__*/ function(ParticleStopMode) {
37014
36837
  };
37015
36838
  /**
37016
36839
  * @internal
37017
- */ _proto._prepareRender = function _prepareRender(context) {
37018
- if (!this._supportInstancedArrays) {
37019
- return;
37020
- }
37021
- Renderer.prototype._prepareRender.call(this, context);
37022
- };
37023
- /**
37024
- * @internal
37025
36840
  */ _proto._updateTransformShaderData = function _updateTransformShaderData(context, onlyMVP) {
37026
36841
  //@todo: Don't need to update transform shader data, temp solution
37027
36842
  this._updateWorldSpaceTransformShaderData(context, onlyMVP);
@@ -39183,12 +38998,11 @@ __decorate([
39183
38998
  /**
39184
38999
  * @internal
39185
39000
  */ _proto._updateEmitterVelocity = function _updateEmitterVelocity(elapsedTime) {
39186
- var renderer = this._generator._renderer;
39187
- if (this._generator.main.simulationSpace !== ParticleSimulationSpace.World || this._mode !== ParticleInheritVelocityMode.Initial && !renderer.engine._hardwareRenderer.isWebGL2) {
39001
+ if (this._generator.main.simulationSpace !== ParticleSimulationSpace.World) {
39188
39002
  this._resyncEmitterVelocity();
39189
39003
  return;
39190
39004
  }
39191
- var worldPosition = renderer.entity.transform.worldPosition;
39005
+ var worldPosition = this._generator._renderer.entity.transform.worldPosition;
39192
39006
  if (this._hasPreviousWorldPosition && elapsedTime > MathUtil.zeroTolerance) {
39193
39007
  var previous = this._previousWorldPosition;
39194
39008
  this._emitterVelocity.set((worldPosition.x - previous.x) / elapsedTime, (worldPosition.y - previous.y) / elapsedTime, (worldPosition.z - previous.z) / elapsedTime);
@@ -39285,7 +39099,7 @@ __decorate([
39285
39099
  /**
39286
39100
  * @internal
39287
39101
  */ _proto._needTransformFeedback = function _needTransformFeedback() {
39288
- return this._enabled && this._mode === ParticleInheritVelocityMode.Current && this._generator.main.simulationSpace === ParticleSimulationSpace.World && this._generator._renderer.engine._hardwareRenderer.isWebGL2;
39102
+ return this._enabled && this._mode === ParticleInheritVelocityMode.Current && this._generator.main.simulationSpace === ParticleSimulationSpace.World;
39289
39103
  };
39290
39104
  /**
39291
39105
  * @internal
@@ -39851,15 +39665,11 @@ __decorate([
39851
39665
  key: "enabled",
39852
39666
  get: /**
39853
39667
  * Specifies whether the module is enabled.
39854
- * @remarks This module requires WebGL2, On WebGL1, enabling will be silently ignored.
39855
39668
  */ function get() {
39856
39669
  return this._enabled;
39857
39670
  },
39858
39671
  set: function set(value) {
39859
39672
  if (value !== this._enabled) {
39860
- if (value && !this._generator._renderer.engine._hardwareRenderer.isWebGL2) {
39861
- return;
39862
- }
39863
39673
  this._enabled = value;
39864
39674
  this._generator._setTransformFeedback();
39865
39675
  this._generator._renderer._onGeneratorParamsChanged();
@@ -41014,9 +40824,6 @@ __decorate([
41014
40824
  },
41015
40825
  set: function set(value) {
41016
40826
  if (value !== this._enabled) {
41017
- if (value && !this._generator._renderer.engine._hardwareRenderer.isWebGL2) {
41018
- return;
41019
- }
41020
40827
  this._enabled = value;
41021
40828
  this._generator._setTransformFeedback();
41022
40829
  this._generator._renderer._onGeneratorParamsChanged();
@@ -41122,9 +40929,8 @@ __decorate([
41122
40929
  }
41123
40930
  }
41124
40931
  shaderData.setInt(VelocityOverLifetimeModule._spaceProperty, this.space);
41125
- var supportsTransformFeedback = this._generator._renderer.engine._hardwareRenderer.isWebGL2;
41126
- var orbitalActive = supportsTransformFeedback && this._isOrbitalActive();
41127
- var radialActive = supportsTransformFeedback && this._isRadialActive();
40932
+ var orbitalActive = this._isOrbitalActive();
40933
+ var radialActive = this._isRadialActive();
41128
40934
  if (orbitalActive) {
41129
40935
  var orbitalX = this._orbitalX;
41130
40936
  var orbitalY = this._orbitalY;
@@ -41190,7 +40996,7 @@ __decorate([
41190
40996
  /**
41191
40997
  * @internal
41192
40998
  */ _proto._needTransformFeedback = function _needTransformFeedback() {
41193
- if (!this._enabled || !this._generator._renderer.engine._hardwareRenderer.isWebGL2) {
40999
+ if (!this._enabled) {
41194
41000
  return false;
41195
41001
  }
41196
41002
  return this._isOrbitalActive() || this._isRadialActive();
@@ -41215,7 +41021,7 @@ __decorate([
41215
41021
  if (isLinearRandomMode) {
41216
41022
  return true;
41217
41023
  }
41218
- if (!this._enabled || !this._generator._renderer.engine._hardwareRenderer.isWebGL2) {
41024
+ if (!this._enabled) {
41219
41025
  return false;
41220
41026
  }
41221
41027
  var orbitalX = this._orbitalX;
@@ -41966,7 +41772,7 @@ __decorate([
41966
41772
  {
41967
41773
  key: "enabled",
41968
41774
  get: function get() {
41969
- return this._enabled && this._generator._renderer.engine._hardwareRenderer.isWebGL2;
41775
+ return this._enabled;
41970
41776
  },
41971
41777
  set: function set(value) {
41972
41778
  if (value !== this._enabled) {
@@ -42366,9 +42172,9 @@ __decorate([
42366
42172
  */ _proto._setTransformFeedback = function _setTransformFeedback() {
42367
42173
  var _this__feedbackSimulator, _this__feedbackSimulator1;
42368
42174
  var engine = this._renderer.engine;
42369
- var isWebGL2 = engine._hardwareRenderer.isWebGL2;
42370
- var useTrajectory = isWebGL2 && (this.subEmitters._hasSubEmitterOfType(ParticleSubEmitterType.Death, false) || this.subEmitters._hasSubEmitterOfType(ParticleSubEmitterType.Birth, false));
42371
- var useFeedback = isWebGL2 && (useTrajectory || this.limitVelocityOverLifetime.enabled || this.noise.enabled || this.inheritVelocity._needTransformFeedback() || this.velocityOverLifetime._needTransformFeedback());
42175
+ var supportsRendering = engine._hardwareRenderer.supportsRendering;
42176
+ var useTrajectory = supportsRendering && (this.subEmitters._hasSubEmitterOfType(ParticleSubEmitterType.Death, false) || this.subEmitters._hasSubEmitterOfType(ParticleSubEmitterType.Birth, false));
42177
+ var useFeedback = supportsRendering && (useTrajectory || this.limitVelocityOverLifetime.enabled || this.noise.enabled || this.inheritVelocity._needTransformFeedback() || this.velocityOverLifetime._needTransformFeedback());
42372
42178
  var _this__feedbackSimulator_trajectoryEnabled;
42373
42179
  var feedbackLayoutChanged = useTrajectory !== ((_this__feedbackSimulator_trajectoryEnabled = (_this__feedbackSimulator = this._feedbackSimulator) == null ? void 0 : _this__feedbackSimulator.trajectoryEnabled) != null ? _this__feedbackSimulator_trajectoryEnabled : false);
42374
42180
  if (useFeedback === (this._feedbackSimulator !== null) && !feedbackLayoutChanged) {