@babylonjs/core 7.35.1 → 7.36.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.
Files changed (180) hide show
  1. package/Engines/Extensions/engine.multiRender.d.ts +11 -0
  2. package/Engines/Extensions/engine.multiRender.js +71 -32
  3. package/Engines/Extensions/engine.multiRender.js.map +1 -1
  4. package/Engines/Extensions/engine.prefilteredCubeTexture.js +3 -2
  5. package/Engines/Extensions/engine.prefilteredCubeTexture.js.map +1 -1
  6. package/Engines/Extensions/engine.renderTarget.js +1 -13
  7. package/Engines/Extensions/engine.renderTarget.js.map +1 -1
  8. package/Engines/WebGL/webGLRenderTargetWrapper.d.ts +2 -0
  9. package/Engines/WebGL/webGLRenderTargetWrapper.js +37 -7
  10. package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
  11. package/Engines/WebGPU/Extensions/engine.multiRender.d.ts +11 -0
  12. package/Engines/WebGPU/Extensions/engine.multiRender.js +30 -11
  13. package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
  14. package/Engines/WebGPU/Extensions/engine.renderTarget.js +2 -5
  15. package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
  16. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +3 -2
  17. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  18. package/Engines/WebGPU/webgpuHardwareTexture.d.ts +3 -1
  19. package/Engines/WebGPU/webgpuHardwareTexture.js +5 -4
  20. package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
  21. package/Engines/WebGPU/webgpuTextureManager.js +2 -2
  22. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  23. package/Engines/abstractEngine.d.ts +11 -0
  24. package/Engines/abstractEngine.js +2 -2
  25. package/Engines/abstractEngine.js.map +1 -1
  26. package/Engines/renderTargetWrapper.d.ts +33 -1
  27. package/Engines/renderTargetWrapper.js +64 -4
  28. package/Engines/renderTargetWrapper.js.map +1 -1
  29. package/Engines/thinEngine.d.ts +13 -1
  30. package/Engines/thinEngine.js +115 -24
  31. package/Engines/thinEngine.js.map +1 -1
  32. package/Engines/thinWebGPUEngine.d.ts +2 -0
  33. package/Engines/thinWebGPUEngine.js +7 -0
  34. package/Engines/thinWebGPUEngine.js.map +1 -1
  35. package/Engines/webgpuEngine.d.ts +12 -3
  36. package/Engines/webgpuEngine.js +39 -9
  37. package/Engines/webgpuEngine.js.map +1 -1
  38. package/FrameGraph/Node/Blocks/Textures/clearBlock.d.ts +8 -0
  39. package/FrameGraph/Node/Blocks/Textures/clearBlock.js +22 -1
  40. package/FrameGraph/Node/Blocks/Textures/clearBlock.js.map +1 -1
  41. package/FrameGraph/Node/Blocks/inputBlock.d.ts +4 -9
  42. package/FrameGraph/Node/Blocks/inputBlock.js +15 -25
  43. package/FrameGraph/Node/Blocks/inputBlock.js.map +1 -1
  44. package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js +10 -2
  45. package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js.map +1 -1
  46. package/FrameGraph/Passes/renderPass.d.ts +10 -10
  47. package/FrameGraph/Passes/renderPass.js +10 -10
  48. package/FrameGraph/Passes/renderPass.js.map +1 -1
  49. package/FrameGraph/Tasks/PostProcesses/bloomTask.d.ts +10 -5
  50. package/FrameGraph/Tasks/PostProcesses/bloomTask.js +29 -14
  51. package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -1
  52. package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js +4 -0
  53. package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js.map +1 -1
  54. package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.d.ts +11 -6
  55. package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js +30 -13
  56. package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js.map +1 -1
  57. package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +4 -6
  58. package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -1
  59. package/FrameGraph/Tasks/Rendering/cullObjectsTask.d.ts +1 -1
  60. package/FrameGraph/Tasks/Rendering/cullObjectsTask.js.map +1 -1
  61. package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +3 -3
  62. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +33 -32
  63. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
  64. package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +4 -2
  65. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +8 -12
  66. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  67. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js +13 -18
  68. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js.map +1 -1
  69. package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +15 -2
  70. package/FrameGraph/Tasks/Texture/clearTextureTask.js +17 -4
  71. package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
  72. package/FrameGraph/Tasks/Texture/copyToTextureTask.js +2 -2
  73. package/FrameGraph/Tasks/Texture/copyToTextureTask.js.map +1 -1
  74. package/FrameGraph/Tasks/Texture/generateMipMapsTask.js +3 -3
  75. package/FrameGraph/Tasks/Texture/generateMipMapsTask.js.map +1 -1
  76. package/FrameGraph/frameGraph.d.ts +11 -74
  77. package/FrameGraph/frameGraph.js +12 -126
  78. package/FrameGraph/frameGraph.js.map +1 -1
  79. package/FrameGraph/frameGraphRenderContext.d.ts +17 -8
  80. package/FrameGraph/frameGraphRenderContext.js +55 -43
  81. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  82. package/FrameGraph/frameGraphRenderTarget.d.ts +16 -0
  83. package/FrameGraph/frameGraphRenderTarget.js +67 -0
  84. package/FrameGraph/frameGraphRenderTarget.js.map +1 -0
  85. package/FrameGraph/frameGraphTask.d.ts +4 -3
  86. package/FrameGraph/frameGraphTask.js +41 -8
  87. package/FrameGraph/frameGraphTask.js.map +1 -1
  88. package/FrameGraph/frameGraphTextureManager.d.ts +130 -22
  89. package/FrameGraph/frameGraphTextureManager.js +312 -130
  90. package/FrameGraph/frameGraphTextureManager.js.map +1 -1
  91. package/FrameGraph/frameGraphTypes.d.ts +28 -13
  92. package/FrameGraph/frameGraphTypes.js.map +1 -1
  93. package/FrameGraph/index.d.ts +1 -0
  94. package/FrameGraph/index.js +1 -0
  95. package/FrameGraph/index.js.map +1 -1
  96. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +3 -2
  97. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
  98. package/Materials/Node/Blocks/conditionalBlock.d.ts +2 -0
  99. package/Materials/Node/Blocks/conditionalBlock.js +13 -0
  100. package/Materials/Node/Blocks/conditionalBlock.js.map +1 -1
  101. package/Materials/Node/nodeMaterialBlock.js +4 -1
  102. package/Materials/Node/nodeMaterialBlock.js.map +1 -1
  103. package/Materials/Node/nodeMaterialBlockConnectionPoint.js +12 -4
  104. package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
  105. package/Materials/Textures/equiRectangularCubeTexture.js +14 -4
  106. package/Materials/Textures/equiRectangularCubeTexture.js.map +1 -1
  107. package/Materials/Textures/internalTexture.d.ts +20 -0
  108. package/Materials/Textures/internalTexture.js +48 -0
  109. package/Materials/Textures/internalTexture.js.map +1 -1
  110. package/Materials/Textures/multiRenderTarget.d.ts +5 -0
  111. package/Materials/Textures/multiRenderTarget.js.map +1 -1
  112. package/Materials/Textures/textureCreationOptions.d.ts +6 -6
  113. package/Materials/Textures/textureCreationOptions.js.map +1 -1
  114. package/Materials/drawWrapper.js +4 -0
  115. package/Materials/drawWrapper.js.map +1 -1
  116. package/Materials/effect.js +2 -2
  117. package/Materials/effect.js.map +1 -1
  118. package/Materials/material.d.ts +2 -2
  119. package/Materials/material.js +5 -5
  120. package/Materials/material.js.map +1 -1
  121. package/Maths/math.color.d.ts +16 -0
  122. package/Maths/math.color.js +16 -0
  123. package/Maths/math.color.js.map +1 -1
  124. package/Maths/math.vector.d.ts +32 -0
  125. package/Maths/math.vector.js +32 -0
  126. package/Maths/math.vector.js.map +1 -1
  127. package/Meshes/Compression/dracoCompression.d.ts +3 -1
  128. package/Meshes/Compression/dracoCompression.js +5 -2
  129. package/Meshes/Compression/dracoCompression.js.map +1 -1
  130. package/Meshes/Node/Blocks/Matrices/rotationXBlock.d.ts +0 -1
  131. package/Meshes/Node/Blocks/Matrices/rotationXBlock.js +1 -9
  132. package/Meshes/Node/Blocks/Matrices/rotationXBlock.js.map +1 -1
  133. package/Meshes/Node/Blocks/Matrices/rotationYBlock.d.ts +0 -1
  134. package/Meshes/Node/Blocks/Matrices/rotationYBlock.js +1 -9
  135. package/Meshes/Node/Blocks/Matrices/rotationYBlock.js.map +1 -1
  136. package/Meshes/Node/Blocks/Matrices/rotationZBlock.d.ts +0 -1
  137. package/Meshes/Node/Blocks/Matrices/rotationZBlock.js +1 -9
  138. package/Meshes/Node/Blocks/Matrices/rotationZBlock.js.map +1 -1
  139. package/Meshes/Node/Blocks/Set/latticeBlock.js +3 -1
  140. package/Meshes/Node/Blocks/Set/latticeBlock.js.map +1 -1
  141. package/Meshes/Node/Blocks/conditionBlock.d.ts +2 -0
  142. package/Meshes/Node/Blocks/conditionBlock.js +15 -0
  143. package/Meshes/Node/Blocks/conditionBlock.js.map +1 -1
  144. package/Meshes/Node/Blocks/geometryClampBlock.d.ts +4 -4
  145. package/Meshes/Node/Blocks/geometryClampBlock.js +16 -25
  146. package/Meshes/Node/Blocks/geometryClampBlock.js.map +1 -1
  147. package/Meshes/Node/Blocks/geometryLerpBlock.js +2 -2
  148. package/Meshes/Node/Blocks/geometryLerpBlock.js.map +1 -1
  149. package/Meshes/Node/Blocks/geometryNLerpBlock.js +2 -2
  150. package/Meshes/Node/Blocks/geometryNLerpBlock.js.map +1 -1
  151. package/Meshes/Node/Blocks/geometryReplaceColorBlock.js +2 -2
  152. package/Meshes/Node/Blocks/geometryReplaceColorBlock.js.map +1 -1
  153. package/Meshes/Node/Blocks/geometryRotate2dBlock.js +2 -2
  154. package/Meshes/Node/Blocks/geometryRotate2dBlock.js.map +1 -1
  155. package/Meshes/Node/Blocks/geometrySmoothStepBlock.js +3 -3
  156. package/Meshes/Node/Blocks/geometrySmoothStepBlock.js.map +1 -1
  157. package/Meshes/Node/Blocks/geometryStepBlock.js +2 -2
  158. package/Meshes/Node/Blocks/geometryStepBlock.js.map +1 -1
  159. package/Meshes/Node/nodeGeometry.js +1 -1
  160. package/Meshes/Node/nodeGeometry.js.map +1 -1
  161. package/Meshes/Node/nodeGeometryBlock.d.ts +3 -1
  162. package/Meshes/Node/nodeGeometryBlock.js +2 -1
  163. package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
  164. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +10 -2
  165. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
  166. package/Meshes/abstractMesh.js +1 -1
  167. package/Meshes/abstractMesh.js.map +1 -1
  168. package/Meshes/lattice.material.d.ts +1 -1
  169. package/Meshes/lattice.material.js +3 -3
  170. package/Meshes/lattice.material.js.map +1 -1
  171. package/Misc/observable.d.ts +3 -1
  172. package/Misc/observable.js +7 -2
  173. package/Misc/observable.js.map +1 -1
  174. package/ShadersWGSL/glowMapGeneration.fragment.js +4 -3
  175. package/ShadersWGSL/glowMapGeneration.fragment.js.map +1 -1
  176. package/ShadersWGSL/pbr.fragment.js +4 -3
  177. package/ShadersWGSL/pbr.fragment.js.map +1 -1
  178. package/package.json +1 -1
  179. package/scene.js +6 -6
  180. package/scene.js.map +1 -1
@@ -42,6 +42,8 @@ export declare abstract class ThinWebGPUEngine extends AbstractEngine {
42
42
  _timestampQuery: WebGPUTimestampQuery;
43
43
  /** @internal */
44
44
  _timestampIndex: number;
45
+ /** @internal */
46
+ _debugStackRenderPass: string[];
45
47
  /**
46
48
  * Gets the GPU time spent in the main render pass for the last frame rendered (in nanoseconds).
47
49
  * You have to enable the "timestamp-query" extension in the engine constructor options and set engine.enableGPUTimingMeasurements = true.
@@ -27,6 +27,8 @@ export class ThinWebGPUEngine extends AbstractEngine {
27
27
  this._snapshotRenderingMode = 0;
28
28
  /** @internal */
29
29
  this._timestampIndex = 0;
30
+ /** @internal */
31
+ this._debugStackRenderPass = [];
30
32
  }
31
33
  /**
32
34
  * Enables or disables GPU timing measurements.
@@ -50,6 +52,11 @@ export class ThinWebGPUEngine extends AbstractEngine {
50
52
  if (!this._currentRenderPass) {
51
53
  return 0;
52
54
  }
55
+ if (this._debugStackRenderPass.length !== 0) {
56
+ for (let i = 0; i < this._debugStackRenderPass.length; ++i) {
57
+ this._currentRenderPass.popDebugGroup();
58
+ }
59
+ }
53
60
  const currentPassIndex = this._currentPassIsMainPass() ? 2 : 1;
54
61
  if (!this._snapshotRendering.endRenderPass(this._currentRenderPass) && !this.compatibilityMode) {
55
62
  this._bundleList.run(this._currentRenderPass);
@@ -1 +1 @@
1
- {"version":3,"file":"thinWebGPUEngine.js","sourceRoot":"","sources":["../../../../dev/core/src/Engines/thinWebGPUEngine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKlD,OAAO,EAAE,MAAM,EAAE,0BAAyB;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAKxC;;GAEG;AACH,MAAM,OAAgB,gBAAiB,SAAQ,cAAc;IAA7D;;QACI,0DAA0D;QAC1D,gBAAgB;QACT,sBAAiB,GAAG,KAAK,CAAC;QACjC,gBAAgB;QACT,oBAAe,GAAG,IAAI,CAAC;QAC9B,gBAAgB;QACT,4BAAuB,GAAG,EAAE,CAAC;QACpC,gBAAgB;QACT,2BAAsB,GAAG,IAAI,CAAC;QACrC,gBAAgB;QACT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from \"core/Materials/Textures/internalTexture\";\r\nimport { AbstractEngine } from \"./abstractEngine\";\r\nimport type { WebGPUCacheRenderPipeline } from \"./WebGPU/webgpuCacheRenderPipeline\";\r\nimport type { WebGPUTextureManager } from \"./WebGPU/webgpuTextureManager\";\r\nimport type { WebGPUHardwareTexture } from \"./WebGPU/webgpuHardwareTexture\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport { WebGPUTextureHelper } from \"./WebGPU/webgpuTextureHelper\";\r\nimport type { WebGPURenderTargetWrapper } from \"./WebGPU/webgpuRenderTargetWrapper\";\r\nimport { WebGPUPerfCounter } from \"./WebGPU/webgpuPerfCounter\";\r\nimport type { WebGPUSnapshotRendering } from \"./WebGPU/webgpuSnapshotRendering\";\r\nimport { Constants } from \"./constants\";\r\nimport type { WebGPUBundleList } from \"./WebGPU/webgpuBundleList\";\r\nimport type { WebGPUTimestampQuery } from \"./WebGPU/webgpuTimestampQuery\";\r\nimport type { WebGPUOcclusionQuery } from \"./WebGPU/webgpuOcclusionQuery\";\r\n\r\n/**\r\n * The base engine class for WebGPU\r\n */\r\nexport abstract class ThinWebGPUEngine extends AbstractEngine {\r\n // TODO WEBGPU remove those variables when code stabilized\r\n /** @internal */\r\n public dbgShowShaderCode = false;\r\n /** @internal */\r\n public dbgSanityChecks = true;\r\n /** @internal */\r\n public dbgVerboseLogsNumFrames = 10;\r\n /** @internal */\r\n public dbgLogIfNotDrawWrapper = true;\r\n /** @internal */\r\n public dbgShowEmptyEnableEffectCalls = true;\r\n /** @internal */\r\n public dbgVerboseLogsForFirstFrames = false;\r\n\r\n /** @internal */\r\n public _textureHelper: WebGPUTextureManager;\r\n /** @internal */\r\n public _cacheRenderPipeline: WebGPUCacheRenderPipeline;\r\n /** @internal */\r\n public _occlusionQuery: WebGPUOcclusionQuery;\r\n\r\n // Frame Life Cycle (recreated each frame)\r\n /** @internal */\r\n public _renderEncoder: GPUCommandEncoder;\r\n /** @internal */\r\n public _uploadEncoder: GPUCommandEncoder;\r\n\r\n /** @internal */\r\n public _currentRenderPass: Nullable<GPURenderPassEncoder> = null;\r\n\r\n protected _snapshotRendering: WebGPUSnapshotRendering;\r\n protected _snapshotRenderingMode = Constants.SNAPSHOTRENDERING_STANDARD;\r\n\r\n /** @internal */\r\n public _timestampQuery: WebGPUTimestampQuery;\r\n /** @internal */\r\n public _timestampIndex = 0;\r\n\r\n /**\r\n * Gets the GPU time spent in the main render pass for the last frame rendered (in nanoseconds).\r\n * You have to enable the \"timestamp-query\" extension in the engine constructor options and set engine.enableGPUTimingMeasurements = true.\r\n * It will only return time spent in the main pass, not additional render target / compute passes (if any)!\r\n */\r\n public readonly gpuTimeInFrameForMainPass?: WebGPUPerfCounter;\r\n\r\n /**\r\n * Used for both the compatibilityMode=false and the snapshot rendering modes (as both can't be enabled at the same time)\r\n * @internal\r\n */\r\n public _bundleList: WebGPUBundleList;\r\n\r\n /**\r\n * Enables or disables GPU timing measurements.\r\n * Note that this is only supported if the \"timestamp-query\" extension is enabled in the options.\r\n */\r\n public get enableGPUTimingMeasurements(): boolean {\r\n return this._timestampQuery.enable;\r\n }\r\n\r\n public set enableGPUTimingMeasurements(enable: boolean) {\r\n if (this._timestampQuery.enable === enable) {\r\n return;\r\n }\r\n (this.gpuTimeInFrameForMainPass as any) = enable ? new WebGPUPerfCounter() : undefined;\r\n this._timestampQuery.enable = enable;\r\n }\r\n\r\n protected _currentPassIsMainPass() {\r\n return this._currentRenderTarget === null;\r\n }\r\n\r\n /** @internal */\r\n public _endCurrentRenderPass(): number {\r\n if (!this._currentRenderPass) {\r\n return 0;\r\n }\r\n\r\n const currentPassIndex = this._currentPassIsMainPass() ? 2 : 1;\r\n\r\n if (!this._snapshotRendering.endRenderPass(this._currentRenderPass) && !this.compatibilityMode) {\r\n this._bundleList.run(this._currentRenderPass);\r\n this._bundleList.reset();\r\n }\r\n this._currentRenderPass.end();\r\n\r\n this._timestampQuery.endPass(\r\n this._timestampIndex,\r\n (this._currentRenderTarget && (this._currentRenderTarget as WebGPURenderTargetWrapper).gpuTimeInFrame\r\n ? (this._currentRenderTarget as WebGPURenderTargetWrapper).gpuTimeInFrame\r\n : this.gpuTimeInFrameForMainPass) as WebGPUPerfCounter\r\n );\r\n this._timestampIndex += 2;\r\n\r\n if (this.dbgVerboseLogsForFirstFrames) {\r\n if ((this as any)._count === undefined) {\r\n (this as any)._count = 0;\r\n }\r\n if (!(this as any)._count || (this as any)._count < this.dbgVerboseLogsNumFrames) {\r\n Logger.Log(\r\n \"frame #\" +\r\n (this as any)._count +\r\n \" - \" +\r\n (currentPassIndex === 2 ? \"main\" : \"render target\") +\r\n \" end pass\" +\r\n (currentPassIndex === 1 ? \" - internalTexture.uniqueId=\" + this._currentRenderTarget?.texture?.uniqueId : \"\")\r\n );\r\n }\r\n }\r\n this._debugPopGroup?.(0);\r\n this._currentRenderPass = null;\r\n\r\n return currentPassIndex;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _generateMipmaps(texture: InternalTexture, commandEncoder?: GPUCommandEncoder) {\r\n commandEncoder = commandEncoder ?? this._renderEncoder;\r\n\r\n const gpuHardwareTexture = texture._hardwareTexture as Nullable<WebGPUHardwareTexture>;\r\n\r\n if (!gpuHardwareTexture) {\r\n return;\r\n }\r\n\r\n if (commandEncoder === this._renderEncoder) {\r\n // We must close the current pass (if any) because we are going to use the render encoder to generate the mipmaps (so, we are going to create a new render pass)\r\n this._endCurrentRenderPass();\r\n }\r\n\r\n const format = (texture._hardwareTexture as WebGPUHardwareTexture).format;\r\n const mipmapCount = WebGPUTextureHelper.ComputeNumMipmapLevels(texture.width, texture.height);\r\n\r\n if (this.dbgVerboseLogsForFirstFrames) {\r\n if ((this as any)._count === undefined) {\r\n (this as any)._count = 0;\r\n }\r\n if (!(this as any)._count || (this as any)._count < this.dbgVerboseLogsNumFrames) {\r\n Logger.Log(\r\n \"frame #\" +\r\n (this as any)._count +\r\n \" - generate mipmaps - width=\" +\r\n texture.width +\r\n \", height=\" +\r\n texture.height +\r\n \", isCube=\" +\r\n texture.isCube +\r\n \", command encoder=\" +\r\n (commandEncoder === this._renderEncoder ? \"render\" : \"copy\")\r\n );\r\n }\r\n }\r\n\r\n if (texture.isCube) {\r\n this._textureHelper.generateCubeMipmaps(gpuHardwareTexture, format, mipmapCount, commandEncoder);\r\n } else {\r\n this._textureHelper.generateMipmaps(gpuHardwareTexture, format, mipmapCount, 0, texture.is3D, commandEncoder);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"thinWebGPUEngine.js","sourceRoot":"","sources":["../../../../dev/core/src/Engines/thinWebGPUEngine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKlD,OAAO,EAAE,MAAM,EAAE,0BAAyB;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAKxC;;GAEG;AACH,MAAM,OAAgB,gBAAiB,SAAQ,cAAc;IAA7D;;QACI,0DAA0D;QAC1D,gBAAgB;QACT,sBAAiB,GAAG,KAAK,CAAC;QACjC,gBAAgB;QACT,oBAAe,GAAG,IAAI,CAAC;QAC9B,gBAAgB;QACT,4BAAuB,GAAG,EAAE,CAAC;QACpC,gBAAgB;QACT,2BAAsB,GAAG,IAAI,CAAC;QACrC,gBAAgB;QACT,kCAA6B,GAAG,IAAI,CAAC;QAC5C,gBAAgB;QACT,iCAA4B,GAAG,KAAK,CAAC;QAe5C,gBAAgB;QACT,uBAAkB,GAAmC,IAAI,CAAC;QAGvD,2BAAsB,GAAG,SAAS,CAAC,0BAA0B,CAAC;QAIxE,gBAAgB;QACT,oBAAe,GAAG,CAAC,CAAC;QAE3B,gBAAgB;QACT,0BAAqB,GAAa,EAAE,CAAC;IAkIhD,CAAC;IAnHG;;;OAGG;IACH,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{ InternalTexture } from \"core/Materials/Textures/internalTexture\";\r\nimport { AbstractEngine } from \"./abstractEngine\";\r\nimport type { WebGPUCacheRenderPipeline } from \"./WebGPU/webgpuCacheRenderPipeline\";\r\nimport type { WebGPUTextureManager } from \"./WebGPU/webgpuTextureManager\";\r\nimport type { WebGPUHardwareTexture } from \"./WebGPU/webgpuHardwareTexture\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport { WebGPUTextureHelper } from \"./WebGPU/webgpuTextureHelper\";\r\nimport type { WebGPURenderTargetWrapper } from \"./WebGPU/webgpuRenderTargetWrapper\";\r\nimport { WebGPUPerfCounter } from \"./WebGPU/webgpuPerfCounter\";\r\nimport type { WebGPUSnapshotRendering } from \"./WebGPU/webgpuSnapshotRendering\";\r\nimport { Constants } from \"./constants\";\r\nimport type { WebGPUBundleList } from \"./WebGPU/webgpuBundleList\";\r\nimport type { WebGPUTimestampQuery } from \"./WebGPU/webgpuTimestampQuery\";\r\nimport type { WebGPUOcclusionQuery } from \"./WebGPU/webgpuOcclusionQuery\";\r\n\r\n/**\r\n * The base engine class for WebGPU\r\n */\r\nexport abstract class ThinWebGPUEngine extends AbstractEngine {\r\n // TODO WEBGPU remove those variables when code stabilized\r\n /** @internal */\r\n public dbgShowShaderCode = false;\r\n /** @internal */\r\n public dbgSanityChecks = true;\r\n /** @internal */\r\n public dbgVerboseLogsNumFrames = 10;\r\n /** @internal */\r\n public dbgLogIfNotDrawWrapper = true;\r\n /** @internal */\r\n public dbgShowEmptyEnableEffectCalls = true;\r\n /** @internal */\r\n public dbgVerboseLogsForFirstFrames = false;\r\n\r\n /** @internal */\r\n public _textureHelper: WebGPUTextureManager;\r\n /** @internal */\r\n public _cacheRenderPipeline: WebGPUCacheRenderPipeline;\r\n /** @internal */\r\n public _occlusionQuery: WebGPUOcclusionQuery;\r\n\r\n // Frame Life Cycle (recreated each frame)\r\n /** @internal */\r\n public _renderEncoder: GPUCommandEncoder;\r\n /** @internal */\r\n public _uploadEncoder: GPUCommandEncoder;\r\n\r\n /** @internal */\r\n public _currentRenderPass: Nullable<GPURenderPassEncoder> = null;\r\n\r\n protected _snapshotRendering: WebGPUSnapshotRendering;\r\n protected _snapshotRenderingMode = Constants.SNAPSHOTRENDERING_STANDARD;\r\n\r\n /** @internal */\r\n public _timestampQuery: WebGPUTimestampQuery;\r\n /** @internal */\r\n public _timestampIndex = 0;\r\n\r\n /** @internal */\r\n public _debugStackRenderPass: string[] = [];\r\n\r\n /**\r\n * Gets the GPU time spent in the main render pass for the last frame rendered (in nanoseconds).\r\n * You have to enable the \"timestamp-query\" extension in the engine constructor options and set engine.enableGPUTimingMeasurements = true.\r\n * It will only return time spent in the main pass, not additional render target / compute passes (if any)!\r\n */\r\n public readonly gpuTimeInFrameForMainPass?: WebGPUPerfCounter;\r\n\r\n /**\r\n * Used for both the compatibilityMode=false and the snapshot rendering modes (as both can't be enabled at the same time)\r\n * @internal\r\n */\r\n public _bundleList: WebGPUBundleList;\r\n\r\n /**\r\n * Enables or disables GPU timing measurements.\r\n * Note that this is only supported if the \"timestamp-query\" extension is enabled in the options.\r\n */\r\n public get enableGPUTimingMeasurements(): boolean {\r\n return this._timestampQuery.enable;\r\n }\r\n\r\n public set enableGPUTimingMeasurements(enable: boolean) {\r\n if (this._timestampQuery.enable === enable) {\r\n return;\r\n }\r\n (this.gpuTimeInFrameForMainPass as any) = enable ? new WebGPUPerfCounter() : undefined;\r\n this._timestampQuery.enable = enable;\r\n }\r\n\r\n protected _currentPassIsMainPass() {\r\n return this._currentRenderTarget === null;\r\n }\r\n\r\n /** @internal */\r\n public _endCurrentRenderPass(): number {\r\n if (!this._currentRenderPass) {\r\n return 0;\r\n }\r\n\r\n if (this._debugStackRenderPass.length !== 0) {\r\n for (let i = 0; i < this._debugStackRenderPass.length; ++i) {\r\n this._currentRenderPass.popDebugGroup();\r\n }\r\n }\r\n\r\n const currentPassIndex = this._currentPassIsMainPass() ? 2 : 1;\r\n\r\n if (!this._snapshotRendering.endRenderPass(this._currentRenderPass) && !this.compatibilityMode) {\r\n this._bundleList.run(this._currentRenderPass);\r\n this._bundleList.reset();\r\n }\r\n this._currentRenderPass.end();\r\n\r\n this._timestampQuery.endPass(\r\n this._timestampIndex,\r\n (this._currentRenderTarget && (this._currentRenderTarget as WebGPURenderTargetWrapper).gpuTimeInFrame\r\n ? (this._currentRenderTarget as WebGPURenderTargetWrapper).gpuTimeInFrame\r\n : this.gpuTimeInFrameForMainPass) as WebGPUPerfCounter\r\n );\r\n this._timestampIndex += 2;\r\n\r\n if (this.dbgVerboseLogsForFirstFrames) {\r\n if ((this as any)._count === undefined) {\r\n (this as any)._count = 0;\r\n }\r\n if (!(this as any)._count || (this as any)._count < this.dbgVerboseLogsNumFrames) {\r\n Logger.Log(\r\n \"frame #\" +\r\n (this as any)._count +\r\n \" - \" +\r\n (currentPassIndex === 2 ? \"main\" : \"render target\") +\r\n \" end pass\" +\r\n (currentPassIndex === 1 ? \" - internalTexture.uniqueId=\" + this._currentRenderTarget?.texture?.uniqueId : \"\")\r\n );\r\n }\r\n }\r\n this._debugPopGroup?.(0);\r\n this._currentRenderPass = null;\r\n\r\n return currentPassIndex;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _generateMipmaps(texture: InternalTexture, commandEncoder?: GPUCommandEncoder) {\r\n commandEncoder = commandEncoder ?? this._renderEncoder;\r\n\r\n const gpuHardwareTexture = texture._hardwareTexture as Nullable<WebGPUHardwareTexture>;\r\n\r\n if (!gpuHardwareTexture) {\r\n return;\r\n }\r\n\r\n if (commandEncoder === this._renderEncoder) {\r\n // We must close the current pass (if any) because we are going to use the render encoder to generate the mipmaps (so, we are going to create a new render pass)\r\n this._endCurrentRenderPass();\r\n }\r\n\r\n const format = (texture._hardwareTexture as WebGPUHardwareTexture).format;\r\n const mipmapCount = WebGPUTextureHelper.ComputeNumMipmapLevels(texture.width, texture.height);\r\n\r\n if (this.dbgVerboseLogsForFirstFrames) {\r\n if ((this as any)._count === undefined) {\r\n (this as any)._count = 0;\r\n }\r\n if (!(this as any)._count || (this as any)._count < this.dbgVerboseLogsNumFrames) {\r\n Logger.Log(\r\n \"frame #\" +\r\n (this as any)._count +\r\n \" - generate mipmaps - width=\" +\r\n texture.width +\r\n \", height=\" +\r\n texture.height +\r\n \", isCube=\" +\r\n texture.isCube +\r\n \", command encoder=\" +\r\n (commandEncoder === this._renderEncoder ? \"render\" : \"copy\")\r\n );\r\n }\r\n }\r\n\r\n if (texture.isCube) {\r\n this._textureHelper.generateCubeMipmaps(gpuHardwareTexture, format, mipmapCount, commandEncoder);\r\n } else {\r\n this._textureHelper.generateMipmaps(gpuHardwareTexture, format, mipmapCount, 0, texture.is3D, commandEncoder);\r\n }\r\n }\r\n}\r\n"]}
@@ -209,8 +209,6 @@ export declare class WebGPUEngine extends ThinWebGPUEngine {
209
209
  private _rttRenderPassWrapper;
210
210
  /** @internal */
211
211
  _pendingDebugCommands: Array<[string, Nullable<string>, number?]>;
212
- /** @internal */
213
- _debugStackRenderPass: string[];
214
212
  private _defaultDrawContext;
215
213
  private _defaultMaterialContext;
216
214
  /** @internal */
@@ -718,7 +716,7 @@ export declare class WebGPUEngine extends ThinWebGPUEngine {
718
716
  /**
719
717
  * @internal
720
718
  */
721
- _getUseSRGBBuffer(useSRGBBuffer: boolean, noMipmap: boolean): boolean;
719
+ _getUseSRGBBuffer(useSRGBBuffer: boolean, _noMipmap: boolean): boolean;
722
720
  /**
723
721
  * @internal
724
722
  */
@@ -880,6 +878,17 @@ export declare class WebGPUEngine extends ThinWebGPUEngine {
880
878
  * @param onBeforeUnbind defines a function which will be called before the effective unbind
881
879
  */
882
880
  unBindFramebuffer(texture: RenderTargetWrapper, disableGenerateMipMaps?: boolean, onBeforeUnbind?: () => void): void;
881
+ /**
882
+ * Generates mipmaps for the texture of the (single) render target
883
+ * @param texture The render target containing the texture to generate the mipmaps for
884
+ */
885
+ generateMipMapsFramebuffer(texture: RenderTargetWrapper): void;
886
+ /**
887
+ * Resolves the MSAA texture of the (single) render target into its non-MSAA version.
888
+ * Note that if "texture" is not a MSAA render target, no resolve is performed.
889
+ * @param _texture The render target texture containing the MSAA texture to resolve
890
+ */
891
+ resolveFramebuffer(_texture: RenderTargetWrapper): void;
883
892
  /**
884
893
  * Unbind the current render target and bind the default framebuffer
885
894
  */
@@ -313,8 +313,6 @@ export class WebGPUEngine extends ThinWebGPUEngine {
313
313
  };
314
314
  /** @internal */
315
315
  this._pendingDebugCommands = [];
316
- /** @internal */
317
- this._debugStackRenderPass = [];
318
316
  this._currentOverrideVertexBuffers = null;
319
317
  this._currentIndexBuffer = null;
320
318
  this._colorWriteLocal = true;
@@ -635,7 +633,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
635
633
  this._context = this._renderingCanvas.getContext("webgpu");
636
634
  this._configureContext();
637
635
  this._colorFormat = this._options.swapChainFormat;
638
- this._mainRenderPassWrapper.colorAttachmentGPUTextures = [new WebGPUHardwareTexture()];
636
+ this._mainRenderPassWrapper.colorAttachmentGPUTextures = [new WebGPUHardwareTexture(this)];
639
637
  this._mainRenderPassWrapper.colorAttachmentGPUTextures[0].format = this._colorFormat;
640
638
  this._setColorFormat(this._mainRenderPassWrapper);
641
639
  }
@@ -1717,7 +1715,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
1717
1715
  }
1718
1716
  /** @internal */
1719
1717
  _createHardwareTexture() {
1720
- return new WebGPUHardwareTexture();
1718
+ return new WebGPUHardwareTexture(this);
1721
1719
  }
1722
1720
  /**
1723
1721
  * @internal
@@ -1751,6 +1749,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
1751
1749
  const fullOptions = {};
1752
1750
  if (options !== undefined && typeof options === "object") {
1753
1751
  fullOptions.generateMipMaps = options.generateMipMaps;
1752
+ fullOptions.createMipMaps = options.createMipMaps;
1754
1753
  fullOptions.type = options.type === undefined ? 0 : options.type;
1755
1754
  fullOptions.samplingMode = options.samplingMode === undefined ? 3 : options.samplingMode;
1756
1755
  fullOptions.format = options.format === undefined ? 5 : options.format;
@@ -1790,7 +1789,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
1790
1789
  texture.depth = depth || layers;
1791
1790
  texture.isReady = true;
1792
1791
  texture.samples = fullOptions.samples;
1793
- texture.generateMipMaps = fullOptions.generateMipMaps ? true : false;
1792
+ texture.generateMipMaps = !!fullOptions.generateMipMaps;
1794
1793
  texture.samplingMode = fullOptions.samplingMode;
1795
1794
  texture.type = fullOptions.type;
1796
1795
  texture.format = fullOptions.format;
@@ -1802,7 +1801,16 @@ export class WebGPUEngine extends ThinWebGPUEngine {
1802
1801
  texture.label = fullOptions.label;
1803
1802
  this._internalTexturesCache.push(texture);
1804
1803
  if (!delayGPUTextureCreation) {
1804
+ const createMipMapsOnly = !fullOptions.generateMipMaps && fullOptions.createMipMaps;
1805
+ if (createMipMapsOnly) {
1806
+ // So that the call to createGPUTextureForInternalTexture creates the mipmaps
1807
+ texture.generateMipMaps = true;
1808
+ }
1805
1809
  this._textureHelper.createGPUTextureForInternalTexture(texture, width, height, layers || 1, fullOptions.creationFlags);
1810
+ if (createMipMapsOnly) {
1811
+ // So that we don't automatically generate mipmaps when the render target is unbound
1812
+ texture.generateMipMaps = false;
1813
+ }
1806
1814
  }
1807
1815
  return texture;
1808
1816
  }
@@ -1867,7 +1875,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
1867
1875
  * @returns the babylon internal texture
1868
1876
  */
1869
1877
  wrapWebGPUTexture(texture) {
1870
- const hardwareTexture = new WebGPUHardwareTexture(texture);
1878
+ const hardwareTexture = new WebGPUHardwareTexture(this, texture);
1871
1879
  const internalTexture = new InternalTexture(this, 0 /* InternalTextureSource.Unknown */, true);
1872
1880
  internalTexture._hardwareTexture = hardwareTexture;
1873
1881
  internalTexture.isReady = true;
@@ -1884,7 +1892,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
1884
1892
  /**
1885
1893
  * @internal
1886
1894
  */
1887
- _getUseSRGBBuffer(useSRGBBuffer, noMipmap) {
1895
+ _getUseSRGBBuffer(useSRGBBuffer, _noMipmap) {
1888
1896
  return useSRGBBuffer && this._caps.supportSRGBBuffers;
1889
1897
  }
1890
1898
  /**
@@ -2621,8 +2629,13 @@ export class WebGPUEngine extends ThinWebGPUEngine {
2621
2629
  }
2622
2630
  this._currentRenderTarget = saveCRT;
2623
2631
  this._endCurrentRenderPass();
2624
- if (texture.texture?.generateMipMaps && !disableGenerateMipMaps && !texture.isCube) {
2625
- this._generateMipmaps(texture.texture);
2632
+ if (!disableGenerateMipMaps) {
2633
+ if (texture.isMulti) {
2634
+ this.generateMipMapsMultiFramebuffer(texture);
2635
+ }
2636
+ else {
2637
+ this.generateMipMapsFramebuffer(texture);
2638
+ }
2626
2639
  }
2627
2640
  this._currentRenderTarget = null;
2628
2641
  if (this.dbgVerboseLogsForFirstFrames) {
@@ -2637,6 +2650,23 @@ export class WebGPUEngine extends ThinWebGPUEngine {
2637
2650
  this._cacheRenderPipeline.setMRT([]);
2638
2651
  this._cacheRenderPipeline.setMRTAttachments(this._mrtAttachments);
2639
2652
  }
2653
+ /**
2654
+ * Generates mipmaps for the texture of the (single) render target
2655
+ * @param texture The render target containing the texture to generate the mipmaps for
2656
+ */
2657
+ generateMipMapsFramebuffer(texture) {
2658
+ if (!texture.isMulti && texture.texture?.generateMipMaps && !texture.isCube) {
2659
+ this._generateMipmaps(texture.texture);
2660
+ }
2661
+ }
2662
+ /**
2663
+ * Resolves the MSAA texture of the (single) render target into its non-MSAA version.
2664
+ * Note that if "texture" is not a MSAA render target, no resolve is performed.
2665
+ * @param _texture The render target texture containing the MSAA texture to resolve
2666
+ */
2667
+ resolveFramebuffer(_texture) {
2668
+ throw new Error("resolveFramebuffer is not yet implemented in WebGPU!");
2669
+ }
2640
2670
  /**
2641
2671
  * Unbind the current render target and bind the default framebuffer
2642
2672
  */