@galacean/engine-core 1.2.0-beta.0 → 1.2.0-beta.2

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
@@ -627,7 +627,7 @@ var Utils = /*#__PURE__*/ function() {
627
627
  if (Utils.isBase64Url(relativeUrl)) {
628
628
  return relativeUrl;
629
629
  }
630
- return relativeUrl ? baseUrl.replace(/\/+$/, "") + "/" + relativeUrl.replace(/^\/+/, "") : baseUrl;
630
+ return relativeUrl ? new URL(relativeUrl, baseUrl).href : baseUrl;
631
631
  };
632
632
  /**
633
633
  * @internal
@@ -770,14 +770,6 @@ var Utils = /*#__PURE__*/ function() {
770
770
  });
771
771
  return result;
772
772
  };
773
- Utils._formatRelativePath = function _formatRelativePath(path) {
774
- // For example input is "a/b", "/a/b", "./a/b", "./a/./b", "./a/../a/b", output is "a/b"
775
- return path.split("/").filter(Boolean).reduce(function(acc, cur) {
776
- if (cur === "..") acc.pop();
777
- else if (cur !== ".") acc.push(cur);
778
- return acc;
779
- }, []).join("/");
780
- };
781
773
  Utils._insertionSort = function _insertionSort(a, from, to, compareFunc) {
782
774
  for(var i = from + 1; i < to; i++){
783
775
  var j = void 0;
@@ -1667,6 +1659,7 @@ exports.GLCapabilityType = void 0;
1667
1659
  GLCapabilityType["colorBufferHalfFloat"] = "EXT_color_buffer_half_float";
1668
1660
  GLCapabilityType["textureFilterAnisotropic"] = "EXT_texture_filter_anisotropic";
1669
1661
  GLCapabilityType["blendMinMax"] = "EXT_blend_minmax";
1662
+ GLCapabilityType["fragDepth"] = "EXT_frag_depth";
1670
1663
  GLCapabilityType["astc"] = "WEBGL_compressed_texture_astc";
1671
1664
  GLCapabilityType["astc_webkit"] = "WEBKIT_WEBGL_compressed_texture_astc";
1672
1665
  GLCapabilityType["etc"] = "WEBGL_compressed_texture_etc";
@@ -3430,23 +3423,34 @@ var ShaderFactory = /*#__PURE__*/ function() {
3430
3423
  * @param shader - code
3431
3424
  * @param isFrag - Whether it is a fragment shader.
3432
3425
  * */ ShaderFactory.convertTo300 = function convertTo300(shader, isFrag) {
3433
- /** replace attribute and in */ shader = shader.replace(/\battribute\b/g, "in");
3434
3426
  shader = shader.replace(/\bvarying\b/g, isFrag ? "in" : "out");
3435
- /** replace api */ shader = shader.replace(/\btexture(2D|Cube)\b/g, "texture");
3436
- shader = shader.replace(/\btexture(2D|Cube)LodEXT\b/g, "textureLod");
3427
+ shader = shader.replace(/\btexture(2D|Cube)\b/g, "texture");
3428
+ shader = shader.replace(/\btexture2DProj\b/g, "textureProj");
3437
3429
  if (isFrag) {
3438
- var isMRT = /\bgl_FragData\[.+?\]/g.test(shader);
3439
- if (isMRT) {
3440
- shader = shader.replace(/\bgl_FragColor\b/g, "gl_FragData[0]");
3441
- var result = shader.match(/\bgl_FragData\[.+?\]/g);
3442
- shader = this._replaceMRTShader(shader, result);
3443
- } else {
3444
- shader = shader.replace(/void\s+?main\s*\(/g, "out vec4 glFragColor;\nvoid main(");
3445
- shader = shader.replace(/\bgl_FragColor\b/g, "glFragColor");
3430
+ shader = shader.replace(/\btexture(2D|Cube)LodEXT\b/g, "textureLod");
3431
+ shader = shader.replace(/\btexture(2D|Cube)GradEXT\b/g, "textureGrad");
3432
+ shader = shader.replace(/\btexture2DProjLodEXT\b/g, "textureProjLod");
3433
+ shader = shader.replace(/\btexture2DProjGradEXT\b/g, "textureProjGrad");
3434
+ shader = shader.replace(/\bgl_FragDepthEXT\b/g, "gl_FragDepth");
3435
+ if (!ShaderFactory._has300Output(shader)) {
3436
+ var isMRT = /\bgl_FragData\[.+?\]/g.test(shader);
3437
+ if (isMRT) {
3438
+ shader = shader.replace(/\bgl_FragColor\b/g, "gl_FragData[0]");
3439
+ var result = shader.match(/\bgl_FragData\[.+?\]/g);
3440
+ shader = this._replaceMRTShader(shader, result);
3441
+ } else {
3442
+ shader = shader.replace(/void\s+?main\s*\(/g, "out vec4 glFragColor;\nvoid main(");
3443
+ shader = shader.replace(/\bgl_FragColor\b/g, "glFragColor");
3444
+ }
3446
3445
  }
3446
+ } else {
3447
+ shader = shader.replace(/\battribute\b/g, "in");
3447
3448
  }
3448
3449
  return shader;
3449
3450
  };
3451
+ ShaderFactory._has300Output = function _has300Output(fragmentShader) {
3452
+ return ShaderFactory._has300OutInFragReg.test(fragmentShader);
3453
+ };
3450
3454
  ShaderFactory._replaceMRTShader = function _replaceMRTShader(shader, result) {
3451
3455
  var declaration = "";
3452
3456
  var mrtIndexSet = new Set();
@@ -3468,11 +3472,16 @@ var ShaderFactory = /*#__PURE__*/ function() {
3468
3472
  /** @internal */ ShaderFactory._shaderExtension = [
3469
3473
  "GL_EXT_shader_texture_lod",
3470
3474
  "GL_OES_standard_derivatives",
3471
- "GL_EXT_draw_buffers"
3475
+ "GL_EXT_draw_buffers",
3476
+ "GL_EXT_frag_depth"
3472
3477
  ].map(function(e) {
3473
3478
  return "#extension " + e + " : enable\n";
3474
3479
  }).join("");
3475
3480
  })();
3481
+ (function() {
3482
+ ShaderFactory._has300OutInFragReg = /\bout\s+(?:\w+\s+)?(?:vec4)\s+(?:\w+)\s*;/ // [layout(location = 0)] out [highp] vec4 [color];
3483
+ ;
3484
+ })();
3476
3485
 
3477
3486
  /**
3478
3487
  * Shader tag key.
@@ -3763,6 +3772,10 @@ var ShaderFactory = /*#__PURE__*/ function() {
3763
3772
  this.materialUniformBlock = new ShaderUniformBlock();
3764
3773
  this.otherUniformBlock = new ShaderUniformBlock();
3765
3774
  /** @internal */ this._uploadRenderCount = -1;
3775
+ /** @internal */ this._uploadSceneId = -1;
3776
+ /** @internal */ this._uploadCameraId = -1;
3777
+ /** @internal */ this._uploadRendererId = -1;
3778
+ /** @internal */ this._uploadMaterialId = -1;
3766
3779
  this.attributeLocation = Object.create(null);
3767
3780
  this._activeTextureUint = 0;
3768
3781
  this._engine = engine;
@@ -6928,6 +6941,7 @@ var BufferUtil = /*#__PURE__*/ function() {
6928
6941
  this._isContentLost = false;
6929
6942
  };
6930
6943
  _proto._onDestroy = function _onDestroy() {
6944
+ GraphicsResource1.prototype._onDestroy.call(this);
6931
6945
  this._platformPrimitive.destroy();
6932
6946
  this._vertexElementMap = null;
6933
6947
  };
@@ -11443,10 +11457,8 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
11443
11457
  var vertexStride = this.createVertexElements(vertexElements);
11444
11458
  // vertices
11445
11459
  var vertexBuffer = this._vertexBuffers[index] = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * vertexStride, exports.BufferUsage.Dynamic);
11446
- vertexBuffer.isGCIgnored = true;
11447
11460
  // indices
11448
11461
  var indiceBuffer = this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 6, exports.BufferUsage.Dynamic);
11449
- indiceBuffer.isGCIgnored = true;
11450
11462
  mesh.setVertexBufferBinding(vertexBuffer, vertexStride);
11451
11463
  mesh.setIndexBufferBinding(indiceBuffer, exports.IndexFormat.UInt16);
11452
11464
  mesh.setVertexElements(vertexElements);
@@ -15092,6 +15104,7 @@ var BaseMaterial = /*#__PURE__*/ function(Material1) {
15092
15104
  1
15093
15105
  ]); // left-top
15094
15106
  var blitMaterial = new Material(engine, Shader.find("blit"));
15107
+ blitMaterial._addReferCount(1);
15095
15108
  blitMaterial.renderState.depthState.enabled = false;
15096
15109
  blitMaterial.renderState.depthState.writeEnabled = false;
15097
15110
  this.blitMesh = this._createBlitMesh(engine, vertices);
@@ -15791,6 +15804,9 @@ var ComponentCloner = /*#__PURE__*/ function() {
15791
15804
  projectionParams.set(flipProjection ? -1 : 1, virtualCamera.nearClipPlane, virtualCamera.farClipPlane, 0);
15792
15805
  shaderData.setVector4(RenderContext._cameraProjectionProperty, projectionParams);
15793
15806
  };
15807
+ _proto.garbageCollection = function garbageCollection() {
15808
+ this.camera = null;
15809
+ };
15794
15810
  return RenderContext;
15795
15811
  }();
15796
15812
  (function() {
@@ -19923,66 +19939,85 @@ __decorate([
19923
19939
 
19924
19940
  /**
19925
19941
  * @internal
19926
- */ var ParticleBufferUtils = /*#__PURE__*/ function() {
19927
- function ParticleBufferUtils(engine) {
19928
- this.billboardVertexElement = new VertexElement(ParticleBillboardVertexAttribute.cornerTextureCoordinate, 0, exports.VertexElementFormat.Vector4, 0);
19929
- this.instanceVertexElements = [
19930
- new VertexElement(ParticleInstanceVertexAttribute.ShapePositionStartLifeTime, 0, exports.VertexElementFormat.Vector4, 1, 1),
19931
- new VertexElement(ParticleInstanceVertexAttribute.DirectionTime, 16, exports.VertexElementFormat.Vector4, 1, 1),
19932
- new VertexElement(ParticleInstanceVertexAttribute.StartColor, 32, exports.VertexElementFormat.Vector4, 1, 1),
19933
- new VertexElement(ParticleInstanceVertexAttribute.StartSize, 48, exports.VertexElementFormat.Vector3, 1, 1),
19934
- new VertexElement(ParticleInstanceVertexAttribute.StartRotation0, 60, exports.VertexElementFormat.Vector3, 1, 1),
19935
- new VertexElement(ParticleInstanceVertexAttribute.StartSpeed, 72, exports.VertexElementFormat.Float, 1, 1),
19936
- new VertexElement(ParticleInstanceVertexAttribute.Random0, 76, exports.VertexElementFormat.Vector4, 1, 1),
19937
- new VertexElement(ParticleInstanceVertexAttribute.Random1, 92, exports.VertexElementFormat.Vector4, 1, 1),
19938
- new VertexElement(ParticleInstanceVertexAttribute.SimulationWorldPosition, 108, exports.VertexElementFormat.Vector3, 1, 1),
19939
- new VertexElement(ParticleInstanceVertexAttribute.SimulationWorldRotation, 120, exports.VertexElementFormat.Vector4, 1, 1),
19940
- new VertexElement(ParticleInstanceVertexAttribute.SimulationUV, 136, exports.VertexElementFormat.Vector4, 1, 1)
19941
- ];
19942
- this.instanceVertexStride = 152;
19943
- this.instanceVertexFloatStride = this.instanceVertexStride / 4;
19944
- this.startLifeTimeOffset = 3;
19945
- this.timeOffset = 7;
19946
- this.simulationUVOffset = 34;
19947
- this.billboardIndexCount = 6;
19948
- var stride = 16;
19949
- var billboardGeometryBuffer = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, stride * 4, exports.BufferUsage.Static, false);
19950
- this.billboardVertexBufferBinding = new VertexBufferBinding(billboardGeometryBuffer, stride);
19951
- var indexBuffer = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, this.billboardIndexCount, exports.BufferUsage.Static, false);
19952
- this.billboardIndexBufferBinding = new IndexBufferBinding(indexBuffer, exports.IndexFormat.UInt8);
19953
- this.setBufferData();
19954
- }
19955
- var _proto = ParticleBufferUtils.prototype;
19956
- _proto.setBufferData = function setBufferData() {
19957
- this.billboardVertexBufferBinding.buffer.setData(new Float32Array([
19958
- -0.5,
19959
- -0.5,
19960
- 0,
19961
- 1,
19962
- 0.5,
19963
- -0.5,
19964
- 1,
19965
- 1,
19966
- 0.5,
19967
- 0.5,
19968
- 1,
19969
- 0,
19970
- -0.5,
19971
- 0.5,
19972
- 0,
19973
- 0
19974
- ]));
19975
- this.billboardIndexBufferBinding.buffer.setData(new Uint8Array([
19976
- 0,
19977
- 2,
19978
- 3,
19979
- 0,
19980
- 1,
19981
- 2
19982
- ]));
19983
- };
19984
- return ParticleBufferUtils;
19985
- }();
19942
+ */ var ParticleBufferUtils = function ParticleBufferUtils(engine) {
19943
+ this.billboardVertexElement = new VertexElement(ParticleBillboardVertexAttribute.cornerTextureCoordinate, 0, exports.VertexElementFormat.Vector4, 0);
19944
+ this.instanceVertexElements = [
19945
+ new VertexElement(ParticleInstanceVertexAttribute.ShapePositionStartLifeTime, 0, exports.VertexElementFormat.Vector4, 1, 1),
19946
+ new VertexElement(ParticleInstanceVertexAttribute.DirectionTime, 16, exports.VertexElementFormat.Vector4, 1, 1),
19947
+ new VertexElement(ParticleInstanceVertexAttribute.StartColor, 32, exports.VertexElementFormat.Vector4, 1, 1),
19948
+ new VertexElement(ParticleInstanceVertexAttribute.StartSize, 48, exports.VertexElementFormat.Vector3, 1, 1),
19949
+ new VertexElement(ParticleInstanceVertexAttribute.StartRotation0, 60, exports.VertexElementFormat.Vector3, 1, 1),
19950
+ new VertexElement(ParticleInstanceVertexAttribute.StartSpeed, 72, exports.VertexElementFormat.Float, 1, 1),
19951
+ new VertexElement(ParticleInstanceVertexAttribute.Random0, 76, exports.VertexElementFormat.Vector4, 1, 1),
19952
+ new VertexElement(ParticleInstanceVertexAttribute.Random1, 92, exports.VertexElementFormat.Vector4, 1, 1),
19953
+ new VertexElement(ParticleInstanceVertexAttribute.SimulationWorldPosition, 108, exports.VertexElementFormat.Vector3, 1, 1),
19954
+ new VertexElement(ParticleInstanceVertexAttribute.SimulationWorldRotation, 120, exports.VertexElementFormat.Vector4, 1, 1),
19955
+ new VertexElement(ParticleInstanceVertexAttribute.SimulationUV, 136, exports.VertexElementFormat.Vector4, 1, 1)
19956
+ ];
19957
+ this.instanceVertexStride = 152;
19958
+ this.instanceVertexFloatStride = this.instanceVertexStride / 4;
19959
+ this.startLifeTimeOffset = 3;
19960
+ this.timeOffset = 7;
19961
+ this.simulationUVOffset = 34;
19962
+ this.billboardIndexCount = 6;
19963
+ var stride = 16;
19964
+ var billboardGeometryBuffer = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, stride * 4, exports.BufferUsage.Static, false);
19965
+ billboardGeometryBuffer.isGCIgnored = true;
19966
+ this.billboardVertexBufferBinding = new VertexBufferBinding(billboardGeometryBuffer, stride);
19967
+ var indexBuffer = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, this.billboardIndexCount, exports.BufferUsage.Static, false);
19968
+ indexBuffer.isGCIgnored = true;
19969
+ this.billboardIndexBufferBinding = new IndexBufferBinding(indexBuffer, exports.IndexFormat.UInt8);
19970
+ var billboardGeometryData = new Float32Array([
19971
+ -0.5,
19972
+ -0.5,
19973
+ 0,
19974
+ 1,
19975
+ 0.5,
19976
+ -0.5,
19977
+ 1,
19978
+ 1,
19979
+ 0.5,
19980
+ 0.5,
19981
+ 1,
19982
+ 0,
19983
+ -0.5,
19984
+ 0.5,
19985
+ 0,
19986
+ 0
19987
+ ]);
19988
+ var indexData = new Uint8Array([
19989
+ 0,
19990
+ 2,
19991
+ 3,
19992
+ 0,
19993
+ 1,
19994
+ 2
19995
+ ]);
19996
+ billboardGeometryBuffer.setData(billboardGeometryData);
19997
+ indexBuffer.setData(indexData);
19998
+ // Register content restorer
19999
+ engine.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
20000
+ _inherits(_class, ContentRestorer);
20001
+ function _class() {
20002
+ return ContentRestorer.call(this, billboardGeometryBuffer);
20003
+ }
20004
+ var _proto = _class.prototype;
20005
+ _proto.restoreContent = function restoreContent() {
20006
+ billboardGeometryBuffer.setData(billboardGeometryData);
20007
+ };
20008
+ return _class;
20009
+ }(ContentRestorer))());
20010
+ engine.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
20011
+ _inherits(_class, ContentRestorer);
20012
+ function _class() {
20013
+ return ContentRestorer.call(this, indexBuffer);
20014
+ }
20015
+ var _proto = _class.prototype;
20016
+ _proto.restoreContent = function restoreContent() {
20017
+ };
20018
+ return _class;
20019
+ }(ContentRestorer))());
20020
+ };
19986
20021
 
19987
20022
  var blitFs = "#define GLSLIFY 1\nuniform mediump sampler2D renderer_BlitTexture;\n#ifdef HAS_TEX_LOD\nuniform float renderer_BlitMipLevel;\n#endif\nvarying vec2 v_uv;void main(){\n#ifdef HAS_TEX_LOD\ngl_FragColor=texture2DLodEXT(renderer_BlitTexture,v_uv,renderer_BlitMipLevel);\n#else\ngl_FragColor=texture2D(renderer_BlitTexture,v_uv);\n#endif\n}"; // eslint-disable-line
19988
20023
 
@@ -20684,7 +20719,6 @@ ShaderPool.init();
20684
20719
  resourceManager._restoreGraphicResources();
20685
20720
  console.log("Graphic resource restored.");
20686
20721
  // Restore resources content
20687
- this._particleBufferUtils.setBufferData();
20688
20722
  resourceManager._restoreResourcesContent().then(function() {
20689
20723
  console.log("Graphic resource content restored.\n\n" + "Device restored.");
20690
20724
  _this.dispatch("devicerestored", _this);
@@ -20699,6 +20733,7 @@ ShaderPool.init();
20699
20733
  this._spriteRenderDataPool.garbageCollection();
20700
20734
  this._spriteMaskRenderDataPool.garbageCollection();
20701
20735
  this._textRenderDataPool.garbageCollection();
20736
+ this._renderContext.garbageCollection();
20702
20737
  };
20703
20738
  _create_class(Engine, [
20704
20739
  {
@@ -21056,7 +21091,6 @@ ShaderPool.init();
21056
21091
  };
21057
21092
  _proto._createPlane = function _createPlane(engine) {
21058
21093
  var mesh = new ModelMesh(engine);
21059
- mesh.isGCIgnored = true;
21060
21094
  var indices = new Uint8Array([
21061
21095
  1,
21062
21096
  2,
@@ -23041,22 +23075,6 @@ __decorate([
23041
23075
  maskManager.postRender(renderer);
23042
23076
  }
23043
23077
  };
23044
- _proto.destroy = function destroy() {
23045
- this._batchedQueue = null;
23046
- var _this = this, meshes = _this._meshes, vertexBuffers = _this._vertexBuffers, indiceBuffers = _this._indiceBuffers;
23047
- for(var i = 0, n = meshes.length; i < n; ++i){
23048
- meshes[i].destroy();
23049
- }
23050
- this._meshes = null;
23051
- for(var i1 = 0, n1 = vertexBuffers.length; i1 < n1; ++i1){
23052
- vertexBuffers[i1].destroy();
23053
- }
23054
- this._vertexBuffers = null;
23055
- for(var i2 = 0, n2 = indiceBuffers.length; i2 < n2; ++i2){
23056
- indiceBuffers[i2].destroy();
23057
- }
23058
- this._indiceBuffers = null;
23059
- };
23060
23078
  return SpriteBatcher;
23061
23079
  }(Basic2DBatcher);
23062
23080
  (function() {
@@ -23082,11 +23100,10 @@ __decorate([
23082
23100
  if (elements.length === 0) {
23083
23101
  return;
23084
23102
  }
23085
- var engine = camera.engine, scene = camera.scene;
23103
+ var engine = camera.engine, cameraId = camera.instanceId, cameraData = camera.shaderData;
23104
+ var _camera_scene = camera.scene, sceneData = _camera_scene.shaderData, sceneId = _camera_scene.instanceId;
23086
23105
  var renderCount = engine._renderCount;
23087
23106
  var rhi = engine._hardwareRenderer;
23088
- var sceneData = scene.shaderData;
23089
- var cameraData = camera.shaderData;
23090
23107
  var pipelineStageKey = RenderContext.pipelineStageKey;
23091
23108
  var renderQueueType = this._renderQueueType;
23092
23109
  for(var i = 0, n = elements.length; i < n; i++){
@@ -23098,9 +23115,8 @@ __decorate([
23098
23115
  var primitive = data.primitive;
23099
23116
  var renderer = data.component;
23100
23117
  var material = data.material;
23101
- var rendererData = renderer.shaderData;
23102
- var materialData = material.shaderData;
23103
- var renderStates = material.renderStates;
23118
+ var rendererData = renderer.shaderData, rendererId = renderer.instanceId;
23119
+ var materialData = material.shaderData, materialId = material.instanceId, renderStates = material.renderStates;
23104
23120
  // union render global macro and material self macro.
23105
23121
  ShaderMacroCollection.unionCollection(renderer._globalShaderMacro, materialData._macroCollection, compileMacros);
23106
23122
  for(var j = 0, m = shaderPasses.length; j < m; j++){
@@ -23126,33 +23142,33 @@ __decorate([
23126
23142
  program.uploadAll(program.materialUniformBlock, materialData);
23127
23143
  // UnGroup textures should upload default value, texture uint maybe change by logic of texture bind.
23128
23144
  program.uploadUnGroupTextures();
23129
- program._uploadScene = scene;
23130
- program._uploadCamera = camera;
23131
- program._uploadRenderer = renderer;
23132
- program._uploadMaterial = material;
23145
+ program._uploadSceneId = sceneId;
23146
+ program._uploadCameraId = cameraId;
23147
+ program._uploadRendererId = rendererId;
23148
+ program._uploadMaterialId = materialId;
23133
23149
  program._uploadRenderCount = renderCount;
23134
23150
  } else {
23135
- if (program._uploadScene !== scene) {
23151
+ if (program._uploadSceneId !== sceneId) {
23136
23152
  program.uploadAll(program.sceneUniformBlock, sceneData);
23137
- program._uploadScene = scene;
23153
+ program._uploadSceneId = sceneId;
23138
23154
  } else if (switchProgram) {
23139
23155
  program.uploadTextures(program.sceneUniformBlock, sceneData);
23140
23156
  }
23141
- if (program._uploadCamera !== camera) {
23157
+ if (program._uploadCameraId !== cameraId) {
23142
23158
  program.uploadAll(program.cameraUniformBlock, cameraData);
23143
- program._uploadCamera = camera;
23159
+ program._uploadCameraId = cameraId;
23144
23160
  } else if (switchProgram) {
23145
23161
  program.uploadTextures(program.cameraUniformBlock, cameraData);
23146
23162
  }
23147
- if (program._uploadRenderer !== renderer) {
23163
+ if (program._uploadRendererId !== rendererId) {
23148
23164
  program.uploadAll(program.rendererUniformBlock, rendererData);
23149
- program._uploadRenderer = renderer;
23165
+ program._uploadRendererId = rendererId;
23150
23166
  } else if (switchProgram) {
23151
23167
  program.uploadTextures(program.rendererUniformBlock, rendererData);
23152
23168
  }
23153
- if (program._uploadMaterial !== material) {
23169
+ if (program._uploadMaterialId !== materialId) {
23154
23170
  program.uploadAll(program.materialUniformBlock, materialData);
23155
- program._uploadMaterial = material;
23171
+ program._uploadMaterialId = materialId;
23156
23172
  } else if (switchProgram) {
23157
23173
  program.uploadTextures(program.materialUniformBlock, materialData);
23158
23174
  }