@babylonjs/core 8.9.1 → 8.10.0
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/Engines/WebGPU/webgpuCacheBindGroups.js +4 -4
- package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js +16 -1
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +2 -4
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Materials/Node/Blocks/GaussianSplatting/gaussianBlock.d.ts +8 -0
- package/Materials/Node/Blocks/GaussianSplatting/gaussianBlock.js +23 -3
- package/Materials/Node/Blocks/GaussianSplatting/gaussianBlock.js.map +1 -1
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.d.ts +13 -0
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js +44 -0
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js.map +1 -1
- package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js +3 -0
- package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.d.ts +1 -1
- package/Materials/Node/nodeMaterialBuildState.js +6 -3
- package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
- package/Materials/Node/nodeMaterialDefault.js +6 -1
- package/Materials/Node/nodeMaterialDefault.js.map +1 -1
- package/Meshes/Builders/decalBuilder.js +3 -2
- package/Meshes/Builders/decalBuilder.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplatting.js +4 -4
- package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +3 -3
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +2 -2
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js +3 -3
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/package.json +1 -1
|
@@ -133,7 +133,7 @@ export class WebGPUCacheBindGroups {
|
|
|
133
133
|
entries[j].resource = this._cacheSampler.getSampler(sampler, false, bindingInfo.hashCode, sampler.label);
|
|
134
134
|
}
|
|
135
135
|
else {
|
|
136
|
-
Logger.Error(`Sampler "${name}"
|
|
136
|
+
Logger.Error(`Sampler "${name}" not found in the material context. Make sure you bound it. entry=${JSON.stringify(entry)}, materialContext=${JSON.stringify(materialContext, (key, value) => (key === "texture" || key === "sampler" ? "<no dump>" : value))}`, 50);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
else if (entry.texture || entry.storageTexture) {
|
|
@@ -152,7 +152,7 @@ export class WebGPUCacheBindGroups {
|
|
|
152
152
|
entries[j].resource = entry.storageTexture ? hardwareTexture.viewForWriting : hardwareTexture.view;
|
|
153
153
|
}
|
|
154
154
|
else {
|
|
155
|
-
Logger.Error(`Texture "${name}"
|
|
155
|
+
Logger.Error(`Texture "${name}" not found in the material context. Make sure you bound it (something like effect.setTexture("${name}", texture)). entry=${JSON.stringify(entry)}, materialContext=${JSON.stringify(materialContext, (key, value) => (key === "texture" || key === "sampler" ? "<no dump>" : value))}`, 50);
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
else if (entry.externalTexture) {
|
|
@@ -170,7 +170,7 @@ export class WebGPUCacheBindGroups {
|
|
|
170
170
|
entries[j].resource = this._device.importExternalTexture({ source: externalTexture });
|
|
171
171
|
}
|
|
172
172
|
else {
|
|
173
|
-
Logger.Error(`
|
|
173
|
+
Logger.Error(`External texture "${name}" not found in the material context. Make sure you bound it. entry=${JSON.stringify(entry)}, materialContext=${JSON.stringify(materialContext, (key, value) => (key === "texture" || key === "sampler" ? "<no dump>" : value))}`, 50);
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
else if (entry.buffer) {
|
|
@@ -181,7 +181,7 @@ export class WebGPUCacheBindGroups {
|
|
|
181
181
|
entries[j].resource.size = dataBuffer.capacity;
|
|
182
182
|
}
|
|
183
183
|
else {
|
|
184
|
-
Logger.Error(`Can't find buffer "${name}". entry=${JSON.stringify(entry)}, buffers=${JSON.stringify(drawContext.buffers)}, drawContext.uniqueId=${drawContext.uniqueId}`, 50);
|
|
184
|
+
Logger.Error(`Can't find buffer "${name}" in the draw context. Make sure you bound it. entry=${JSON.stringify(entry)}, buffers=${JSON.stringify(drawContext.buffers)}, drawContext.uniqueId=${drawContext.uniqueId}`, 50);
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpuCacheBindGroups.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/WebGPU/webgpuCacheBindGroups.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,wCAAwC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAU3C;;GAEG;AACH,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,CAAC;AAE9B;;;;;GAKG;AACH,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,CAAC;AAE/B,MAAM,wBAAwB;IAI1B;QACI,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACrB,CAAC;CACJ;AAED,gBAAgB;AAChB,MAAM,OAAO,qBAAqB;IAkBvB,MAAM,KAAK,UAAU;QACxB,OAAO;YACH,YAAY,EAAE,qBAAqB,CAAC,yBAAyB;YAC7D,gBAAgB,EAAE,qBAAqB,CAAC,6BAA6B;YACrE,eAAe,EAAE,qBAAqB,CAAC,4BAA4B;YACnE,iBAAiB,EAAE,qBAAqB,CAAC,8BAA8B;SAC1E,CAAC;IACN,CAAC;IAEM,MAAM,CA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Content":["/* eslint-disable babylonjs/available */\r\n/* eslint-disable jsdoc/require-jsdoc */\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport type { WebGPUCacheSampler } from \"./webgpuCacheSampler\";\r\nimport type { WebGPUMaterialContext } from \"./webgpuMaterialContext\";\r\nimport type { WebGPUPipelineContext } from \"./webgpuPipelineContext\";\r\nimport type { WebGPUEngine } from \"../webgpuEngine\";\r\nimport type { WebGPUHardwareTexture } from \"./webgpuHardwareTexture\";\r\nimport type { InternalTexture } from \"../../Materials/Textures/internalTexture\";\r\nimport type { ExternalTexture } from \"../../Materials/Textures/externalTexture\";\r\nimport type { WebGPUDrawContext } from \"./webgpuDrawContext\";\r\n\r\n/**\r\n * Sampler hash codes are 19 bits long, so using a start value of 2^20 for buffer ids will ensure we can't have any collision with the sampler hash codes\r\n */\r\nconst BufferIdStart = 1 << 20;\r\n\r\n/**\r\n * textureIdStart is added to texture ids to ensure we can't have any collision with the buffer ids / sampler hash codes.\r\n * 2^35 for textureIdStart means we can have:\r\n * - 2^(35-20) = 2^15 = 32768 possible buffer ids\r\n * - 2^(53-35) = 2^18 = 524288 possible texture ids\r\n */\r\nconst TextureIdStart = 2 ** 35;\r\n\r\nclass WebGPUBindGroupCacheNode {\r\n public values: { [id: number]: WebGPUBindGroupCacheNode };\r\n public bindGroups: GPUBindGroup[];\r\n\r\n constructor() {\r\n this.values = {};\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class WebGPUCacheBindGroups {\r\n public static NumBindGroupsCreatedTotal = 0;\r\n public static NumBindGroupsCreatedLastFrame = 0;\r\n public static NumBindGroupsLookupLastFrame = 0;\r\n public static NumBindGroupsNoLookupLastFrame = 0;\r\n\r\n private static _Cache: WebGPUBindGroupCacheNode = new WebGPUBindGroupCacheNode();\r\n\r\n private static _NumBindGroupsCreatedCurrentFrame = 0;\r\n private static _NumBindGroupsLookupCurrentFrame = 0;\r\n private static _NumBindGroupsNoLookupCurrentFrame = 0;\r\n\r\n private _device: GPUDevice;\r\n private _cacheSampler: WebGPUCacheSampler;\r\n private _engine: WebGPUEngine;\r\n\r\n public disabled = false;\r\n\r\n public static get Statistics() {\r\n return {\r\n totalCreated: WebGPUCacheBindGroups.NumBindGroupsCreatedTotal,\r\n lastFrameCreated: WebGPUCacheBindGroups.NumBindGroupsCreatedLastFrame,\r\n lookupLastFrame: WebGPUCacheBindGroups.NumBindGroupsLookupLastFrame,\r\n noLookupLastFrame: WebGPUCacheBindGroups.NumBindGroupsNoLookupLastFrame,\r\n };\r\n }\r\n\r\n public static ResetCache() {\r\n WebGPUCacheBindGroups._Cache = new WebGPUBindGroupCacheNode();\r\n WebGPUCacheBindGroups.NumBindGroupsCreatedTotal = 0;\r\n WebGPUCacheBindGroups.NumBindGroupsCreatedLastFrame = 0;\r\n WebGPUCacheBindGroups.NumBindGroupsLookupLastFrame = 0;\r\n WebGPUCacheBindGroups.NumBindGroupsNoLookupLastFrame = 0;\r\n WebGPUCacheBindGroups._NumBindGroupsCreatedCurrentFrame = 0;\r\n WebGPUCacheBindGroups._NumBindGroupsLookupCurrentFrame = 0;\r\n WebGPUCacheBindGroups._NumBindGroupsNoLookupCurrentFrame = 0;\r\n }\r\n\r\n constructor(device: GPUDevice, cacheSampler: WebGPUCacheSampler, engine: WebGPUEngine) {\r\n this._device = device;\r\n this._cacheSampler = cacheSampler;\r\n this._engine = engine;\r\n }\r\n\r\n public endFrame(): void {\r\n WebGPUCacheBindGroups.NumBindGroupsCreatedLastFrame = WebGPUCacheBindGroups._NumBindGroupsCreatedCurrentFrame;\r\n WebGPUCacheBindGroups.NumBindGroupsLookupLastFrame = WebGPUCacheBindGroups._NumBindGroupsLookupCurrentFrame;\r\n WebGPUCacheBindGroups.NumBindGroupsNoLookupLastFrame = WebGPUCacheBindGroups._NumBindGroupsNoLookupCurrentFrame;\r\n WebGPUCacheBindGroups._NumBindGroupsCreatedCurrentFrame = 0;\r\n WebGPUCacheBindGroups._NumBindGroupsLookupCurrentFrame = 0;\r\n WebGPUCacheBindGroups._NumBindGroupsNoLookupCurrentFrame = 0;\r\n }\r\n\r\n /**\r\n * Cache is currently based on the uniform/storage buffers, samplers and textures used by the binding groups.\r\n * Note that all uniform buffers have an offset of 0 in Babylon and we don't have a use case where we would have the same buffer used with different capacity values:\r\n * that means we don't need to factor in the offset/size of the buffer in the cache, only the id\r\n * @param webgpuPipelineContext\r\n * @param drawContext\r\n * @param materialContext\r\n * @returns a bind group array\r\n */\r\n public getBindGroups(webgpuPipelineContext: WebGPUPipelineContext, drawContext: WebGPUDrawContext, materialContext: WebGPUMaterialContext): GPUBindGroup[] {\r\n let bindGroups: GPUBindGroup[] | undefined = undefined;\r\n let node = WebGPUCacheBindGroups._Cache;\r\n\r\n const cacheIsDisabled = this.disabled || materialContext.forceBindGroupCreation;\r\n if (!cacheIsDisabled) {\r\n if (!drawContext.isDirty(materialContext.updateId) && !materialContext.isDirty) {\r\n WebGPUCacheBindGroups._NumBindGroupsNoLookupCurrentFrame++;\r\n return drawContext.bindGroups!;\r\n }\r\n\r\n for (const bufferName of webgpuPipelineContext.shaderProcessingContext.bufferNames) {\r\n const uboId = (drawContext.buffers[bufferName]?.uniqueId ?? 0) + BufferIdStart;\r\n let nextNode = node.values[uboId];\r\n if (!nextNode) {\r\n nextNode = new WebGPUBindGroupCacheNode();\r\n node.values[uboId] = nextNode;\r\n }\r\n node = nextNode;\r\n }\r\n\r\n for (const samplerName of webgpuPipelineContext.shaderProcessingContext.samplerNames) {\r\n const samplerHashCode = materialContext.samplers[samplerName]?.hashCode ?? 0;\r\n let nextNode = node.values[samplerHashCode];\r\n if (!nextNode) {\r\n nextNode = new WebGPUBindGroupCacheNode();\r\n node.values[samplerHashCode] = nextNode;\r\n }\r\n node = nextNode;\r\n }\r\n\r\n for (const textureName of webgpuPipelineContext.shaderProcessingContext.textureNames) {\r\n const textureId = (materialContext.textures[textureName]?.texture?.uniqueId ?? 0) + TextureIdStart;\r\n let nextNode = node.values[textureId];\r\n if (!nextNode) {\r\n nextNode = new WebGPUBindGroupCacheNode();\r\n node.values[textureId] = nextNode;\r\n }\r\n node = nextNode;\r\n }\r\n\r\n bindGroups = node.bindGroups;\r\n }\r\n\r\n drawContext.resetIsDirty(materialContext.updateId);\r\n materialContext.isDirty = false;\r\n\r\n if (bindGroups) {\r\n drawContext.bindGroups = bindGroups;\r\n WebGPUCacheBindGroups._NumBindGroupsLookupCurrentFrame++;\r\n return bindGroups;\r\n }\r\n\r\n bindGroups = [];\r\n drawContext.bindGroups = bindGroups;\r\n\r\n if (!cacheIsDisabled) {\r\n node.bindGroups = bindGroups;\r\n }\r\n\r\n WebGPUCacheBindGroups.NumBindGroupsCreatedTotal++;\r\n WebGPUCacheBindGroups._NumBindGroupsCreatedCurrentFrame++;\r\n\r\n const bindGroupLayouts = webgpuPipelineContext.bindGroupLayouts[materialContext.textureState];\r\n for (let i = 0; i < webgpuPipelineContext.shaderProcessingContext.bindGroupLayoutEntries.length; i++) {\r\n const setDefinition = webgpuPipelineContext.shaderProcessingContext.bindGroupLayoutEntries[i];\r\n\r\n const entries = webgpuPipelineContext.shaderProcessingContext.bindGroupEntries[i];\r\n for (let j = 0; j < setDefinition.length; j++) {\r\n const entry = webgpuPipelineContext.shaderProcessingContext.bindGroupLayoutEntries[i][j];\r\n const entryInfo = webgpuPipelineContext.shaderProcessingContext.bindGroupLayoutEntryInfo[i][entry.binding];\r\n const name = entryInfo.nameInArrayOfTexture ?? entryInfo.name;\r\n\r\n if (entry.sampler) {\r\n const bindingInfo = materialContext.samplers[name];\r\n if (bindingInfo) {\r\n const sampler = bindingInfo.sampler;\r\n if (!sampler) {\r\n if (this._engine.dbgSanityChecks) {\r\n Logger.Error(\r\n `Trying to bind a null sampler! entry=${JSON.stringify(entry)}, name=${name}, bindingInfo=${JSON.stringify(\r\n bindingInfo,\r\n (key: string, value: any) => (key === \"texture\" ? \"<no dump>\" : value)\r\n )}, materialContext.uniqueId=${materialContext.uniqueId}`,\r\n 50\r\n );\r\n }\r\n continue;\r\n }\r\n entries[j].resource = this._cacheSampler.getSampler(sampler, false, bindingInfo.hashCode, sampler.label);\r\n } else {\r\n Logger.Error(\r\n `Sampler \"${name}\" could not be bound. entry=${JSON.stringify(entry)}, materialContext=${JSON.stringify(materialContext, (key: string, value: any) =>\r\n key === \"texture\" || key === \"sampler\" ? \"<no dump>\" : value\r\n )}`,\r\n 50\r\n );\r\n }\r\n } else if (entry.texture || entry.storageTexture) {\r\n const bindingInfo = materialContext.textures[name];\r\n if (bindingInfo) {\r\n if (this._engine.dbgSanityChecks && bindingInfo.texture === null) {\r\n Logger.Error(\r\n `Trying to bind a null texture! name=\"${name}\", entry=${JSON.stringify(entry)}, bindingInfo=${JSON.stringify(\r\n bindingInfo,\r\n (key: string, value: any) => (key === \"texture\" ? \"<no dump>\" : value)\r\n )}, materialContext.uniqueId=${materialContext.uniqueId}`,\r\n 50\r\n );\r\n continue;\r\n }\r\n const hardwareTexture = (bindingInfo.texture as InternalTexture)._hardwareTexture as WebGPUHardwareTexture;\r\n\r\n if (\r\n this._engine.dbgSanityChecks &&\r\n (!hardwareTexture || (entry.texture && !hardwareTexture.view) || (entry.storageTexture && !hardwareTexture.viewForWriting))\r\n ) {\r\n Logger.Error(\r\n `Trying to bind a null gpu texture or view! entry=${JSON.stringify(entry)}, name=${name}, bindingInfo=${JSON.stringify(\r\n bindingInfo,\r\n (key: string, value: any) => (key === \"texture\" ? \"<no dump>\" : value)\r\n )}, isReady=${bindingInfo.texture?.isReady}, materialContext.uniqueId=${materialContext.uniqueId}`,\r\n 50\r\n );\r\n continue;\r\n }\r\n\r\n entries[j].resource = entry.storageTexture ? hardwareTexture.viewForWriting! : hardwareTexture.view!;\r\n } else {\r\n Logger.Error(\r\n `Texture \"${name}\" could not be bound. entry=${JSON.stringify(entry)}, materialContext=${JSON.stringify(materialContext, (key: string, value: any) =>\r\n key === \"texture\" || key === \"sampler\" ? \"<no dump>\" : value\r\n )}`,\r\n 50\r\n );\r\n }\r\n } else if (entry.externalTexture) {\r\n const bindingInfo = materialContext.textures[name];\r\n if (bindingInfo) {\r\n if (this._engine.dbgSanityChecks && bindingInfo.texture === null) {\r\n Logger.Error(\r\n `Trying to bind a null external texture! entry=${JSON.stringify(entry)}, name=${name}, bindingInfo=${JSON.stringify(\r\n bindingInfo,\r\n (key: string, value: any) => (key === \"texture\" ? \"<no dump>\" : value)\r\n )}, materialContext.uniqueId=${materialContext.uniqueId}`,\r\n 50\r\n );\r\n continue;\r\n }\r\n const externalTexture = (bindingInfo.texture as ExternalTexture).underlyingResource;\r\n\r\n if (this._engine.dbgSanityChecks && !externalTexture) {\r\n Logger.Error(\r\n `Trying to bind a null gpu external texture! entry=${JSON.stringify(entry)}, name=${name}, bindingInfo=${JSON.stringify(\r\n bindingInfo,\r\n (key: string, value: any) => (key === \"texture\" ? \"<no dump>\" : value)\r\n )}, isReady=${bindingInfo.texture?.isReady}, materialContext.uniqueId=${materialContext.uniqueId}`,\r\n 50\r\n );\r\n continue;\r\n }\r\n\r\n entries[j].resource = this._device.importExternalTexture({ source: externalTexture });\r\n } else {\r\n Logger.Error(\r\n `Texture \"${name}\" could not be bound. entry=${JSON.stringify(entry)}, materialContext=${JSON.stringify(materialContext, (key: string, value: any) =>\r\n key === \"texture\" || key === \"sampler\" ? \"<no dump>\" : value\r\n )}`,\r\n 50\r\n );\r\n }\r\n } else if (entry.buffer) {\r\n const dataBuffer = drawContext.buffers[name];\r\n if (dataBuffer) {\r\n const webgpuBuffer = dataBuffer.underlyingResource as GPUBuffer;\r\n (entries[j].resource as GPUBufferBinding).buffer = webgpuBuffer;\r\n (entries[j].resource as GPUBufferBinding).size = dataBuffer.capacity;\r\n } else {\r\n Logger.Error(\r\n `Can't find buffer \"${name}\". entry=${JSON.stringify(entry)}, buffers=${JSON.stringify(drawContext.buffers)}, drawContext.uniqueId=${\r\n drawContext.uniqueId\r\n }`,\r\n 50\r\n );\r\n }\r\n }\r\n }\r\n\r\n const groupLayout = bindGroupLayouts[i];\r\n bindGroups[i] = this._device.createBindGroup({\r\n layout: groupLayout,\r\n entries,\r\n });\r\n }\r\n\r\n return bindGroups;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"webgpuCacheBindGroups.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/WebGPU/webgpuCacheBindGroups.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,wCAAwC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAU3C;;GAEG;AACH,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,CAAC;AAE9B;;;;;GAKG;AACH,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,CAAC;AAE/B,MAAM,wBAAwB;IAI1B;QACI,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACrB,CAAC;CACJ;AAED,gBAAgB;AAChB,MAAM,OAAO,qBAAqB;IAkBvB,MAAM,KAAK,UAAU;QACxB,OAAO;YACH,YAAY,EAAE,qBAAqB,CAAC,yBAAyB;YAC7D,gBAAgB,EAAE,qBAAqB,CAAC,6BAA6B;YACrE,eAAe,EAAE,qBAAqB,CAAC,4BAA4B;YACnE,iBAAiB,EAAE,qBAAqB,CAAC,8BAA8B;SAC1E,CAAC;IACN,CAAC;IAEM,MAAM,CAAC,UAAU;QACpB,qBAAqB,CAAC,MAAM,GAAG,IAAI,wBAAwB,EAAE,CAAC;QAC9D,qBAAqB,CAAC,yBAAyB,GAAG,CAAC,CAAC;QACpD,qBAAqB,CAAC,6BAA6B,GAAG,CAAC,CAAC;QACxD,qBAAqB,CAAC,4BAA4B,GAAG,CAAC,CAAC;QACvD,qBAAqB,CAAC,8BAA8B,GAAG,CAAC,CAAC;QACzD,qBAAqB,CAAC,iCAAiC,GAAG,CAAC,CAAC;QAC5D,qBAAqB,CAAC,gCAAgC,GAAG,CAAC,CAAC;QAC3D,qBAAqB,CAAC,kCAAkC,GAAG,CAAC,CAAC;IACjE,CAAC;IAED,YAAY,MAAiB,EAAE,YAAgC,EAAE,M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AC;oBACzE,CAAC;yBAAM,CAAC;wBACJ,MAAM,CAAC,KAAK,CACR,sBAAsB,IAAI,wDAAwD,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,aAAa,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,0BACnJ,WAAW,CAAC,QAChB,EAAE,EACF,EAAE,CACL,CAAC;oBACN,CAAC;gBACL,CAAC;YACL,CAAC;YAED,MAAM,WAAW,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;YACxC,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC;gBACzC,MAAM,EAAE,WAAW;gBACnB,OAAO;aACV,CAAC,CAAC;QACP,CAAC;QAED,OAAO,UAAU,CAAC;IACtB,CAAC;;AApQa,+CAAyB,GAAG,CAAC,AAAJ,CAAK;AAC9B,mDAA6B,GAAG,CAAC,AAAJ,CAAK;AAClC,kDAA4B,GAAG,CAAC,AAAJ,CAAK;AACjC,oDAA8B,GAAG,CAAC,AAAJ,CAAK;AAElC,4BAAM,GAA6B,IAAI,wBAAwB,EAAE,AAA3D,CAA4D;AAElE,uDAAiC,GAAG,CAAC,AAAJ,CAAK;AACtC,sDAAgC,GAAG,CAAC,AAAJ,CAAK;AACrC,wDAAkC,GAAG,CAAC,AAAJ,CAAK","sourcesContent":["/* eslint-disable babylonjs/available */\r\n/* eslint-disable jsdoc/require-jsdoc */\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport type { WebGPUCacheSampler } from \"./webgpuCacheSampler\";\r\nimport type { WebGPUMaterialContext } from \"./webgpuMaterialContext\";\r\nimport type { WebGPUPipelineContext } from \"./webgpuPipelineContext\";\r\nimport type { WebGPUEngine } from \"../webgpuEngine\";\r\nimport type { WebGPUHardwareTexture } from \"./webgpuHardwareTexture\";\r\nimport type { InternalTexture } from \"../../Materials/Textures/internalTexture\";\r\nimport type { ExternalTexture } from \"../../Materials/Textures/externalTexture\";\r\nimport type { WebGPUDrawContext } from \"./webgpuDrawContext\";\r\n\r\n/**\r\n * Sampler hash codes are 19 bits long, so using a start value of 2^20 for buffer ids will ensure we can't have any collision with the sampler hash codes\r\n */\r\nconst BufferIdStart = 1 << 20;\r\n\r\n/**\r\n * textureIdStart is added to texture ids to ensure we can't have any collision with the buffer ids / sampler hash codes.\r\n * 2^35 for textureIdStart means we can have:\r\n * - 2^(35-20) = 2^15 = 32768 possible buffer ids\r\n * - 2^(53-35) = 2^18 = 524288 possible texture ids\r\n */\r\nconst TextureIdStart = 2 ** 35;\r\n\r\nclass WebGPUBindGroupCacheNode {\r\n public values: { [id: number]: WebGPUBindGroupCacheNode };\r\n public bindGroups: GPUBindGroup[];\r\n\r\n constructor() {\r\n this.values = {};\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class WebGPUCacheBindGroups {\r\n public static NumBindGroupsCreatedTotal = 0;\r\n public static NumBindGroupsCreatedLastFrame = 0;\r\n public static NumBindGroupsLookupLastFrame = 0;\r\n public static NumBindGroupsNoLookupLastFrame = 0;\r\n\r\n private static _Cache: WebGPUBindGroupCacheNode = new WebGPUBindGroupCacheNode();\r\n\r\n private static _NumBindGroupsCreatedCurrentFrame = 0;\r\n private static _NumBindGroupsLookupCurrentFrame = 0;\r\n private static _NumBindGroupsNoLookupCurrentFrame = 0;\r\n\r\n private _device: GPUDevice;\r\n private _cacheSampler: WebGPUCacheSampler;\r\n private _engine: WebGPUEngine;\r\n\r\n public disabled = false;\r\n\r\n public static get Statistics() {\r\n return {\r\n totalCreated: WebGPUCacheBindGroups.NumBindGroupsCreatedTotal,\r\n lastFrameCreated: WebGPUCacheBindGroups.NumBindGroupsCreatedLastFrame,\r\n lookupLastFrame: WebGPUCacheBindGroups.NumBindGroupsLookupLastFrame,\r\n noLookupLastFrame: WebGPUCacheBindGroups.NumBindGroupsNoLookupLastFrame,\r\n };\r\n }\r\n\r\n public static ResetCache() {\r\n WebGPUCacheBindGroups._Cache = new WebGPUBindGroupCacheNode();\r\n WebGPUCacheBindGroups.NumBindGroupsCreatedTotal = 0;\r\n WebGPUCacheBindGroups.NumBindGroupsCreatedLastFrame = 0;\r\n WebGPUCacheBindGroups.NumBindGroupsLookupLastFrame = 0;\r\n WebGPUCacheBindGroups.NumBindGroupsNoLookupLastFrame = 0;\r\n WebGPUCacheBindGroups._NumBindGroupsCreatedCurrentFrame = 0;\r\n WebGPUCacheBindGroups._NumBindGroupsLookupCurrentFrame = 0;\r\n WebGPUCacheBindGroups._NumBindGroupsNoLookupCurrentFrame = 0;\r\n }\r\n\r\n constructor(device: GPUDevice, cacheSampler: WebGPUCacheSampler, engine: WebGPUEngine) {\r\n this._device = device;\r\n this._cacheSampler = cacheSampler;\r\n this._engine = engine;\r\n }\r\n\r\n public endFrame(): void {\r\n WebGPUCacheBindGroups.NumBindGroupsCreatedLastFrame = WebGPUCacheBindGroups._NumBindGroupsCreatedCurrentFrame;\r\n WebGPUCacheBindGroups.NumBindGroupsLookupLastFrame = WebGPUCacheBindGroups._NumBindGroupsLookupCurrentFrame;\r\n WebGPUCacheBindGroups.NumBindGroupsNoLookupLastFrame = WebGPUCacheBindGroups._NumBindGroupsNoLookupCurrentFrame;\r\n WebGPUCacheBindGroups._NumBindGroupsCreatedCurrentFrame = 0;\r\n WebGPUCacheBindGroups._NumBindGroupsLookupCurrentFrame = 0;\r\n WebGPUCacheBindGroups._NumBindGroupsNoLookupCurrentFrame = 0;\r\n }\r\n\r\n /**\r\n * Cache is currently based on the uniform/storage buffers, samplers and textures used by the binding groups.\r\n * Note that all uniform buffers have an offset of 0 in Babylon and we don't have a use case where we would have the same buffer used with different capacity values:\r\n * that means we don't need to factor in the offset/size of the buffer in the cache, only the id\r\n * @param webgpuPipelineContext\r\n * @param drawContext\r\n * @param materialContext\r\n * @returns a bind group array\r\n */\r\n public getBindGroups(webgpuPipelineContext: WebGPUPipelineContext, drawContext: WebGPUDrawContext, materialContext: WebGPUMaterialContext): GPUBindGroup[] {\r\n let bindGroups: GPUBindGroup[] | undefined = undefined;\r\n let node = WebGPUCacheBindGroups._Cache;\r\n\r\n const cacheIsDisabled = this.disabled || materialContext.forceBindGroupCreation;\r\n if (!cacheIsDisabled) {\r\n if (!drawContext.isDirty(materialContext.updateId) && !materialContext.isDirty) {\r\n WebGPUCacheBindGroups._NumBindGroupsNoLookupCurrentFrame++;\r\n return drawContext.bindGroups!;\r\n }\r\n\r\n for (const bufferName of webgpuPipelineContext.shaderProcessingContext.bufferNames) {\r\n const uboId = (drawContext.buffers[bufferName]?.uniqueId ?? 0) + BufferIdStart;\r\n let nextNode = node.values[uboId];\r\n if (!nextNode) {\r\n nextNode = new WebGPUBindGroupCacheNode();\r\n node.values[uboId] = nextNode;\r\n }\r\n node = nextNode;\r\n }\r\n\r\n for (const samplerName of webgpuPipelineContext.shaderProcessingContext.samplerNames) {\r\n const samplerHashCode = materialContext.samplers[samplerName]?.hashCode ?? 0;\r\n let nextNode = node.values[samplerHashCode];\r\n if (!nextNode) {\r\n nextNode = new WebGPUBindGroupCacheNode();\r\n node.values[samplerHashCode] = nextNode;\r\n }\r\n node = nextNode;\r\n }\r\n\r\n for (const textureName of webgpuPipelineContext.shaderProcessingContext.textureNames) {\r\n const textureId = (materialContext.textures[textureName]?.texture?.uniqueId ?? 0) + TextureIdStart;\r\n let nextNode = node.values[textureId];\r\n if (!nextNode) {\r\n nextNode = new WebGPUBindGroupCacheNode();\r\n node.values[textureId] = nextNode;\r\n }\r\n node = nextNode;\r\n }\r\n\r\n bindGroups = node.bindGroups;\r\n }\r\n\r\n drawContext.resetIsDirty(materialContext.updateId);\r\n materialContext.isDirty = false;\r\n\r\n if (bindGroups) {\r\n drawContext.bindGroups = bindGroups;\r\n WebGPUCacheBindGroups._NumBindGroupsLookupCurrentFrame++;\r\n return bindGroups;\r\n }\r\n\r\n bindGroups = [];\r\n drawContext.bindGroups = bindGroups;\r\n\r\n if (!cacheIsDisabled) {\r\n node.bindGroups = bindGroups;\r\n }\r\n\r\n WebGPUCacheBindGroups.NumBindGroupsCreatedTotal++;\r\n WebGPUCacheBindGroups._NumBindGroupsCreatedCurrentFrame++;\r\n\r\n const bindGroupLayouts = webgpuPipelineContext.bindGroupLayouts[materialContext.textureState];\r\n for (let i = 0; i < webgpuPipelineContext.shaderProcessingContext.bindGroupLayoutEntries.length; i++) {\r\n const setDefinition = webgpuPipelineContext.shaderProcessingContext.bindGroupLayoutEntries[i];\r\n\r\n const entries = webgpuPipelineContext.shaderProcessingContext.bindGroupEntries[i];\r\n for (let j = 0; j < setDefinition.length; j++) {\r\n const entry = webgpuPipelineContext.shaderProcessingContext.bindGroupLayoutEntries[i][j];\r\n const entryInfo = webgpuPipelineContext.shaderProcessingContext.bindGroupLayoutEntryInfo[i][entry.binding];\r\n const name = entryInfo.nameInArrayOfTexture ?? entryInfo.name;\r\n\r\n if (entry.sampler) {\r\n const bindingInfo = materialContext.samplers[name];\r\n if (bindingInfo) {\r\n const sampler = bindingInfo.sampler;\r\n if (!sampler) {\r\n if (this._engine.dbgSanityChecks) {\r\n Logger.Error(\r\n `Trying to bind a null sampler! entry=${JSON.stringify(entry)}, name=${name}, bindingInfo=${JSON.stringify(\r\n bindingInfo,\r\n (key: string, value: any) => (key === \"texture\" ? \"<no dump>\" : value)\r\n )}, materialContext.uniqueId=${materialContext.uniqueId}`,\r\n 50\r\n );\r\n }\r\n continue;\r\n }\r\n entries[j].resource = this._cacheSampler.getSampler(sampler, false, bindingInfo.hashCode, sampler.label);\r\n } else {\r\n Logger.Error(\r\n `Sampler \"${name}\" not found in the material context. Make sure you bound it. entry=${JSON.stringify(entry)}, materialContext=${JSON.stringify(\r\n materialContext,\r\n (key: string, value: any) => (key === \"texture\" || key === \"sampler\" ? \"<no dump>\" : value)\r\n )}`,\r\n 50\r\n );\r\n }\r\n } else if (entry.texture || entry.storageTexture) {\r\n const bindingInfo = materialContext.textures[name];\r\n if (bindingInfo) {\r\n if (this._engine.dbgSanityChecks && bindingInfo.texture === null) {\r\n Logger.Error(\r\n `Trying to bind a null texture! name=\"${name}\", entry=${JSON.stringify(entry)}, bindingInfo=${JSON.stringify(\r\n bindingInfo,\r\n (key: string, value: any) => (key === \"texture\" ? \"<no dump>\" : value)\r\n )}, materialContext.uniqueId=${materialContext.uniqueId}`,\r\n 50\r\n );\r\n continue;\r\n }\r\n const hardwareTexture = (bindingInfo.texture as InternalTexture)._hardwareTexture as WebGPUHardwareTexture;\r\n\r\n if (\r\n this._engine.dbgSanityChecks &&\r\n (!hardwareTexture || (entry.texture && !hardwareTexture.view) || (entry.storageTexture && !hardwareTexture.viewForWriting))\r\n ) {\r\n Logger.Error(\r\n `Trying to bind a null gpu texture or view! entry=${JSON.stringify(entry)}, name=${name}, bindingInfo=${JSON.stringify(\r\n bindingInfo,\r\n (key: string, value: any) => (key === \"texture\" ? \"<no dump>\" : value)\r\n )}, isReady=${bindingInfo.texture?.isReady}, materialContext.uniqueId=${materialContext.uniqueId}`,\r\n 50\r\n );\r\n continue;\r\n }\r\n\r\n entries[j].resource = entry.storageTexture ? hardwareTexture.viewForWriting! : hardwareTexture.view!;\r\n } else {\r\n Logger.Error(\r\n `Texture \"${name}\" not found in the material context. Make sure you bound it (something like effect.setTexture(\"${name}\", texture)). entry=${JSON.stringify(entry)}, materialContext=${JSON.stringify(\r\n materialContext,\r\n (key: string, value: any) => (key === \"texture\" || key === \"sampler\" ? \"<no dump>\" : value)\r\n )}`,\r\n 50\r\n );\r\n }\r\n } else if (entry.externalTexture) {\r\n const bindingInfo = materialContext.textures[name];\r\n if (bindingInfo) {\r\n if (this._engine.dbgSanityChecks && bindingInfo.texture === null) {\r\n Logger.Error(\r\n `Trying to bind a null external texture! entry=${JSON.stringify(entry)}, name=${name}, bindingInfo=${JSON.stringify(\r\n bindingInfo,\r\n (key: string, value: any) => (key === \"texture\" ? \"<no dump>\" : value)\r\n )}, materialContext.uniqueId=${materialContext.uniqueId}`,\r\n 50\r\n );\r\n continue;\r\n }\r\n const externalTexture = (bindingInfo.texture as ExternalTexture).underlyingResource;\r\n\r\n if (this._engine.dbgSanityChecks && !externalTexture) {\r\n Logger.Error(\r\n `Trying to bind a null gpu external texture! entry=${JSON.stringify(entry)}, name=${name}, bindingInfo=${JSON.stringify(\r\n bindingInfo,\r\n (key: string, value: any) => (key === \"texture\" ? \"<no dump>\" : value)\r\n )}, isReady=${bindingInfo.texture?.isReady}, materialContext.uniqueId=${materialContext.uniqueId}`,\r\n 50\r\n );\r\n continue;\r\n }\r\n\r\n entries[j].resource = this._device.importExternalTexture({ source: externalTexture });\r\n } else {\r\n Logger.Error(\r\n `External texture \"${name}\" not found in the material context. Make sure you bound it. entry=${JSON.stringify(entry)}, materialContext=${JSON.stringify(\r\n materialContext,\r\n (key: string, value: any) => (key === \"texture\" || key === \"sampler\" ? \"<no dump>\" : value)\r\n )}`,\r\n 50\r\n );\r\n }\r\n } else if (entry.buffer) {\r\n const dataBuffer = drawContext.buffers[name];\r\n if (dataBuffer) {\r\n const webgpuBuffer = dataBuffer.underlyingResource as GPUBuffer;\r\n (entries[j].resource as GPUBufferBinding).buffer = webgpuBuffer;\r\n (entries[j].resource as GPUBufferBinding).size = dataBuffer.capacity;\r\n } else {\r\n Logger.Error(\r\n `Can't find buffer \"${name}\" in the draw context. Make sure you bound it. entry=${JSON.stringify(entry)}, buffers=${JSON.stringify(drawContext.buffers)}, drawContext.uniqueId=${\r\n drawContext.uniqueId\r\n }`,\r\n 50\r\n );\r\n }\r\n }\r\n }\r\n\r\n const groupLayout = bindGroupLayouts[i];\r\n bindGroups[i] = this._device.createBindGroup({\r\n layout: groupLayout,\r\n entries,\r\n });\r\n }\r\n\r\n return bindGroups;\r\n }\r\n}\r\n"]}
|
|
@@ -787,13 +787,13 @@ export class AbstractEngine {
|
|
|
787
787
|
*/
|
|
788
788
|
// Not mixed with Version for tooling purpose.
|
|
789
789
|
static get NpmPackage() {
|
|
790
|
-
return "babylonjs@8.
|
|
790
|
+
return "babylonjs@8.10.0";
|
|
791
791
|
}
|
|
792
792
|
/**
|
|
793
793
|
* Returns the current version of the framework
|
|
794
794
|
*/
|
|
795
795
|
static get Version() {
|
|
796
|
-
return "8.
|
|
796
|
+
return "8.10.0";
|
|
797
797
|
}
|
|
798
798
|
/**
|
|
799
799
|
* Gets the HTML canvas attached with the current webGL context
|