@onerjs/core 8.42.5 → 8.42.7

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 (233) hide show
  1. package/Animations/animatorAvatar.d.ts +5 -2
  2. package/Animations/animatorAvatar.js +40 -27
  3. package/Animations/animatorAvatar.js.map +1 -1
  4. package/Cameras/Inputs/geospatialCameraMouseWheelInput.d.ts +1 -2
  5. package/Cameras/Inputs/geospatialCameraMouseWheelInput.js +1 -2
  6. package/Cameras/Inputs/geospatialCameraMouseWheelInput.js.map +1 -1
  7. package/Cameras/Inputs/geospatialCameraPointersInput.d.ts +0 -4
  8. package/Cameras/Inputs/geospatialCameraPointersInput.js +1 -5
  9. package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
  10. package/Cameras/arcRotateCamera.js +9 -9
  11. package/Cameras/arcRotateCamera.js.map +1 -1
  12. package/Cameras/cameraMovement.d.ts +1 -4
  13. package/Cameras/cameraMovement.js +1 -4
  14. package/Cameras/cameraMovement.js.map +1 -1
  15. package/Cameras/geospatialCamera.d.ts +22 -4
  16. package/Cameras/geospatialCamera.js +27 -9
  17. package/Cameras/geospatialCamera.js.map +1 -1
  18. package/Cameras/geospatialCameraMovement.d.ts +3 -3
  19. package/Cameras/geospatialCameraMovement.js +18 -18
  20. package/Cameras/geospatialCameraMovement.js.map +1 -1
  21. package/Engines/WebGPU/Extensions/engine.debugging.js +35 -13
  22. package/Engines/WebGPU/Extensions/engine.debugging.js.map +1 -1
  23. package/Engines/abstractEngine.js +2 -2
  24. package/Engines/abstractEngine.js.map +1 -1
  25. package/Engines/engineFeatures.d.ts +0 -2
  26. package/Engines/engineFeatures.js.map +1 -1
  27. package/Engines/nullEngine.js +0 -1
  28. package/Engines/nullEngine.js.map +1 -1
  29. package/Engines/thinEngine.js +0 -1
  30. package/Engines/thinEngine.js.map +1 -1
  31. package/Engines/thinNativeEngine.js +0 -1
  32. package/Engines/thinNativeEngine.js.map +1 -1
  33. package/Engines/thinWebGPUEngine.d.ts +9 -4
  34. package/Engines/thinWebGPUEngine.js +32 -32
  35. package/Engines/thinWebGPUEngine.js.map +1 -1
  36. package/Engines/webgpuEngine.d.ts +1 -0
  37. package/Engines/webgpuEngine.js +24 -165
  38. package/Engines/webgpuEngine.js.map +1 -1
  39. package/FrameGraph/Passes/renderPass.js +0 -3
  40. package/FrameGraph/Passes/renderPass.js.map +1 -1
  41. package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +2 -3
  42. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +5 -29
  43. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  44. package/FrameGraph/frameGraph.js +3 -0
  45. package/FrameGraph/frameGraph.js.map +1 -1
  46. package/FrameGraph/frameGraphContext.js +1 -1
  47. package/FrameGraph/frameGraphContext.js.map +1 -1
  48. package/FrameGraph/frameGraphTask.d.ts +0 -2
  49. package/FrameGraph/frameGraphTask.js +15 -17
  50. package/FrameGraph/frameGraphTask.js.map +1 -1
  51. package/FrameGraph/frameGraphTextureManager.js +1 -1
  52. package/FrameGraph/frameGraphTextureManager.js.map +1 -1
  53. package/Gizmos/axisScaleGizmo.js +2 -2
  54. package/Gizmos/axisScaleGizmo.js.map +1 -1
  55. package/Gizmos/cameraGizmo.d.ts +1 -1
  56. package/Gizmos/cameraGizmo.js +1 -1
  57. package/Gizmos/cameraGizmo.js.map +1 -1
  58. package/Gizmos/gizmo.d.ts +4 -4
  59. package/Gizmos/gizmo.js +5 -5
  60. package/Gizmos/gizmo.js.map +1 -1
  61. package/Gizmos/gizmoManager.d.ts +2 -2
  62. package/Gizmos/gizmoManager.js +1 -1
  63. package/Gizmos/gizmoManager.js.map +1 -1
  64. package/Gizmos/planeRotationGizmo.d.ts +2 -2
  65. package/Gizmos/planeRotationGizmo.js +2 -3
  66. package/Gizmos/planeRotationGizmo.js.map +1 -1
  67. package/Gizmos/positionGizmo.d.ts +1 -1
  68. package/Gizmos/positionGizmo.js +2 -2
  69. package/Gizmos/positionGizmo.js.map +1 -1
  70. package/Gizmos/rotationGizmo.d.ts +1 -1
  71. package/Gizmos/rotationGizmo.js +3 -3
  72. package/Gizmos/rotationGizmo.js.map +1 -1
  73. package/Gizmos/scaleGizmo.d.ts +1 -1
  74. package/Gizmos/scaleGizmo.js +1 -1
  75. package/Gizmos/scaleGizmo.js.map +1 -1
  76. package/Loading/Plugins/babylonFileLoader.js +44 -14
  77. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  78. package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.d.ts +12 -3
  79. package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.js +33 -8
  80. package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.js.map +1 -1
  81. package/Materials/uniformBuffer.d.ts +0 -4
  82. package/Materials/uniformBuffer.js +0 -8
  83. package/Materials/uniformBuffer.js.map +1 -1
  84. package/Materials/vertexPullingHelper.functions.d.ts +4 -0
  85. package/Materials/vertexPullingHelper.functions.js +4 -2
  86. package/Materials/vertexPullingHelper.functions.js.map +1 -1
  87. package/Maths/index.d.ts +2 -0
  88. package/Maths/index.js +2 -0
  89. package/Maths/index.js.map +1 -1
  90. package/Maths/math.geospatial.d.ts +12 -0
  91. package/Maths/math.geospatial.functions.d.ts +19 -0
  92. package/Maths/math.geospatial.functions.js +27 -0
  93. package/Maths/math.geospatial.functions.js.map +1 -0
  94. package/Maths/math.geospatial.js +2 -0
  95. package/Maths/math.geospatial.js.map +1 -0
  96. package/Meshes/mesh.js +1 -1
  97. package/Meshes/mesh.js.map +1 -1
  98. package/Navigation/INavigationEngine.d.ts +2 -2
  99. package/Navigation/INavigationEngine.js.map +1 -1
  100. package/Navigation/Plugins/recastJSPlugin.d.ts +2 -2
  101. package/Navigation/Plugins/recastJSPlugin.js +14 -5
  102. package/Navigation/Plugins/recastJSPlugin.js.map +1 -1
  103. package/Physics/castingResult.d.ts +4 -1
  104. package/Physics/castingResult.js +1 -1
  105. package/Physics/castingResult.js.map +1 -1
  106. package/Physics/joinedPhysicsEngineComponent.js +1 -1
  107. package/Physics/joinedPhysicsEngineComponent.js.map +1 -1
  108. package/Physics/physicsHelper.d.ts +8 -8
  109. package/Physics/physicsHelper.js +7 -7
  110. package/Physics/physicsHelper.js.map +1 -1
  111. package/Physics/shapeCastResult.d.ts +4 -0
  112. package/Physics/shapeCastResult.js +7 -0
  113. package/Physics/shapeCastResult.js.map +1 -1
  114. package/Physics/v2/IPhysicsEnginePlugin.d.ts +51 -4
  115. package/Physics/v2/IPhysicsEnginePlugin.js +12 -12
  116. package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
  117. package/Physics/v2/characterController.js.map +1 -1
  118. package/Physics/v2/physicsBody.js.map +1 -1
  119. package/Physics/v2/physicsConstraint.d.ts +1 -1
  120. package/Physics/v2/physicsConstraint.js +1 -1
  121. package/Physics/v2/physicsConstraint.js.map +1 -1
  122. package/Physics/v2/physicsEngine.d.ts +0 -5
  123. package/Physics/v2/physicsEngine.js +0 -5
  124. package/Physics/v2/physicsEngine.js.map +1 -1
  125. package/Physics/v2/physicsEngineComponent.d.ts +1 -1
  126. package/Physics/v2/physicsEngineComponent.js.map +1 -1
  127. package/Physics/v2/physicsMaterial.d.ts +6 -0
  128. package/Physics/v2/physicsMaterial.js +2 -2
  129. package/Physics/v2/physicsMaterial.js.map +1 -1
  130. package/Physics/v2/ragdoll.js.map +1 -1
  131. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +4 -1
  132. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
  133. package/Rendering/edgesRenderer.js +1 -0
  134. package/Rendering/edgesRenderer.js.map +1 -1
  135. package/Rendering/objectRenderer.js +8 -4
  136. package/Rendering/objectRenderer.js.map +1 -1
  137. package/Rendering/renderingGroup.d.ts +1 -1
  138. package/Rendering/renderingGroup.js +1 -1
  139. package/Rendering/renderingGroup.js.map +1 -1
  140. package/Rendering/renderingManager.d.ts +1 -1
  141. package/Rendering/renderingManager.js.map +1 -1
  142. package/Shaders/iblVoxelGrid.fragment.js +4 -1
  143. package/Shaders/iblVoxelGrid.fragment.js.map +1 -1
  144. package/ShadersWGSL/background.vertex.js +8 -8
  145. package/ShadersWGSL/background.vertex.js.map +1 -1
  146. package/ShadersWGSL/boundingBoxRenderer.vertex.js +2 -2
  147. package/ShadersWGSL/boundingBoxRenderer.vertex.js.map +1 -1
  148. package/ShadersWGSL/clearQuad.vertex.js +1 -1
  149. package/ShadersWGSL/clearQuad.vertex.js.map +1 -1
  150. package/ShadersWGSL/color.vertex.js +1 -1
  151. package/ShadersWGSL/color.vertex.js.map +1 -1
  152. package/ShadersWGSL/depth.vertex.js +3 -3
  153. package/ShadersWGSL/depth.vertex.js.map +1 -1
  154. package/ShadersWGSL/fluidRenderingParticleDepth.vertex.js +2 -2
  155. package/ShadersWGSL/fluidRenderingParticleDepth.vertex.js.map +1 -1
  156. package/ShadersWGSL/fluidRenderingParticleDiffuse.vertex.js +2 -2
  157. package/ShadersWGSL/fluidRenderingParticleDiffuse.vertex.js.map +1 -1
  158. package/ShadersWGSL/fluidRenderingParticleThickness.vertex.js +2 -2
  159. package/ShadersWGSL/fluidRenderingParticleThickness.vertex.js.map +1 -1
  160. package/ShadersWGSL/fxaa.vertex.js +1 -1
  161. package/ShadersWGSL/fxaa.vertex.js.map +1 -1
  162. package/ShadersWGSL/gaussianSplatting.vertex.js +3 -3
  163. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  164. package/ShadersWGSL/gaussianSplattingDepth.vertex.js +3 -3
  165. package/ShadersWGSL/gaussianSplattingDepth.vertex.js.map +1 -1
  166. package/ShadersWGSL/geometry.vertex.js +4 -4
  167. package/ShadersWGSL/geometry.vertex.js.map +1 -1
  168. package/ShadersWGSL/glowMapGeneration.vertex.js +4 -4
  169. package/ShadersWGSL/glowMapGeneration.vertex.js.map +1 -1
  170. package/ShadersWGSL/glowMapMerge.vertex.js +1 -1
  171. package/ShadersWGSL/glowMapMerge.vertex.js.map +1 -1
  172. package/ShadersWGSL/greasedLine.vertex.js +10 -4
  173. package/ShadersWGSL/greasedLine.vertex.js.map +1 -1
  174. package/ShadersWGSL/hdrFiltering.vertex.js +1 -1
  175. package/ShadersWGSL/hdrFiltering.vertex.js.map +1 -1
  176. package/ShadersWGSL/hdrIrradianceFiltering.vertex.js +1 -1
  177. package/ShadersWGSL/hdrIrradianceFiltering.vertex.js.map +1 -1
  178. package/ShadersWGSL/iblVoxelGrid.vertex.js +53 -44
  179. package/ShadersWGSL/iblVoxelGrid.vertex.js.map +1 -1
  180. package/ShadersWGSL/iblVoxelSlabDebug.vertex.js +1 -1
  181. package/ShadersWGSL/iblVoxelSlabDebug.vertex.js.map +1 -1
  182. package/ShadersWGSL/kernelBlur.vertex.js +2 -2
  183. package/ShadersWGSL/kernelBlur.vertex.js.map +1 -1
  184. package/ShadersWGSL/layer.vertex.js +1 -1
  185. package/ShadersWGSL/layer.vertex.js.map +1 -1
  186. package/ShadersWGSL/lensFlare.vertex.js +1 -1
  187. package/ShadersWGSL/lensFlare.vertex.js.map +1 -1
  188. package/ShadersWGSL/line.vertex.js +2 -2
  189. package/ShadersWGSL/line.vertex.js.map +1 -1
  190. package/ShadersWGSL/meshUVSpaceRenderer.vertex.js +2 -2
  191. package/ShadersWGSL/meshUVSpaceRenderer.vertex.js.map +1 -1
  192. package/ShadersWGSL/meshUVSpaceRendererFinaliser.vertex.js +1 -1
  193. package/ShadersWGSL/meshUVSpaceRendererFinaliser.vertex.js.map +1 -1
  194. package/ShadersWGSL/meshUVSpaceRendererMasker.vertex.js +1 -1
  195. package/ShadersWGSL/meshUVSpaceRendererMasker.vertex.js.map +1 -1
  196. package/ShadersWGSL/particles.vertex.js +9 -9
  197. package/ShadersWGSL/particles.vertex.js.map +1 -1
  198. package/ShadersWGSL/picking.vertex.js +2 -2
  199. package/ShadersWGSL/picking.vertex.js.map +1 -1
  200. package/ShadersWGSL/procedural.vertex.js +1 -1
  201. package/ShadersWGSL/procedural.vertex.js.map +1 -1
  202. package/ShadersWGSL/shadowMap.vertex.js +4 -4
  203. package/ShadersWGSL/shadowMap.vertex.js.map +1 -1
  204. package/ShadersWGSL/sprites.vertex.js +3 -3
  205. package/ShadersWGSL/sprites.vertex.js.map +1 -1
  206. package/XR/features/WebXRControllerPhysics.js +0 -2
  207. package/XR/features/WebXRControllerPhysics.js.map +1 -1
  208. package/XR/features/WebXRControllerTeleportation.js +1 -2
  209. package/XR/features/WebXRControllerTeleportation.js.map +1 -1
  210. package/XR/features/WebXRDepthSensing.js +1 -0
  211. package/XR/features/WebXRDepthSensing.js.map +1 -1
  212. package/XR/features/WebXRHandTracking.js +4 -7
  213. package/XR/features/WebXRHandTracking.js.map +1 -1
  214. package/XR/features/WebXRWalkingLocomotion.js +1 -1
  215. package/XR/features/WebXRWalkingLocomotion.js.map +1 -1
  216. package/XR/motionController/webXRMicrosoftMixedRealityController.js +1 -1
  217. package/XR/motionController/webXRMicrosoftMixedRealityController.js.map +1 -1
  218. package/XR/motionController/webXRMotionControllerManager.js +2 -2
  219. package/XR/motionController/webXRMotionControllerManager.js.map +1 -1
  220. package/XR/webXRCamera.d.ts +1 -0
  221. package/XR/webXRCamera.js +9 -7
  222. package/XR/webXRCamera.js.map +1 -1
  223. package/XR/webXRExperienceHelper.d.ts +4 -0
  224. package/XR/webXRExperienceHelper.js +25 -5
  225. package/XR/webXRExperienceHelper.js.map +1 -1
  226. package/XR/webXRInput.d.ts +1 -0
  227. package/XR/webXRInput.js +6 -0
  228. package/XR/webXRInput.js.map +1 -1
  229. package/XR/webXRSessionManager.js +5 -4
  230. package/XR/webXRSessionManager.js.map +1 -1
  231. package/package.json +1 -1
  232. package/scene.js +2 -1
  233. package/scene.js.map +1 -1
@@ -17,14 +17,10 @@ export declare abstract class ThinWebGPUEngine extends AbstractEngine {
17
17
  /** @internal */
18
18
  dbgSanityChecks: boolean;
19
19
  /** @internal */
20
- dbgVerboseLogsNumFrames: number;
21
- /** @internal */
22
20
  dbgLogIfNotDrawWrapper: boolean;
23
21
  /** @internal */
24
22
  dbgShowEmptyEnableEffectCalls: boolean;
25
23
  /** @internal */
26
- dbgVerboseLogsForFirstFrames: boolean;
27
- /** @internal */
28
24
  _textureHelper: WebGPUTextureManager;
29
25
  /** @internal */
30
26
  _cacheRenderPipeline: WebGPUCacheRenderPipeline;
@@ -42,6 +38,14 @@ export declare abstract class ThinWebGPUEngine extends AbstractEngine {
42
38
  _timestampQuery: WebGPUTimestampQuery;
43
39
  /** @internal */
44
40
  _timestampIndex: number;
41
+ /** @internal */
42
+ _showGPUDebugMarkersLog: boolean;
43
+ /** @internal */
44
+ _debugStackRenderEncoder: string[];
45
+ /** @internal */
46
+ _debugStackRenderPass: string[];
47
+ /** @internal */
48
+ _debugNumPopPending: number;
45
49
  /**
46
50
  * Gets the GPU time spent in the main render pass for the last frame rendered (in nanoseconds).
47
51
  * You have to enable the "timestamp-query" extension in the engine constructor options and set engine.enableGPUTimingMeasurements = true.
@@ -66,4 +70,5 @@ export declare abstract class ThinWebGPUEngine extends AbstractEngine {
66
70
  * @internal
67
71
  */
68
72
  _generateMipmaps(texture: InternalTexture, commandEncoder?: GPUCommandEncoder): void;
73
+ protected _debugPushPendingGroups(forRenderPass: boolean): void;
69
74
  }
@@ -15,18 +15,22 @@ export class ThinWebGPUEngine extends AbstractEngine {
15
15
  /** @internal */
16
16
  this.dbgSanityChecks = true;
17
17
  /** @internal */
18
- this.dbgVerboseLogsNumFrames = 10;
19
- /** @internal */
20
18
  this.dbgLogIfNotDrawWrapper = true;
21
19
  /** @internal */
22
20
  this.dbgShowEmptyEnableEffectCalls = true;
23
21
  /** @internal */
24
- this.dbgVerboseLogsForFirstFrames = false;
25
- /** @internal */
26
22
  this._currentRenderPass = null;
27
23
  this._snapshotRenderingMode = 0;
28
24
  /** @internal */
29
25
  this._timestampIndex = 0;
26
+ /** @internal */
27
+ this._showGPUDebugMarkersLog = false;
28
+ /** @internal */
29
+ this._debugStackRenderEncoder = [];
30
+ /** @internal */
31
+ this._debugStackRenderPass = [];
32
+ /** @internal */
33
+ this._debugNumPopPending = 0;
30
34
  }
31
35
  /**
32
36
  * Enables or disables GPU timing measurements.
@@ -50,6 +54,13 @@ export class ThinWebGPUEngine extends AbstractEngine {
50
54
  if (!this._currentRenderPass) {
51
55
  return 0;
52
56
  }
57
+ if (this._debugStackRenderPass.length !== 0) {
58
+ // We have pushed debug groups without popping them, we need to pop them before ending the render pass to avoid WebGPU validation errors
59
+ // We will re-push them after starting the new render pass (if any)
60
+ for (let i = 0; i < this._debugStackRenderPass.length; ++i) {
61
+ this._currentRenderPass.popDebugGroup();
62
+ }
63
+ }
53
64
  const currentPassIndex = this._currentPassIsMainPass() ? 2 : 1;
54
65
  if (!this._snapshotRendering.endRenderPass(this._currentRenderPass) && !this.compatibilityMode) {
55
66
  this._bundleList.run(this._currentRenderPass);
@@ -60,20 +71,16 @@ export class ThinWebGPUEngine extends AbstractEngine {
60
71
  ? this._currentRenderTarget.gpuTimeInFrame
61
72
  : this.gpuTimeInFrameForMainPass));
62
73
  this._timestampIndex += 2;
63
- if (this.dbgVerboseLogsForFirstFrames) {
64
- if (this._count === undefined) {
65
- this._count = 0;
66
- }
67
- if (!this._count || this._count < this.dbgVerboseLogsNumFrames) {
68
- Logger.Log("frame #" +
69
- this._count +
70
- " - " +
71
- (currentPassIndex === 2 ? "main" : "render target") +
72
- " end pass" +
73
- (currentPassIndex === 1 ? " - internalTexture.uniqueId=" + this._currentRenderTarget?.texture?.uniqueId : ""));
74
+ // Pop all pending debug groups that couldn't be popped while the render pass was active
75
+ while (this._debugNumPopPending-- > 0) {
76
+ if (this._showGPUDebugMarkersLog) {
77
+ Logger.Log(`[${this.frameId}] Re-popping pending debug group on render encoder '${this._renderEncoder.label}' after ending current render pass '${this._currentRenderPass.label}'`);
74
78
  }
79
+ this._renderEncoder.popDebugGroup();
80
+ this._debugStackRenderEncoder.pop();
75
81
  }
76
82
  this._currentRenderPass = null;
83
+ this._debugNumPopPending = 0;
77
84
  return currentPassIndex;
78
85
  }
79
86
  /**
@@ -90,23 +97,6 @@ export class ThinWebGPUEngine extends AbstractEngine {
90
97
  this._endCurrentRenderPass();
91
98
  }
92
99
  const mipmapCount = WebGPUTextureHelper.ComputeNumMipmapLevels(texture.width, texture.height);
93
- if (this.dbgVerboseLogsForFirstFrames) {
94
- if (this._count === undefined) {
95
- this._count = 0;
96
- }
97
- if (!this._count || this._count < this.dbgVerboseLogsNumFrames) {
98
- Logger.Log("frame #" +
99
- this._count +
100
- " - generate mipmaps - width=" +
101
- texture.width +
102
- ", height=" +
103
- texture.height +
104
- ", isCube=" +
105
- texture.isCube +
106
- ", command encoder=" +
107
- (commandEncoder === this._renderEncoder ? "render" : "copy"));
108
- }
109
- }
110
100
  if (texture.isCube) {
111
101
  this._textureHelper.generateCubeMipmaps(gpuHardwareTexture, mipmapCount, commandEncoder);
112
102
  }
@@ -117,5 +107,15 @@ export class ThinWebGPUEngine extends AbstractEngine {
117
107
  this._textureHelper.generateMipmaps(gpuHardwareTexture, mipmapCount, 0, commandEncoder);
118
108
  }
119
109
  }
110
+ _debugPushPendingGroups(forRenderPass) {
111
+ const debugStack = forRenderPass ? this._debugStackRenderPass : this._debugStackRenderEncoder;
112
+ const currentEncoder = forRenderPass ? this._currentRenderPass : this._renderEncoder;
113
+ for (const groupName of debugStack) {
114
+ if (this._showGPUDebugMarkersLog) {
115
+ Logger.Log(`[${this.frameId}] Re-pushing debug group '${groupName}' on ${forRenderPass ? "current render pass '" + this._currentRenderPass?.label + "'" : "render encoder '" + this._renderEncoder.label + "'"} after starting a new ${forRenderPass ? "render pass" : "render encoder"}`);
116
+ }
117
+ currentEncoder.pushDebugGroup(groupName);
118
+ }
119
+ }
120
120
  }
121
121
  //# sourceMappingURL=thinWebGPUEngine.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"thinWebGPUEngine.js","sourceRoot":"","sources":["../../../../dev/core/src/Engines/thinWebGPUEngine.ts"],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AAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CACnE,CAAC;YACN,CAAC;QACL,CAAC;QAED,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACjB,IAAI,CAAC,cAAc,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;QAC7F,CAAC;aAAM,IAAI,OAAO,CAAC,OAAO,sCAA8B,IAAI,OAAO,CAAC,OAAO,8CAAqC,EAAE,CAAC;YAC/G,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,kBAAkB,EAAE,OAAO,CAAC,aAAa,EAAE,CAAC,EAAE,cAAc,CAAC,CAAC;QACtG,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,kBAAkB,EAAE,WAAW,EAAE,CAAC,EAAE,cAAc,CAAC,CAAC;QAC5F,CAAC;IACL,CAAC;CACJ","sourcesContent":["import type { InternalTexture } from \"core/Materials/Textures/internalTexture\";\r\nimport { InternalTextureSource } 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._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 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, mipmapCount, commandEncoder);\r\n } else if (texture._source === InternalTextureSource.Raw || texture._source === InternalTextureSource.Raw2DArray) {\r\n this._textureHelper.generateMipmaps(gpuHardwareTexture, texture.mipLevelCount, 0, commandEncoder);\r\n } else {\r\n this._textureHelper.generateMipmaps(gpuHardwareTexture, mipmapCount, 0, 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":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKlD,OAAO,EAAE,MAAM,EAAE,0BAAyB;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,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,CAAC,CAAC;QAC5F,CAAC;IACL,CAAC;IAES,uBAAuB,CAAC,aAAsB;QACpD,MAAM,UAAU,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC;QAC9F,MAAM,cAAc,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC;QAErF,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACjC,IAAI,IAAI,CAAC,uBAAuB,EAAE,CAAC;gBAC/B,MAAM,CAAC,GAAG,CACN,IAAI,IAAI,CAAC,OAAO,6BAA6B,SAAS,QAAQ,aAAa,CAAC,CAAC,CAAC,uBAAuB,GAAG,IAAI,CAAC,kBAAkB,EAAE,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,kBAAkB,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,GAAG,GAAG,yBAAyB,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,gBAAgB,EAAE,CACjR,CAAC;YACN,CAAC;YACD,cAAe,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QAC9C,CAAC;IACL,CAAC;CACJ","sourcesContent":["import type { InternalTexture } from \"core/Materials/Textures/internalTexture\";\r\nimport { InternalTextureSource } 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 dbgLogIfNotDrawWrapper = true;\r\n /** @internal */\r\n public dbgShowEmptyEnableEffectCalls = true;\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 _showGPUDebugMarkersLog = false;\r\n /** @internal */\r\n public _debugStackRenderEncoder: string[] = [];\r\n /** @internal */\r\n public _debugStackRenderPass: string[] = [];\r\n /** @internal */\r\n public _debugNumPopPending = 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 if (this._debugStackRenderPass.length !== 0) {\r\n // We have pushed debug groups without popping them, we need to pop them before ending the render pass to avoid WebGPU validation errors\r\n // We will re-push them after starting the new render pass (if any)\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 // Pop all pending debug groups that couldn't be popped while the render pass was active\r\n while (this._debugNumPopPending-- > 0) {\r\n if (this._showGPUDebugMarkersLog) {\r\n Logger.Log(\r\n `[${this.frameId}] Re-popping pending debug group on render encoder '${this._renderEncoder.label}' after ending current render pass '${this._currentRenderPass.label}'`\r\n );\r\n }\r\n this._renderEncoder.popDebugGroup();\r\n this._debugStackRenderEncoder.pop();\r\n }\r\n\r\n this._currentRenderPass = null;\r\n this._debugNumPopPending = 0;\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 mipmapCount = WebGPUTextureHelper.ComputeNumMipmapLevels(texture.width, texture.height);\r\n\r\n if (texture.isCube) {\r\n this._textureHelper.generateCubeMipmaps(gpuHardwareTexture, mipmapCount, commandEncoder);\r\n } else if (texture._source === InternalTextureSource.Raw || texture._source === InternalTextureSource.Raw2DArray) {\r\n this._textureHelper.generateMipmaps(gpuHardwareTexture, texture.mipLevelCount, 0, commandEncoder);\r\n } else {\r\n this._textureHelper.generateMipmaps(gpuHardwareTexture, mipmapCount, 0, commandEncoder);\r\n }\r\n }\r\n\r\n protected _debugPushPendingGroups(forRenderPass: boolean) {\r\n const debugStack = forRenderPass ? this._debugStackRenderPass : this._debugStackRenderEncoder;\r\n const currentEncoder = forRenderPass ? this._currentRenderPass : this._renderEncoder;\r\n\r\n for (const groupName of debugStack) {\r\n if (this._showGPUDebugMarkersLog) {\r\n Logger.Log(\r\n `[${this.frameId}] Re-pushing debug group '${groupName}' on ${forRenderPass ? \"current render pass '\" + this._currentRenderPass?.label + \"'\" : \"render encoder '\" + this._renderEncoder.label + \"'\"} after starting a new ${forRenderPass ? \"render pass\" : \"render encoder\"}`\r\n );\r\n }\r\n currentEncoder!.pushDebugGroup(groupName);\r\n }\r\n }\r\n}\r\n"]}
@@ -222,6 +222,7 @@ export declare class WebGPUEngine extends ThinWebGPUEngine {
222
222
  private _dummyIndexBuffer;
223
223
  private _colorWriteLocal;
224
224
  private _forceEnableEffect;
225
+ private _internalFrameCounter;
225
226
  /**
226
227
  * Gets or sets the snapshot rendering mode
227
228
  */
@@ -18,7 +18,6 @@ import { WebGPUTextureManager } from "./WebGPU/webgpuTextureManager.js";
18
18
  import { AbstractEngine } from "./abstractEngine.js";
19
19
  import { WebGPUBufferManager } from "./WebGPU/webgpuBufferManager.js";
20
20
  import { WebGPUHardwareTexture } from "./WebGPU/webgpuHardwareTexture.js";
21
- import { UniformBuffer } from "../Materials/uniformBuffer.js";
22
21
  import { WebGPUCacheSampler } from "./WebGPU/webgpuCacheSampler.js";
23
22
  import { WebGPUCacheRenderPipelineTree } from "./WebGPU/webgpuCacheRenderPipelineTree.js";
24
23
  import { WebGPUStencilStateComposer } from "./WebGPU/webgpuStencilStateComposer.js";
@@ -328,6 +327,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
328
327
  this._currentIndexBuffer = null;
329
328
  this._colorWriteLocal = true;
330
329
  this._forceEnableEffect = false;
330
+ this._internalFrameCounter = 0;
331
331
  /**
332
332
  * Indicates if the z range in NDC space is 0..1 (value: true) or -1..1 (value: false)
333
333
  */
@@ -507,12 +507,9 @@ export class WebGPUEngine extends ThinWebGPUEngine {
507
507
  this._snapshotRendering = new WebGPUSnapshotRendering(this, this._snapshotRenderingMode, this._bundleList);
508
508
  this._ubInvertY = this._bufferManager.createBuffer(new Float32Array([-1, 0]), WebGPUConstants.BufferUsage.Uniform | WebGPUConstants.BufferUsage.CopyDst, "UBInvertY");
509
509
  this._ubDontInvertY = this._bufferManager.createBuffer(new Float32Array([1, 0]), WebGPUConstants.BufferUsage.Uniform | WebGPUConstants.BufferUsage.CopyDst, "UBDontInvertY");
510
- if (this.dbgVerboseLogsForFirstFrames) {
511
- if (this._count === undefined) {
512
- this._count = 0;
513
- Logger.Log(["%c frame #" + this._count + " - begin", "background: #ffff00"]);
514
- }
515
- }
510
+ const frameCounter = this._internalFrameCounter++;
511
+ this._uploadEncoderDescriptor.label = `[${this.frameId}|${frameCounter}] - UploadEncoder`;
512
+ this._renderEncoderDescriptor.label = `[${this.frameId}|${frameCounter}] - RenderEncoder`;
516
513
  this._uploadEncoder = this._device.createCommandEncoder(this._uploadEncoderDescriptor);
517
514
  this._renderEncoder = this._device.createCommandEncoder(this._renderEncoderDescriptor);
518
515
  this._emptyVertexBuffer = new VertexBuffer(this, [0], "", {
@@ -656,7 +653,6 @@ export class WebGPUEngine extends ThinWebGPUEngine {
656
653
  supportSpriteInstancing: true,
657
654
  forceVertexBufferStrideAndOffsetMultiple4Bytes: true,
658
655
  _checkNonFloatVertexBuffersDontRecreatePipelineContext: true,
659
- _collectUbosUpdatedInFrame: false,
660
656
  };
661
657
  this._alphaState = new AlphaState(this._caps.blendParametersPerTarget);
662
658
  }
@@ -757,8 +753,9 @@ export class WebGPUEngine extends ThinWebGPUEngine {
757
753
  stencilLoadOp: !this.isStencilEnable ? undefined : "clear" /* WebGPUConstants.LoadOp.Clear */,
758
754
  stencilStoreOp: !this.isStencilEnable ? undefined : "store" /* WebGPUConstants.StoreOp.Store */,
759
755
  };
756
+ const frameCounter = this._internalFrameCounter++;
760
757
  this._mainRenderPassWrapper.renderPassDescriptor = {
761
- label: "MainRenderPass",
758
+ label: `[${this.frameId}|${frameCounter}] - MainRenderPass`,
762
759
  colorAttachments: mainColorAttachments,
763
760
  depthStencilAttachment: mainDepthAttachment,
764
761
  };
@@ -902,14 +899,6 @@ export class WebGPUEngine extends ThinWebGPUEngine {
902
899
  if (!super.setSize(width, height, forceSetSize)) {
903
900
  return false;
904
901
  }
905
- if (this.dbgVerboseLogsForFirstFrames) {
906
- if (this._count === undefined) {
907
- this._count = 0;
908
- }
909
- if (!this._count || this._count < this.dbgVerboseLogsNumFrames) {
910
- Logger.Log(["frame #" + this._count + " - setSize -", width, height]);
911
- }
912
- }
913
902
  this._initializeMainAttachments();
914
903
  if (this.snapshotRendering) {
915
904
  // reset snapshot rendering so that the next frame will record a new list of bundles
@@ -1023,21 +1012,6 @@ export class WebGPUEngine extends ThinWebGPUEngine {
1023
1012
  else {
1024
1013
  this._getCurrentRenderPass().setViewport(x, y, w, h, 0, 1);
1025
1014
  }
1026
- if (this.dbgVerboseLogsForFirstFrames) {
1027
- if (this._count === undefined) {
1028
- this._count = 0;
1029
- }
1030
- if (!this._count || this._count < this.dbgVerboseLogsNumFrames) {
1031
- Logger.Log([
1032
- "frame #" + this._count + " - viewport applied - (",
1033
- this._viewportCached.x,
1034
- this._viewportCached.y,
1035
- this._viewportCached.z,
1036
- this._viewportCached.w,
1037
- ") current pass is main pass=" + this._currentPassIsMainPass(),
1038
- ]);
1039
- }
1040
- }
1041
1015
  }
1042
1016
  /**
1043
1017
  * @internal
@@ -1067,21 +1041,6 @@ export class WebGPUEngine extends ThinWebGPUEngine {
1067
1041
  else {
1068
1042
  this._getCurrentRenderPass().setScissorRect(this._scissorCached.x, y, this._scissorCached.z, this._scissorCached.w);
1069
1043
  }
1070
- if (this.dbgVerboseLogsForFirstFrames) {
1071
- if (this._count === undefined) {
1072
- this._count = 0;
1073
- }
1074
- if (!this._count || this._count < this.dbgVerboseLogsNumFrames) {
1075
- Logger.Log([
1076
- "frame #" + this._count + " - scissor applied - (",
1077
- this._scissorCached.x,
1078
- this._scissorCached.y,
1079
- this._scissorCached.z,
1080
- this._scissorCached.w,
1081
- ") current pass is main pass=" + this._currentPassIsMainPass(),
1082
- ]);
1083
- }
1084
- }
1085
1044
  }
1086
1045
  _scissorIsActive() {
1087
1046
  return this._scissorCached.x !== 0 || this._scissorCached.y !== 0 || this._scissorCached.z !== 0 || this._scissorCached.w !== 0;
@@ -1156,14 +1115,6 @@ export class WebGPUEngine extends ThinWebGPUEngine {
1156
1115
  this._clearStencilValue = stencilClearValue;
1157
1116
  }
1158
1117
  const hasScissor = this._scissorIsActive();
1159
- if (this.dbgVerboseLogsForFirstFrames) {
1160
- if (this._count === undefined) {
1161
- this._count = 0;
1162
- }
1163
- if (!this._count || this._count < this.dbgVerboseLogsNumFrames) {
1164
- Logger.Log(["frame #" + this._count + " - clear - backBuffer=", backBuffer, " depth=", depth, " stencil=", stencil, " scissor is active=", hasScissor]);
1165
- }
1166
- }
1167
1118
  // We need to recreate the render pass so that the new parameters for clear color / depth / stencil are taken into account
1168
1119
  if (this._currentRenderTarget) {
1169
1120
  if (hasScissor) {
@@ -2138,16 +2089,6 @@ export class WebGPUEngine extends ThinWebGPUEngine {
2138
2089
  }
2139
2090
  this._setInternalTexture(name, internalTexture, baseName);
2140
2091
  }
2141
- else {
2142
- if (this.dbgVerboseLogsForFirstFrames) {
2143
- if (this._count === undefined) {
2144
- this._count = 0;
2145
- }
2146
- if (!this._count || this._count < this.dbgVerboseLogsNumFrames) {
2147
- Logger.Log(["frame #" + this._count + " - _setTexture called with a null _currentEffect! texture=", texture]);
2148
- }
2149
- }
2150
- }
2151
2092
  return true;
2152
2093
  }
2153
2094
  /**
@@ -2307,24 +2248,10 @@ export class WebGPUEngine extends ThinWebGPUEngine {
2307
2248
  this._snapshotRendering.endFrame();
2308
2249
  this._timestampQuery.endFrame(this._renderEncoder);
2309
2250
  this._timestampIndex = 0;
2251
+ this._internalFrameCounter = 0;
2310
2252
  this.flushFramebuffer();
2311
2253
  this._textureHelper.destroyDeferredTextures();
2312
2254
  this._bufferManager.destroyDeferredBuffers();
2313
- if (this._features._collectUbosUpdatedInFrame) {
2314
- if (this.dbgVerboseLogsForFirstFrames) {
2315
- if (this._count === undefined) {
2316
- this._count = 0;
2317
- }
2318
- if (!this._count || this._count < this.dbgVerboseLogsNumFrames) {
2319
- const list = [];
2320
- for (const name in UniformBuffer._UpdatedUbosInFrame) {
2321
- list.push(name + ":" + UniformBuffer._UpdatedUbosInFrame[name]);
2322
- }
2323
- Logger.Log(["frame #" + this._count + " - updated ubos -", list.join(", ")]);
2324
- }
2325
- }
2326
- UniformBuffer._UpdatedUbosInFrame = {};
2327
- }
2328
2255
  this.countersLastFrame.numEnableEffects = this._counters.numEnableEffects;
2329
2256
  this.countersLastFrame.numEnableDrawWrapper = this._counters.numEnableDrawWrapper;
2330
2257
  this.countersLastFrame.numBundleCreationNonCompatMode = this._counters.numBundleCreationNonCompatMode;
@@ -2335,20 +2262,6 @@ export class WebGPUEngine extends ThinWebGPUEngine {
2335
2262
  this._counters.numBundleReuseNonCompatMode = 0;
2336
2263
  this._cacheRenderPipeline.endFrame();
2337
2264
  this._cacheBindGroups.endFrame();
2338
- if (this.dbgVerboseLogsForFirstFrames) {
2339
- if (this._count === undefined) {
2340
- this._count = 0;
2341
- }
2342
- if (this._count < this.dbgVerboseLogsNumFrames) {
2343
- Logger.Log(["%c frame #" + this._count + " - end", "background: #ffff00"]);
2344
- }
2345
- if (this._count < this.dbgVerboseLogsNumFrames) {
2346
- this._count++;
2347
- if (this._count !== this.dbgVerboseLogsNumFrames) {
2348
- Logger.Log(["%c frame #" + this._count + " - begin", "background: #ffff00"]);
2349
- }
2350
- }
2351
- }
2352
2265
  super.endFrame();
2353
2266
  }
2354
2267
  /**Gets driver info if available */
@@ -2361,11 +2274,22 @@ export class WebGPUEngine extends ThinWebGPUEngine {
2361
2274
  flushFramebuffer() {
2362
2275
  // we need to end the current render pass (main or rtt) if any as we are not allowed to submit the command buffers when being in a pass
2363
2276
  this._endCurrentRenderPass();
2277
+ if (this._debugStackRenderEncoder.length !== 0) {
2278
+ // We have pushed debug groups without popping them, we need to pop them before ending the render encoder to avoid WebGPU validation errors
2279
+ // We will re-push them after creating the new render encoder
2280
+ for (let i = 0; i < this._debugStackRenderEncoder.length; ++i) {
2281
+ this._renderEncoder.popDebugGroup();
2282
+ }
2283
+ }
2364
2284
  this._commandBuffers[0] = this._uploadEncoder.finish();
2365
2285
  this._commandBuffers[1] = this._renderEncoder.finish();
2366
2286
  this._device.queue.submit(this._commandBuffers);
2287
+ const frameCounter = this._internalFrameCounter++;
2288
+ this._uploadEncoderDescriptor.label = `[${this.frameId}|${frameCounter}] - UploadEncoder`;
2289
+ this._renderEncoderDescriptor.label = `[${this.frameId}|${frameCounter}] - RenderEncoder`;
2367
2290
  this._uploadEncoder = this._device.createCommandEncoder(this._uploadEncoderDescriptor);
2368
2291
  this._renderEncoder = this._device.createCommandEncoder(this._renderEncoderDescriptor);
2292
+ this._debugPushPendingGroups(false);
2369
2293
  this._timestampQuery.startFrame(this._uploadEncoder);
2370
2294
  this._textureHelper.setCommandEncoder(this._uploadEncoder);
2371
2295
  this._bundleList.reset();
@@ -2488,8 +2412,9 @@ export class WebGPUEngine extends ThinWebGPUEngine {
2488
2412
  colorAttachments.push(null);
2489
2413
  }
2490
2414
  }
2415
+ const frameCounter = this._internalFrameCounter++;
2491
2416
  this._rttRenderPassWrapper.renderPassDescriptor = {
2492
- label: (renderTargetWrapper.label ?? "RTT") + " - RenderPass",
2417
+ label: `[${this.frameId}|${frameCounter}] - ` + (renderTargetWrapper.label ?? "RTT") + " - RenderPass",
2493
2418
  colorAttachments,
2494
2419
  depthStencilAttachment: depthStencilTexture && gpuDepthStencilTexture
2495
2420
  ? {
@@ -2512,30 +2437,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
2512
2437
  };
2513
2438
  this._timestampQuery.startPass(this._rttRenderPassWrapper.renderPassDescriptor, this._timestampIndex);
2514
2439
  this._currentRenderPass = this._renderEncoder.beginRenderPass(this._rttRenderPassWrapper.renderPassDescriptor);
2515
- if (this.dbgVerboseLogsForFirstFrames) {
2516
- if (this._count === undefined) {
2517
- this._count = 0;
2518
- }
2519
- if (!this._count || this._count < this.dbgVerboseLogsNumFrames) {
2520
- const internalTexture = rtWrapper.texture;
2521
- Logger.Log([
2522
- "frame #" +
2523
- this._count +
2524
- " - render target begin pass - rtt name=" +
2525
- renderTargetWrapper.label +
2526
- ", internalTexture.uniqueId=" +
2527
- internalTexture.uniqueId +
2528
- ", width=" +
2529
- internalTexture.width +
2530
- ", height=" +
2531
- internalTexture.height +
2532
- ", setClearStates=" +
2533
- setClearStates,
2534
- "renderPassDescriptor=",
2535
- this._rttRenderPassWrapper.renderPassDescriptor,
2536
- ]);
2537
- }
2538
- }
2440
+ this._debugPushPendingGroups(true);
2539
2441
  this._resetRenderPassStates();
2540
2442
  if (!gpuDepthStencilWrapper || !WebGPUTextureHelper.HasStencilAspect(gpuDepthStencilWrapper.format)) {
2541
2443
  this._stencilStateComposer.enabled = false;
@@ -2549,6 +2451,8 @@ export class WebGPUEngine extends ThinWebGPUEngine {
2549
2451
  const mustClearColor = setClearStates && clearColor;
2550
2452
  const mustClearDepth = setClearStates && clearDepth;
2551
2453
  const mustClearStencil = setClearStates && clearStencil;
2454
+ const frameCounter = this._internalFrameCounter++;
2455
+ this._mainRenderPassWrapper.renderPassDescriptor.label = `[${this.frameId}|${frameCounter}] - MainRenderPass`;
2552
2456
  this._mainRenderPassWrapper.renderPassDescriptor.colorAttachments[0].clearValue = mustClearColor ? clearColor : undefined;
2553
2457
  this._mainRenderPassWrapper.renderPassDescriptor.colorAttachments[0].loadOp = mustClearColor ? "clear" /* WebGPUConstants.LoadOp.Clear */ : "load" /* WebGPUConstants.LoadOp.Load */;
2554
2458
  this._mainRenderPassWrapper.renderPassDescriptor.depthStencilAttachment.depthClearValue = mustClearDepth
@@ -2575,21 +2479,9 @@ export class WebGPUEngine extends ThinWebGPUEngine {
2575
2479
  ViewDescriptorSwapChain.format = swapChainTexture.format;
2576
2480
  this._mainRenderPassWrapper.renderPassDescriptor.colorAttachments[0].view = swapChainTexture.createView(ViewDescriptorSwapChain);
2577
2481
  }
2578
- if (this.dbgVerboseLogsForFirstFrames) {
2579
- if (this._count === undefined) {
2580
- this._count = 0;
2581
- }
2582
- if (!this._count || this._count < this.dbgVerboseLogsNumFrames) {
2583
- Logger.Log([
2584
- "frame #" + this._count + " - main begin pass - texture width=" + this._mainTextureExtends.width,
2585
- " height=" + this._mainTextureExtends.height + ", setClearStates=" + setClearStates,
2586
- "renderPassDescriptor=",
2587
- this._mainRenderPassWrapper.renderPassDescriptor,
2588
- ]);
2589
- }
2590
- }
2591
2482
  this._timestampQuery.startPass(this._mainRenderPassWrapper.renderPassDescriptor, this._timestampIndex);
2592
2483
  this._currentRenderPass = this._renderEncoder.beginRenderPass(this._mainRenderPassWrapper.renderPassDescriptor);
2484
+ this._debugPushPendingGroups(true);
2593
2485
  this._setDepthTextureFormat(this._mainRenderPassWrapper);
2594
2486
  this._setColorFormat(this._mainRenderPassWrapper);
2595
2487
  this._resetRenderPassStates();
@@ -2641,31 +2533,6 @@ export class WebGPUEngine extends ThinWebGPUEngine {
2641
2533
  arrayLayerCount: 1,
2642
2534
  aspect: "all" /* WebGPUConstants.TextureAspect.All */,
2643
2535
  };
2644
- if (this.dbgVerboseLogsForFirstFrames) {
2645
- if (this._count === undefined) {
2646
- this._count = 0;
2647
- }
2648
- if (!this._count || this._count < this.dbgVerboseLogsNumFrames) {
2649
- Logger.Log([
2650
- "frame #" +
2651
- this._count +
2652
- " - bindFramebuffer - rtt name=" +
2653
- texture.label +
2654
- ", internalTexture.uniqueId=" +
2655
- texture.texture?.uniqueId +
2656
- ", face=" +
2657
- faceIndex +
2658
- ", lodLevel=" +
2659
- lodLevel +
2660
- ", layer=" +
2661
- layer,
2662
- "colorAttachmentViewDescriptor=",
2663
- this._rttRenderPassWrapper.colorAttachmentViewDescriptor,
2664
- "depthAttachmentViewDescriptor=",
2665
- this._rttRenderPassWrapper.depthAttachmentViewDescriptor,
2666
- ]);
2667
- }
2668
- }
2669
2536
  // We don't create the render pass just now, we do a lazy creation of the render pass, hoping the render pass will be created by a call to clear()...
2670
2537
  // However, if snapshot rendering is enabled, we need to create the render pass immediately, to be sure currentRenderPass is not null when _endCurrentRenderPass() is called.
2671
2538
  // (as in snapshot rendering mode, we may not have a call to clear() before _endCurrentRenderPass(), so lazy creation would not work)
@@ -2708,14 +2575,6 @@ export class WebGPUEngine extends ThinWebGPUEngine {
2708
2575
  this._endCurrentRenderPass();
2709
2576
  this._resolveAndGenerateMipMapsFramebuffer(texture, disableGenerateMipMaps);
2710
2577
  this._currentRenderTarget = null;
2711
- if (this.dbgVerboseLogsForFirstFrames) {
2712
- if (this._count === undefined) {
2713
- this._count = 0;
2714
- }
2715
- if (!this._count || this._count < this.dbgVerboseLogsNumFrames) {
2716
- Logger.Log("frame #" + this._count + " - unBindFramebuffer - rtt name=" + texture.label + ", internalTexture.uniqueId=", texture.texture?.uniqueId);
2717
- }
2718
- }
2719
2578
  this._mrtAttachments = [];
2720
2579
  this._cacheRenderPipeline.setMRT([]);
2721
2580
  this._cacheRenderPipeline.setMRTAttachments(this._mrtAttachments);