@babylonjs/core 8.38.0 → 8.39.1

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 (235) hide show
  1. package/Animations/animation.d.ts +2 -1
  2. package/Animations/animation.js +3 -2
  3. package/Animations/animation.js.map +1 -1
  4. package/Audio/Interfaces/ISoundOptions.d.ts +1 -1
  5. package/Audio/Interfaces/ISoundOptions.js.map +1 -1
  6. package/Audio/audioEngine.d.ts +3 -4
  7. package/Audio/audioEngine.js +9 -6
  8. package/Audio/audioEngine.js.map +1 -1
  9. package/Audio/sound.d.ts +33 -54
  10. package/Audio/sound.js +450 -718
  11. package/Audio/sound.js.map +1 -1
  12. package/AudioV2/abstractAudio/abstractAudioOutNode.d.ts +1 -1
  13. package/AudioV2/abstractAudio/abstractAudioOutNode.js +1 -1
  14. package/AudioV2/abstractAudio/abstractAudioOutNode.js.map +1 -1
  15. package/AudioV2/abstractAudio/abstractSound.d.ts +1 -1
  16. package/AudioV2/abstractAudio/abstractSound.js +2 -2
  17. package/AudioV2/abstractAudio/abstractSound.js.map +1 -1
  18. package/AudioV2/abstractAudio/abstractSoundSource.d.ts +11 -3
  19. package/AudioV2/abstractAudio/abstractSoundSource.js +37 -1
  20. package/AudioV2/abstractAudio/abstractSoundSource.js.map +1 -1
  21. package/AudioV2/abstractAudio/audioBus.d.ts +8 -3
  22. package/AudioV2/abstractAudio/audioBus.js +24 -1
  23. package/AudioV2/abstractAudio/audioBus.js.map +1 -1
  24. package/AudioV2/abstractAudio/staticSound.d.ts +1 -1
  25. package/AudioV2/abstractAudio/staticSound.js +2 -2
  26. package/AudioV2/abstractAudio/staticSound.js.map +1 -1
  27. package/AudioV2/abstractAudio/streamingSound.d.ts +1 -1
  28. package/AudioV2/abstractAudio/streamingSound.js +2 -2
  29. package/AudioV2/abstractAudio/streamingSound.js.map +1 -1
  30. package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.d.ts +1 -1
  31. package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.js +3 -0
  32. package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.js.map +1 -1
  33. package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.d.ts +1 -0
  34. package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js +1 -0
  35. package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js.map +1 -1
  36. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.d.ts +12 -2
  37. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js +2 -0
  38. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js.map +1 -1
  39. package/AudioV2/abstractAudio/subProperties/spatialAudio.d.ts +6 -0
  40. package/AudioV2/abstractAudio/subProperties/spatialAudio.js +25 -0
  41. package/AudioV2/abstractAudio/subProperties/spatialAudio.js.map +1 -1
  42. package/AudioV2/webAudio/components/webAudioParameterComponent.js +2 -2
  43. package/AudioV2/webAudio/components/webAudioParameterComponent.js.map +1 -1
  44. package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.d.ts +3 -0
  45. package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js +14 -17
  46. package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js.map +1 -1
  47. package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js +1 -0
  48. package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js.map +1 -1
  49. package/AudioV2/webAudio/subProperties/spatialWebAudio.js +1 -0
  50. package/AudioV2/webAudio/subProperties/spatialWebAudio.js.map +1 -1
  51. package/AudioV2/webAudio/webAudioBus.d.ts +2 -7
  52. package/AudioV2/webAudio/webAudioBus.js +4 -24
  53. package/AudioV2/webAudio/webAudioBus.js.map +1 -1
  54. package/AudioV2/webAudio/webAudioEngine.js +1 -0
  55. package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
  56. package/AudioV2/webAudio/webAudioSoundSource.d.ts +2 -7
  57. package/AudioV2/webAudio/webAudioSoundSource.js +3 -24
  58. package/AudioV2/webAudio/webAudioSoundSource.js.map +1 -1
  59. package/AudioV2/webAudio/webAudioStaticSound.d.ts +3 -7
  60. package/AudioV2/webAudio/webAudioStaticSound.js +13 -26
  61. package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
  62. package/AudioV2/webAudio/webAudioStreamingSound.d.ts +3 -7
  63. package/AudioV2/webAudio/webAudioStreamingSound.js +6 -23
  64. package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -1
  65. package/Behaviors/Cameras/autoRotationBehavior.d.ts +4 -0
  66. package/Behaviors/Cameras/autoRotationBehavior.js +7 -0
  67. package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
  68. package/Behaviors/Cameras/bouncingBehavior.d.ts +5 -0
  69. package/Behaviors/Cameras/bouncingBehavior.js +8 -0
  70. package/Behaviors/Cameras/bouncingBehavior.js.map +1 -1
  71. package/Behaviors/Cameras/framingBehavior.d.ts +4 -0
  72. package/Behaviors/Cameras/framingBehavior.js +7 -0
  73. package/Behaviors/Cameras/framingBehavior.js.map +1 -1
  74. package/Behaviors/Cameras/interpolatingBehavior.d.ts +7 -1
  75. package/Behaviors/Cameras/interpolatingBehavior.js +11 -3
  76. package/Behaviors/Cameras/interpolatingBehavior.js.map +1 -1
  77. package/Behaviors/Meshes/attachToBoxBehavior.d.ts +5 -0
  78. package/Behaviors/Meshes/attachToBoxBehavior.js +8 -1
  79. package/Behaviors/Meshes/attachToBoxBehavior.js.map +1 -1
  80. package/Behaviors/Meshes/baseSixDofDragBehavior.d.ts +5 -2
  81. package/Behaviors/Meshes/baseSixDofDragBehavior.js +8 -0
  82. package/Behaviors/Meshes/baseSixDofDragBehavior.js.map +1 -1
  83. package/Behaviors/Meshes/fadeInOutBehavior.d.ts +5 -0
  84. package/Behaviors/Meshes/fadeInOutBehavior.js +6 -0
  85. package/Behaviors/Meshes/fadeInOutBehavior.js.map +1 -1
  86. package/Behaviors/Meshes/handConstraintBehavior.d.ts +5 -0
  87. package/Behaviors/Meshes/handConstraintBehavior.js +8 -0
  88. package/Behaviors/Meshes/handConstraintBehavior.js.map +1 -1
  89. package/Behaviors/Meshes/multiPointerScaleBehavior.d.ts +5 -0
  90. package/Behaviors/Meshes/multiPointerScaleBehavior.js +8 -0
  91. package/Behaviors/Meshes/multiPointerScaleBehavior.js.map +1 -1
  92. package/Behaviors/Meshes/sixDofDragBehavior.js +1 -1
  93. package/Behaviors/Meshes/sixDofDragBehavior.js.map +1 -1
  94. package/Behaviors/Meshes/surfaceMagnetismBehavior.d.ts +5 -0
  95. package/Behaviors/Meshes/surfaceMagnetismBehavior.js +7 -0
  96. package/Behaviors/Meshes/surfaceMagnetismBehavior.js.map +1 -1
  97. package/Behaviors/behavior.d.ts +4 -0
  98. package/Behaviors/behavior.js.map +1 -1
  99. package/Cameras/geospatialCamera.d.ts +13 -5
  100. package/Cameras/geospatialCamera.js +116 -48
  101. package/Cameras/geospatialCamera.js.map +1 -1
  102. package/Cameras/geospatialCameraMovement.d.ts +6 -2
  103. package/Cameras/geospatialCameraMovement.js +11 -11
  104. package/Cameras/geospatialCameraMovement.js.map +1 -1
  105. package/Engines/WebGPU/Extensions/engine.multiRender.d.ts +2 -1
  106. package/Engines/WebGPU/Extensions/engine.multiRender.js +5 -2
  107. package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
  108. package/Engines/WebGPU/webgpuTextureHelper.d.ts +1 -0
  109. package/Engines/WebGPU/webgpuTextureHelper.js +11 -0
  110. package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
  111. package/Engines/WebGPU/webgpuTextureManager.d.ts +1 -0
  112. package/Engines/WebGPU/webgpuTextureManager.js +100 -9
  113. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  114. package/Engines/abstractEngine.d.ts +2 -2
  115. package/Engines/abstractEngine.js +2 -2
  116. package/Engines/abstractEngine.js.map +1 -1
  117. package/Engines/renderTargetWrapper.js +6 -1
  118. package/Engines/renderTargetWrapper.js.map +1 -1
  119. package/Engines/thinEngine.js +1 -1
  120. package/Engines/thinEngine.js.map +1 -1
  121. package/Engines/webgpuEngine.d.ts +7 -4
  122. package/Engines/webgpuEngine.js +53 -25
  123. package/Engines/webgpuEngine.js.map +1 -1
  124. package/FrameGraph/Node/Blocks/PostProcesses/volumetricLightingBlock.d.ts +74 -0
  125. package/FrameGraph/Node/Blocks/PostProcesses/volumetricLightingBlock.js +179 -0
  126. package/FrameGraph/Node/Blocks/PostProcesses/volumetricLightingBlock.js.map +1 -0
  127. package/FrameGraph/Node/Blocks/index.d.ts +2 -0
  128. package/FrameGraph/Node/Blocks/index.js +2 -0
  129. package/FrameGraph/Node/Blocks/index.js.map +1 -1
  130. package/FrameGraph/Node/Blocks/lightingVolumeBlock.d.ts +46 -0
  131. package/FrameGraph/Node/Blocks/lightingVolumeBlock.js +106 -0
  132. package/FrameGraph/Node/Blocks/lightingVolumeBlock.js.map +1 -0
  133. package/FrameGraph/Node/nodeRenderGraph.d.ts +22 -5
  134. package/FrameGraph/Node/nodeRenderGraph.js +39 -18
  135. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
  136. package/FrameGraph/Passes/pass.d.ts +2 -0
  137. package/FrameGraph/Passes/pass.js +2 -0
  138. package/FrameGraph/Passes/pass.js.map +1 -1
  139. package/FrameGraph/Passes/renderPass.d.ts +2 -0
  140. package/FrameGraph/Passes/renderPass.js +4 -0
  141. package/FrameGraph/Passes/renderPass.js.map +1 -1
  142. package/FrameGraph/Tasks/Misc/lightingVolumeTask.d.ts +31 -0
  143. package/FrameGraph/Tasks/Misc/lightingVolumeTask.js +56 -0
  144. package/FrameGraph/Tasks/Misc/lightingVolumeTask.js.map +1 -0
  145. package/FrameGraph/Tasks/PostProcesses/postProcessTask.d.ts +2 -2
  146. package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -1
  147. package/FrameGraph/Tasks/PostProcesses/volumetricLightingBlendVolumeTask.d.ts +30 -0
  148. package/FrameGraph/Tasks/PostProcesses/volumetricLightingBlendVolumeTask.js +57 -0
  149. package/FrameGraph/Tasks/PostProcesses/volumetricLightingBlendVolumeTask.js.map +1 -0
  150. package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.d.ts +91 -0
  151. package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.js +210 -0
  152. package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.js.map +1 -0
  153. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +1 -1
  154. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  155. package/FrameGraph/Tasks/Texture/clearTextureTask.js +1 -1
  156. package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
  157. package/FrameGraph/frameGraph.d.ts +13 -4
  158. package/FrameGraph/frameGraph.js +45 -5
  159. package/FrameGraph/frameGraph.js.map +1 -1
  160. package/FrameGraph/frameGraphRenderContext.d.ts +2 -2
  161. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  162. package/FrameGraph/frameGraphRenderTarget.d.ts +1 -0
  163. package/FrameGraph/frameGraphRenderTarget.js +3 -0
  164. package/FrameGraph/frameGraphRenderTarget.js.map +1 -1
  165. package/FrameGraph/frameGraphTask.d.ts +6 -0
  166. package/FrameGraph/frameGraphTask.js +17 -2
  167. package/FrameGraph/frameGraphTask.js.map +1 -1
  168. package/FrameGraph/frameGraphTypes.d.ts +2 -0
  169. package/FrameGraph/frameGraphTypes.js.map +1 -1
  170. package/FrameGraph/index.d.ts +2 -0
  171. package/FrameGraph/index.js +2 -0
  172. package/FrameGraph/index.js.map +1 -1
  173. package/Helpers/sceneHelpers.js +1 -1
  174. package/Helpers/sceneHelpers.js.map +1 -1
  175. package/Lights/index.d.ts +1 -0
  176. package/Lights/index.js +1 -0
  177. package/Lights/index.js.map +1 -1
  178. package/Lights/lightingVolume.d.ts +89 -0
  179. package/Lights/lightingVolume.js +435 -0
  180. package/Lights/lightingVolume.js.map +1 -0
  181. package/Materials/GaussianSplatting/gaussianSplattingMaterial.d.ts +7 -0
  182. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +19 -5
  183. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  184. package/Materials/Node/nodeMaterial.js +8 -2
  185. package/Materials/Node/nodeMaterial.js.map +1 -1
  186. package/Materials/floatingOriginMatrixOverrides.js +6 -5
  187. package/Materials/floatingOriginMatrixOverrides.js.map +1 -1
  188. package/Materials/uniformBuffer.d.ts +1 -0
  189. package/Materials/uniformBuffer.js +8 -1
  190. package/Materials/uniformBuffer.js.map +1 -1
  191. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +5 -2
  192. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +138 -45
  193. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  194. package/Meshes/mesh.js +1 -1
  195. package/Meshes/mesh.js.map +1 -1
  196. package/Misc/screenshotTools.js +2 -8
  197. package/Misc/screenshotTools.js.map +1 -1
  198. package/Particles/solidParticle.d.ts +9 -0
  199. package/Particles/solidParticle.js +11 -0
  200. package/Particles/solidParticle.js.map +1 -1
  201. package/Particles/solidParticleSystem.d.ts +28 -0
  202. package/Particles/solidParticleSystem.js +75 -0
  203. package/Particles/solidParticleSystem.js.map +1 -1
  204. package/Physics/v2/characterController.d.ts +42 -2
  205. package/Physics/v2/characterController.js +140 -46
  206. package/Physics/v2/characterController.js.map +1 -1
  207. package/Shaders/volumetricLightingBlendVolume.fragment.d.ts +5 -0
  208. package/Shaders/volumetricLightingBlendVolume.fragment.js +21 -0
  209. package/Shaders/volumetricLightingBlendVolume.fragment.js.map +1 -0
  210. package/Shaders/volumetricLightingRenderVolume.fragment.d.ts +7 -0
  211. package/Shaders/volumetricLightingRenderVolume.fragment.js +25 -0
  212. package/Shaders/volumetricLightingRenderVolume.fragment.js.map +1 -0
  213. package/Shaders/volumetricLightingRenderVolume.vertex.d.ts +9 -0
  214. package/Shaders/volumetricLightingRenderVolume.vertex.js +18 -0
  215. package/Shaders/volumetricLightingRenderVolume.vertex.js.map +1 -0
  216. package/ShadersWGSL/gaussianSplattingDepth.fragment.d.ts +0 -1
  217. package/ShadersWGSL/gaussianSplattingDepth.fragment.js +0 -2
  218. package/ShadersWGSL/gaussianSplattingDepth.fragment.js.map +1 -1
  219. package/ShadersWGSL/lightingVolume.compute.d.ts +5 -0
  220. package/ShadersWGSL/lightingVolume.compute.js +27 -0
  221. package/ShadersWGSL/lightingVolume.compute.js.map +1 -0
  222. package/ShadersWGSL/volumetricLightingBlendVolume.fragment.d.ts +5 -0
  223. package/ShadersWGSL/volumetricLightingBlendVolume.fragment.js +22 -0
  224. package/ShadersWGSL/volumetricLightingBlendVolume.fragment.js.map +1 -0
  225. package/ShadersWGSL/volumetricLightingRenderVolume.fragment.d.ts +7 -0
  226. package/ShadersWGSL/volumetricLightingRenderVolume.fragment.js +27 -0
  227. package/ShadersWGSL/volumetricLightingRenderVolume.fragment.js.map +1 -0
  228. package/ShadersWGSL/volumetricLightingRenderVolume.vertex.d.ts +7 -0
  229. package/ShadersWGSL/volumetricLightingRenderVolume.vertex.js +17 -0
  230. package/ShadersWGSL/volumetricLightingRenderVolume.vertex.js.map +1 -0
  231. package/States/IStencilState.d.ts +48 -2
  232. package/States/IStencilState.js.map +1 -1
  233. package/package.json +1 -1
  234. package/scene.js +6 -4
  235. package/scene.js.map +1 -1
@@ -863,7 +863,8 @@ export declare class WebGPUEngine extends ThinWebGPUEngine {
863
863
  flushFramebuffer(): void;
864
864
  /** @internal */
865
865
  _currentFrameBufferIsDefaultFrameBuffer(): boolean;
866
- private _startRenderTargetRenderPass;
866
+ /** @internal */
867
+ _startRenderTargetRenderPass(renderTargetWrapper: RenderTargetWrapper, setClearStates: boolean, clearColor: Nullable<IColor4Like>, clearDepth: boolean, clearStencil: boolean): void;
867
868
  private _startMainRenderPass;
868
869
  /**
869
870
  * Binds the frame buffer to the specified texture.
@@ -883,17 +884,19 @@ export declare class WebGPUEngine extends ThinWebGPUEngine {
883
884
  * @param onBeforeUnbind defines a function which will be called before the effective unbind
884
885
  */
885
886
  unBindFramebuffer(texture: RenderTargetWrapper, disableGenerateMipMaps?: boolean, onBeforeUnbind?: () => void): void;
887
+ private _resolveAndGenerateMipMapsFramebuffer;
886
888
  /**
887
889
  * Generates mipmaps for the texture of the (single) render target
888
890
  * @param texture The render target containing the texture to generate the mipmaps for
889
891
  */
890
892
  generateMipMapsFramebuffer(texture: RenderTargetWrapper): void;
891
893
  /**
892
- * Resolves the MSAA texture of the (single) render target into its non-MSAA version.
894
+ * Resolves the MSAA texture of the render target into its non-MSAA version.
893
895
  * Note that if "texture" is not a MSAA render target, no resolve is performed.
894
- * @param _texture The render target texture containing the MSAA texture to resolve
896
+ * @param texture The render target texture containing the MSAA texture to resolve
897
+ * @param resolveColors If true, resolve the color textures (default: true) - still subject to texture.resolveMSAAColors
895
898
  */
896
- resolveFramebuffer(_texture: RenderTargetWrapper): void;
899
+ resolveFramebuffer(texture: RenderTargetWrapper, resolveColors?: boolean): void;
897
900
  /**
898
901
  * Unbind the current render target and bind the default framebuffer
899
902
  */
@@ -2374,6 +2374,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
2374
2374
  //------------------------------------------------------------------------------
2375
2375
  // Render Pass
2376
2376
  //------------------------------------------------------------------------------
2377
+ /** @internal */
2377
2378
  _startRenderTargetRenderPass(renderTargetWrapper, setClearStates, clearColor, clearDepth, clearStencil) {
2378
2379
  this._endCurrentRenderPass();
2379
2380
  const rtWrapper = renderTargetWrapper;
@@ -2381,9 +2382,12 @@ export class WebGPUEngine extends ThinWebGPUEngine {
2381
2382
  const gpuDepthStencilWrapper = depthStencilTexture?._hardwareTexture;
2382
2383
  const gpuDepthStencilTexture = gpuDepthStencilWrapper?.underlyingResource;
2383
2384
  const gpuDepthStencilMSAATexture = gpuDepthStencilWrapper?.getMSAATexture(0);
2384
- const depthTextureView = gpuDepthStencilTexture?.createView(this._rttRenderPassWrapper.depthAttachmentViewDescriptor);
2385
2385
  const depthMSAATextureView = gpuDepthStencilMSAATexture?.createView(this._rttRenderPassWrapper.depthAttachmentViewDescriptor);
2386
- const depthTextureHasStencil = gpuDepthStencilWrapper ? WebGPUTextureHelper.HasStencilAspect(gpuDepthStencilWrapper.format) : false;
2386
+ const depthTextureView = depthMSAATextureView ? undefined : gpuDepthStencilTexture?.createView(this._rttRenderPassWrapper.depthAttachmentViewDescriptor);
2387
+ // We use the MSAA texture format (if available) to determine if it has a stencil aspect or not because, for MSAA depth textures,
2388
+ // the format of the "resolve" texture (gpuDepthStencilWrapper.format) is a single red channel format, not a depth-stencil format.
2389
+ const depthTextureHasStencil = gpuDepthStencilWrapper ? WebGPUTextureHelper.HasStencilAspect(gpuDepthStencilMSAATexture?.format ?? gpuDepthStencilWrapper.format) : false;
2390
+ const depthTextureHasDepth = gpuDepthStencilWrapper ? WebGPUTextureHelper.HasDepthAspect(gpuDepthStencilMSAATexture?.format ?? gpuDepthStencilWrapper.format) : false;
2387
2391
  const colorAttachments = [];
2388
2392
  if (this.useReverseDepthBuffer) {
2389
2393
  this.setDepthFunctionToGreaterOrEqual();
@@ -2428,7 +2432,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
2428
2432
  const colorMSAATextureView = gpuMSAATexture?.createView(msaaViewDescriptor);
2429
2433
  colorAttachments.push({
2430
2434
  view: colorMSAATextureView ? colorMSAATextureView : colorTextureView,
2431
- resolveTarget: gpuMSAATexture ? colorTextureView : undefined,
2435
+ resolveTarget: gpuMSAATexture && !rtWrapper.disableAutomaticMSAAResolve ? colorTextureView : undefined,
2432
2436
  depthSlice: mrtTexture.is3D ? (rtWrapper.layerIndices?.[i] ?? 0) : undefined,
2433
2437
  clearValue: index !== 0 && mustClearColor ? (isRtInteger ? clearColorForIntegerRt : clearColor) : undefined,
2434
2438
  loadOp: index !== 0 && mustClearColor ? "clear" /* WebGPUConstants.LoadOp.Clear */ : "load" /* WebGPUConstants.LoadOp.Load */,
@@ -2456,7 +2460,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
2456
2460
  const isRtInteger = internalTexture.type === 7 || internalTexture.type === 5;
2457
2461
  colorAttachments.push({
2458
2462
  view: colorMSAATextureView ? colorMSAATextureView : colorTextureView,
2459
- resolveTarget: gpuMSAATexture ? colorTextureView : undefined,
2463
+ resolveTarget: gpuMSAATexture && !rtWrapper.disableAutomaticMSAAResolve ? colorTextureView : undefined,
2460
2464
  depthSlice,
2461
2465
  clearValue: mustClearColor ? (isRtInteger ? clearColorForIntegerRt : clearColor) : undefined,
2462
2466
  loadOp: mustClearColor ? "clear" /* WebGPUConstants.LoadOp.Clear */ : "load" /* WebGPUConstants.LoadOp.Load */,
@@ -2475,18 +2479,16 @@ export class WebGPUEngine extends ThinWebGPUEngine {
2475
2479
  ? {
2476
2480
  view: depthMSAATextureView ? depthMSAATextureView : depthTextureView,
2477
2481
  depthClearValue: mustClearDepth ? (this.useReverseDepthBuffer ? this._clearReverseDepthValue : this._clearDepthValue) : undefined,
2478
- depthLoadOp: rtWrapper.depthReadOnly ? undefined : mustClearDepth ? "clear" /* WebGPUConstants.LoadOp.Clear */ : "load" /* WebGPUConstants.LoadOp.Load */,
2479
- depthStoreOp: rtWrapper.depthReadOnly ? undefined : "store" /* WebGPUConstants.StoreOp.Store */,
2482
+ depthLoadOp: rtWrapper.depthReadOnly || !depthTextureHasDepth ? undefined : mustClearDepth ? "clear" /* WebGPUConstants.LoadOp.Clear */ : "load" /* WebGPUConstants.LoadOp.Load */,
2483
+ depthStoreOp: rtWrapper.depthReadOnly || !depthTextureHasDepth ? undefined : "store" /* WebGPUConstants.StoreOp.Store */,
2480
2484
  depthReadOnly: rtWrapper.depthReadOnly,
2481
2485
  stencilClearValue: rtWrapper._depthStencilTextureWithStencil && mustClearStencil ? this._clearStencilValue : undefined,
2482
- stencilLoadOp: rtWrapper.stencilReadOnly
2486
+ stencilLoadOp: rtWrapper.stencilReadOnly || !depthTextureHasStencil
2483
2487
  ? undefined
2484
- : !depthTextureHasStencil
2485
- ? undefined
2486
- : rtWrapper._depthStencilTextureWithStencil && mustClearStencil
2487
- ? "clear" /* WebGPUConstants.LoadOp.Clear */
2488
- : "load" /* WebGPUConstants.LoadOp.Load */,
2489
- stencilStoreOp: rtWrapper.stencilReadOnly ? undefined : !depthTextureHasStencil ? undefined : "store" /* WebGPUConstants.StoreOp.Store */,
2488
+ : rtWrapper._depthStencilTextureWithStencil && mustClearStencil
2489
+ ? "clear" /* WebGPUConstants.LoadOp.Clear */
2490
+ : "load" /* WebGPUConstants.LoadOp.Load */,
2491
+ stencilStoreOp: rtWrapper.stencilReadOnly || !depthTextureHasStencil ? undefined : "store" /* WebGPUConstants.StoreOp.Store */,
2490
2492
  stencilReadOnly: rtWrapper.stencilReadOnly,
2491
2493
  }
2492
2494
  : undefined,
@@ -2607,6 +2609,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
2607
2609
  this._setDepthTextureFormat(this._rttRenderPassWrapper);
2608
2610
  this._setColorFormat(this._rttRenderPassWrapper);
2609
2611
  this._rttRenderPassWrapper.colorAttachmentViewDescriptor = {
2612
+ label: texture.label ? texture.label + " - Color Attachment View" : "RTT - Color Attachment View",
2610
2613
  format: this._colorFormat,
2611
2614
  dimension: texture.is3D ? "3d" /* WebGPUConstants.TextureViewDimension.E3d */ : "2d" /* WebGPUConstants.TextureViewDimension.E2d */,
2612
2615
  mipLevelCount: 1,
@@ -2616,6 +2619,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
2616
2619
  aspect: "all" /* WebGPUConstants.TextureAspect.All */,
2617
2620
  };
2618
2621
  this._rttRenderPassWrapper.depthAttachmentViewDescriptor = {
2622
+ label: texture.label ? texture.label + " - Depth Attachment View" : "RTT - Depth Attachment View",
2619
2623
  format: this._depthTextureFormat,
2620
2624
  dimension: depthStencilTexture && depthStencilTexture.is3D ? "3d" /* WebGPUConstants.TextureViewDimension.E3d */ : "2d" /* WebGPUConstants.TextureViewDimension.E2d */,
2621
2625
  mipLevelCount: 1,
@@ -2689,14 +2693,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
2689
2693
  }
2690
2694
  this._currentRenderTarget = saveCrt;
2691
2695
  this._endCurrentRenderPass();
2692
- if (!disableGenerateMipMaps) {
2693
- if (texture.isMulti) {
2694
- this.generateMipMapsMultiFramebuffer(texture);
2695
- }
2696
- else {
2697
- this.generateMipMapsFramebuffer(texture);
2698
- }
2699
- }
2696
+ this._resolveAndGenerateMipMapsFramebuffer(texture, disableGenerateMipMaps);
2700
2697
  this._currentRenderTarget = null;
2701
2698
  if (this.dbgVerboseLogsForFirstFrames) {
2702
2699
  if (this._count === undefined) {
@@ -2710,6 +2707,21 @@ export class WebGPUEngine extends ThinWebGPUEngine {
2710
2707
  this._cacheRenderPipeline.setMRT([]);
2711
2708
  this._cacheRenderPipeline.setMRTAttachments(this._mrtAttachments);
2712
2709
  }
2710
+ _resolveAndGenerateMipMapsFramebuffer(texture, disableGenerateMipMaps = false) {
2711
+ const webglRtWrapper = texture;
2712
+ if (!webglRtWrapper.disableAutomaticMSAAResolve) {
2713
+ // we pass false as the second parameter because the color resolve has already been done automatically when the render pass ended
2714
+ this.resolveFramebuffer(texture, false);
2715
+ }
2716
+ if (!disableGenerateMipMaps) {
2717
+ if (texture.isMulti) {
2718
+ this.generateMipMapsMultiFramebuffer(texture);
2719
+ }
2720
+ else {
2721
+ this.generateMipMapsFramebuffer(texture);
2722
+ }
2723
+ }
2724
+ }
2713
2725
  /**
2714
2726
  * Generates mipmaps for the texture of the (single) render target
2715
2727
  * @param texture The render target containing the texture to generate the mipmaps for
@@ -2720,12 +2732,28 @@ export class WebGPUEngine extends ThinWebGPUEngine {
2720
2732
  }
2721
2733
  }
2722
2734
  /**
2723
- * Resolves the MSAA texture of the (single) render target into its non-MSAA version.
2735
+ * Resolves the MSAA texture of the render target into its non-MSAA version.
2724
2736
  * Note that if "texture" is not a MSAA render target, no resolve is performed.
2725
- * @param _texture The render target texture containing the MSAA texture to resolve
2737
+ * @param texture The render target texture containing the MSAA texture to resolve
2738
+ * @param resolveColors If true, resolve the color textures (default: true) - still subject to texture.resolveMSAAColors
2726
2739
  */
2727
- resolveFramebuffer(_texture) {
2728
- throw new Error("resolveFramebuffer is not yet implemented in WebGPU!");
2740
+ resolveFramebuffer(texture, resolveColors = true) {
2741
+ if (texture.samples <= 1) {
2742
+ return;
2743
+ }
2744
+ if (texture.resolveMSAAColors && resolveColors) {
2745
+ const disableAutomaticMSAAResolve = texture.disableAutomaticMSAAResolve;
2746
+ texture.disableAutomaticMSAAResolve = false;
2747
+ // Simply bind and unbind the framebuffer to trigger the resolve
2748
+ this.bindFramebuffer(texture);
2749
+ this._startRenderTargetRenderPass(this._currentRenderTarget, false, null, false, false);
2750
+ this.unBindFramebuffer(texture);
2751
+ texture.disableAutomaticMSAAResolve = disableAutomaticMSAAResolve;
2752
+ }
2753
+ if (texture.resolveMSAADepth && texture._depthStencilTexture) {
2754
+ const gpuTextureWrapper = texture._depthStencilTexture._hardwareTexture;
2755
+ this._textureHelper.resolveMSAADepthTexture(gpuTextureWrapper.getMSAATexture(0), gpuTextureWrapper.underlyingResource, this._renderEncoder);
2756
+ }
2729
2757
  }
2730
2758
  /**
2731
2759
  * Unbind the current render target and bind the default framebuffer