@galacean/engine-core 1.1.0-beta.11 → 1.1.0-beta.12

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
@@ -16566,7 +16566,7 @@ var unlitVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>\n#in
16566
16566
  * @internal
16567
16567
  */ var ShaderProgramPool = /*#__PURE__*/ function() {
16568
16568
  function ShaderProgramPool() {
16569
- this._cacheHierarchy = 1;
16569
+ this._cacheHierarchyDepth = 1;
16570
16570
  this._cacheMap = Object.create(null);
16571
16571
  }
16572
16572
  var _proto = ShaderProgramPool.prototype;
@@ -16577,12 +16577,14 @@ var unlitVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>\n#in
16577
16577
  */ _proto.get = function get(macros) {
16578
16578
  var cacheMap = this._cacheMap;
16579
16579
  var maskLength = macros._length;
16580
- if (maskLength > this._cacheHierarchy) {
16581
- this._resizeCacheMapHierarchy(cacheMap, 0, maskLength);
16580
+ var cacheHierarchyDepth = this._cacheHierarchyDepth;
16581
+ if (maskLength > cacheHierarchyDepth) {
16582
+ this._resizeCacheMapHierarchy(cacheMap, 0, cacheHierarchyDepth, maskLength - cacheHierarchyDepth);
16583
+ this._cacheHierarchyDepth = maskLength;
16582
16584
  }
16583
16585
  var mask = macros._mask;
16584
16586
  var endIndex = macros._length - 1;
16585
- var maxEndIndex = this._cacheHierarchy - 1;
16587
+ var maxEndIndex = this._cacheHierarchyDepth - 1;
16586
16588
  for(var i = 0; i < maxEndIndex; i++){
16587
16589
  var subMask = endIndex < i ? 0 : mask[i];
16588
16590
  var subCacheShaders = cacheMap[subMask];
@@ -16607,25 +16609,21 @@ var unlitVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>\n#in
16607
16609
  */ _proto.cache = function cache(shaderProgram) {
16608
16610
  this._lastQueryMap[this._lastQueryKey] = shaderProgram;
16609
16611
  };
16610
- _proto._resizeCacheMapHierarchy = function _resizeCacheMapHierarchy(cacheMap, hierarchy, resizeLength) {
16611
- // only expand but not shrink.
16612
- var end = this._cacheHierarchy - 1;
16613
- if (hierarchy == end) {
16612
+ _proto._resizeCacheMapHierarchy = function _resizeCacheMapHierarchy(cacheMap, hierarchy, currentHierarchy, increaseHierarchy) {
16613
+ // Only expand but not shrink
16614
+ if (hierarchy == currentHierarchy - 1) {
16614
16615
  for(var k in cacheMap){
16615
16616
  var shader = cacheMap[k];
16616
16617
  var subCacheMap = cacheMap;
16617
- for(var i = 0, n = resizeLength - end; i < n; i++){
16618
- if (i == n - 1) {
16619
- subCacheMap[0] = shader;
16620
- } else {
16621
- subCacheMap = subCacheMap[i == 0 ? k : 0] = Object.create(null);
16622
- }
16618
+ for(var i = 0; i < increaseHierarchy; i++){
16619
+ subCacheMap[i == 0 ? k : 0] = subCacheMap = Object.create(null);
16623
16620
  }
16621
+ subCacheMap[0] = shader;
16624
16622
  }
16625
- this._cacheHierarchy = resizeLength;
16626
16623
  } else {
16624
+ hierarchy++;
16627
16625
  for(var k1 in cacheMap){
16628
- this._resizeCacheMapHierarchy(cacheMap[k1], ++hierarchy, resizeLength);
16626
+ this._resizeCacheMapHierarchy(cacheMap[k1], hierarchy, currentHierarchy, increaseHierarchy);
16629
16627
  }
16630
16628
  }
16631
16629
  };