@babylonjs/core 6.29.0 → 6.29.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Actions/abstractActionManager.js +1 -1
- package/Actions/abstractActionManager.js.map +1 -1
- package/Actions/actionManager.js +3 -3
- package/Actions/actionManager.js.map +1 -1
- package/Animations/animatable.js +1 -1
- package/Animations/animatable.js.map +1 -1
- package/Animations/animation.js +2 -2
- package/Animations/animation.js.map +1 -1
- package/Animations/pathCursor.js +1 -1
- package/Animations/pathCursor.js.map +1 -1
- package/Audio/audioSceneComponent.js +2 -2
- package/Audio/audioSceneComponent.js.map +1 -1
- package/Audio/soundTrack.js +1 -1
- package/Audio/soundTrack.js.map +1 -1
- package/Behaviors/Meshes/fadeInOutBehavior.js +1 -2
- package/Behaviors/Meshes/fadeInOutBehavior.js.map +1 -1
- package/Bones/bone.js +2 -2
- package/Bones/bone.js.map +1 -1
- package/Bones/skeleton.js +2 -2
- package/Bones/skeleton.js.map +1 -1
- package/Cameras/arcRotateCamera.js +13 -37
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Cameras/camera.d.ts +0 -21
- package/Cameras/camera.js +1 -36
- package/Cameras/camera.js.map +1 -1
- package/Cameras/targetCamera.js +30 -51
- package/Cameras/targetCamera.js.map +1 -1
- package/Culling/Octrees/octree.js +1 -1
- package/Culling/Octrees/octree.js.map +1 -1
- package/Culling/Octrees/octreeBlock.js +1 -1
- package/Culling/Octrees/octreeBlock.js.map +1 -1
- package/Culling/ray.js +1 -1
- package/Culling/ray.js.map +1 -1
- package/Debug/axesViewer.d.ts +3 -1
- package/Debug/axesViewer.js +14 -11
- package/Debug/axesViewer.js.map +1 -1
- package/Engines/Extensions/engine.multiRender.js +8 -8
- package/Engines/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/Extensions/engine.textureSelector.js +1 -1
- package/Engines/Extensions/engine.textureSelector.js.map +1 -1
- package/Engines/Processors/shaderCodeInliner.js +1 -1
- package/Engines/Processors/shaderCodeInliner.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.computeShader.js +2 -10
- package/Engines/WebGPU/Extensions/engine.computeShader.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.debugging.js +3 -6
- package/Engines/WebGPU/Extensions/engine.debugging.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.dynamicTexture.js +1 -1
- package/Engines/WebGPU/Extensions/engine.dynamicTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.js +9 -14
- package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.query.js +2 -6
- package/Engines/WebGPU/Extensions/engine.query.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js +6 -10
- package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.storageBuffer.js +1 -1
- package/Engines/WebGPU/Extensions/engine.storageBuffer.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.videoTexture.js +2 -2
- package/Engines/WebGPU/Extensions/engine.videoTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuBundleList.js +2 -1
- package/Engines/WebGPU/webgpuBundleList.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheBindGroups.js +1 -1
- package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.d.ts +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +4 -7
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipelineTree.d.ts +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipelineTree.js +2 -2
- package/Engines/WebGPU/webgpuCacheRenderPipelineTree.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheSampler.d.ts +1 -1
- package/Engines/WebGPU/webgpuCacheSampler.js +5 -5
- package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
- package/Engines/WebGPU/webgpuClearQuad.js +2 -2
- package/Engines/WebGPU/webgpuClearQuad.js.map +1 -1
- package/Engines/WebGPU/webgpuHardwareTexture.d.ts +0 -12
- package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuMaterialContext.d.ts +3 -3
- package/Engines/WebGPU/webgpuMaterialContext.js +14 -10
- package/Engines/WebGPU/webgpuMaterialContext.js.map +1 -1
- package/Engines/WebGPU/webgpuOcclusionQuery.js +1 -12
- package/Engines/WebGPU/webgpuOcclusionQuery.js.map +1 -1
- package/Engines/WebGPU/webgpuSnapshotRendering.d.ts +5 -8
- package/Engines/WebGPU/webgpuSnapshotRendering.js +24 -33
- package/Engines/WebGPU/webgpuSnapshotRendering.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.d.ts +2 -1
- package/Engines/WebGPU/webgpuTextureHelper.js +11 -16
- package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
- package/Engines/constants.d.ts +2 -2
- package/Engines/constants.js +2 -2
- package/Engines/constants.js.map +1 -1
- package/Engines/engine.js +2 -2
- package/Engines/engine.js.map +1 -1
- package/Engines/engineCapabilities.d.ts +2 -0
- package/Engines/engineCapabilities.js.map +1 -1
- package/Engines/engineStore.js +1 -1
- package/Engines/engineStore.js.map +1 -1
- package/Engines/nativeEngine.js +1 -0
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.js +1 -0
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/thinEngine.js +6 -2
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +27 -32
- package/Engines/webgpuEngine.js +237 -317
- package/Engines/webgpuEngine.js.map +1 -1
- package/Gizmos/boundingBoxGizmo.js +1 -1
- package/Gizmos/boundingBoxGizmo.js.map +1 -1
- package/Gizmos/cameraGizmo.d.ts +3 -1
- package/Gizmos/cameraGizmo.js +11 -8
- package/Gizmos/cameraGizmo.js.map +1 -1
- package/Layers/effectLayerSceneComponent.js +2 -2
- package/Layers/effectLayerSceneComponent.js.map +1 -1
- package/Layers/layerSceneComponent.js +1 -1
- package/Layers/layerSceneComponent.js.map +1 -1
- package/LensFlares/lensFlareSystem.js +1 -1
- package/LensFlares/lensFlareSystem.js.map +1 -1
- package/LensFlares/lensFlareSystemSceneComponent.js +2 -2
- package/LensFlares/lensFlareSystemSceneComponent.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +1 -1
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Lights/light.js +2 -2
- package/Lights/light.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js +1 -1
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Loading/sceneLoader.js +3 -3
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/GreasedLine/greasedLineMaterialDefaults.d.ts +2 -2
- package/Materials/GreasedLine/greasedLineMaterialDefaults.js.map +1 -1
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js +4 -1
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.js +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +1 -1
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js +2 -2
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.js +4 -4
- package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildStateSharedData.js +12 -12
- package/Materials/Node/nodeMaterialBuildStateSharedData.js.map +1 -1
- package/Materials/Textures/Procedurals/proceduralTextureSceneComponent.js +1 -1
- package/Materials/Textures/Procedurals/proceduralTextureSceneComponent.js.map +1 -1
- package/Materials/Textures/baseTexture.js +1 -1
- package/Materials/Textures/baseTexture.js.map +1 -1
- package/Materials/Textures/dynamicTexture.d.ts +4 -3
- package/Materials/Textures/dynamicTexture.js +10 -6
- package/Materials/Textures/dynamicTexture.js.map +1 -1
- package/Materials/Textures/externalTexture.d.ts +4 -0
- package/Materials/Textures/externalTexture.js +4 -0
- package/Materials/Textures/externalTexture.js.map +1 -1
- package/Materials/Textures/internalTexture.d.ts +0 -4
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.js +1 -1
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/textureSampler.d.ts +4 -0
- package/Materials/Textures/textureSampler.js.map +1 -1
- package/Materials/material.js +1 -1
- package/Materials/material.js.map +1 -1
- package/Materials/multiMaterial.js +1 -1
- package/Materials/multiMaterial.js.map +1 -1
- package/Materials/shaderMaterial.js +1 -1
- package/Materials/shaderMaterial.js.map +1 -1
- package/Maths/math.path.d.ts +9 -1
- package/Maths/math.path.js +23 -7
- package/Maths/math.path.js.map +1 -1
- package/Maths/math.vector.d.ts +93 -0
- package/Maths/math.vector.js +157 -26
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Builders/cylinderBuilder.js +5 -5
- package/Meshes/Builders/cylinderBuilder.js.map +1 -1
- package/Meshes/Builders/decalBuilder.js +1 -1
- package/Meshes/Builders/decalBuilder.js.map +1 -1
- package/Meshes/Builders/discBuilder.js +4 -4
- package/Meshes/Builders/discBuilder.js.map +1 -1
- package/Meshes/Builders/goldbergBuilder.js +4 -4
- package/Meshes/Builders/goldbergBuilder.js.map +1 -1
- package/Meshes/Builders/groundBuilder.js +4 -4
- package/Meshes/Builders/groundBuilder.js.map +1 -1
- package/Meshes/Builders/icoSphereBuilder.js +4 -4
- package/Meshes/Builders/icoSphereBuilder.js.map +1 -1
- package/Meshes/Builders/latheBuilder.js +1 -1
- package/Meshes/Builders/latheBuilder.js.map +1 -1
- package/Meshes/Builders/linesBuilder.js +2 -2
- package/Meshes/Builders/linesBuilder.js.map +1 -1
- package/Meshes/Builders/polyhedronBuilder.js +6 -6
- package/Meshes/Builders/polyhedronBuilder.js.map +1 -1
- package/Meshes/Builders/shapeBuilder.js +1 -1
- package/Meshes/Builders/shapeBuilder.js.map +1 -1
- package/Meshes/Builders/textBuilder.js +13 -5
- package/Meshes/Builders/textBuilder.js.map +1 -1
- package/Meshes/Builders/torusKnotBuilder.js +4 -4
- package/Meshes/Builders/torusKnotBuilder.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/boxBlock.js +1 -0
- package/Meshes/Node/Blocks/Sources/boxBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/capsuleBlock.js +1 -0
- package/Meshes/Node/Blocks/Sources/capsuleBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/cylinderBlock.js +1 -0
- package/Meshes/Node/Blocks/Sources/cylinderBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/discBlock.js +1 -0
- package/Meshes/Node/Blocks/Sources/discBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/gridBlock.js +1 -0
- package/Meshes/Node/Blocks/Sources/gridBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/icoSphereBlock.js +1 -0
- package/Meshes/Node/Blocks/Sources/icoSphereBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/planeBlock.js +1 -0
- package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/sphereBlock.js +1 -0
- package/Meshes/Node/Blocks/Sources/sphereBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/torusBlock.js +1 -0
- package/Meshes/Node/Blocks/Sources/torusBlock.js.map +1 -1
- package/Meshes/Node/nodeGeometry.js +1 -1
- package/Meshes/Node/nodeGeometry.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlock.js +1 -0
- package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.d.ts +14 -0
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +32 -5
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
- package/Meshes/abstractMesh.js +5 -5
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/csg.js +5 -5
- package/Meshes/csg.js.map +1 -1
- package/Meshes/geodesicMesh.js +1 -1
- package/Meshes/geodesicMesh.js.map +1 -1
- package/Meshes/mesh.js +14 -10
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/mesh.vertexData.js +1 -1
- package/Meshes/mesh.vertexData.js.map +1 -1
- package/Meshes/meshSimplification.js +2 -2
- package/Meshes/meshSimplification.js.map +1 -1
- package/Meshes/polygonMesh.js +7 -7
- package/Meshes/polygonMesh.js.map +1 -1
- package/Meshes/thinInstanceMesh.js +1 -1
- package/Meshes/thinInstanceMesh.js.map +1 -1
- package/Misc/codeStringParsingTools.d.ts +2 -1
- package/Misc/codeStringParsingTools.js +3 -2
- package/Misc/codeStringParsingTools.js.map +1 -1
- package/Misc/dds.js +1 -1
- package/Misc/dds.js.map +1 -1
- package/Misc/filesInput.js +1 -1
- package/Misc/filesInput.js.map +1 -1
- package/Misc/greasedLineTools.d.ts +2 -1
- package/Misc/greasedLineTools.js +2 -0
- package/Misc/greasedLineTools.js.map +1 -1
- package/Misc/precisionDate.js +4 -2
- package/Misc/precisionDate.js.map +1 -1
- package/Misc/sceneOptimizer.js +2 -2
- package/Misc/sceneOptimizer.js.map +1 -1
- package/Morph/morphTarget.js +1 -1
- package/Morph/morphTarget.js.map +1 -1
- package/Particles/gpuParticleSystem.js +1 -1
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/particleSystem.js +2 -2
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/particleSystemComponent.js +2 -2
- package/Particles/particleSystemComponent.js.map +1 -1
- package/Particles/particleSystemSet.js +1 -1
- package/Particles/particleSystemSet.js.map +1 -1
- package/Physics/v1/Plugins/cannonJSPlugin.js +2 -2
- package/Physics/v1/Plugins/cannonJSPlugin.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.js +3 -1
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/PostProcesses/postProcess.d.ts +1 -0
- package/PostProcesses/postProcess.js +30 -23
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.js +2 -2
- package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
- package/Probes/reflectionProbe.js +1 -1
- package/Probes/reflectionProbe.js.map +1 -1
- package/Rendering/edgesRenderer.js +3 -3
- package/Rendering/edgesRenderer.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.js +2 -1
- package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.js.map +1 -1
- package/Rendering/prePassRenderer.js +8 -4
- package/Rendering/prePassRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/hdrFilteringFunctions.js +2 -1
- package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
- package/Sprites/spriteManager.js +1 -1
- package/Sprites/spriteManager.js.map +1 -1
- package/Sprites/spriteMap.js +4 -4
- package/Sprites/spriteMap.js.map +1 -1
- package/Sprites/spriteSceneComponent.js +2 -2
- package/Sprites/spriteSceneComponent.js.map +1 -1
- package/XR/features/WebXRFeaturePointSystem.js +2 -2
- package/XR/features/WebXRFeaturePointSystem.js.map +1 -1
- package/abstractScene.js +16 -16
- package/abstractScene.js.map +1 -1
- package/assetContainer.js +2 -2
- package/assetContainer.js.map +1 -1
- package/node.js +2 -2
- package/node.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +0 -4
- package/scene.js +6 -12
- package/scene.js.map +1 -1
- package/Engines/WebGPU/webgpuRenderPassWrapper.d.ts +0 -13
- package/Engines/WebGPU/webgpuRenderPassWrapper.js +0 -18
- package/Engines/WebGPU/webgpuRenderPassWrapper.js.map +0 -1
package/Engines/webgpuEngine.js
CHANGED
|
@@ -15,7 +15,6 @@ import { WebGPUTextureHelper } from "./WebGPU/webgpuTextureHelper.js";
|
|
|
15
15
|
import { WebGPUBufferManager } from "./WebGPU/webgpuBufferManager.js";
|
|
16
16
|
import { WebGPUHardwareTexture } from "./WebGPU/webgpuHardwareTexture.js";
|
|
17
17
|
import { UniformBuffer } from "../Materials/uniformBuffer.js";
|
|
18
|
-
import { WebGPURenderPassWrapper } from "./WebGPU/webgpuRenderPassWrapper.js";
|
|
19
18
|
import { WebGPUCacheSampler } from "./WebGPU/webgpuCacheSampler.js";
|
|
20
19
|
import { WebGPUCacheRenderPipelineTree } from "./WebGPU/webgpuCacheRenderPipelineTree.js";
|
|
21
20
|
import { WebGPUStencilStateComposer } from "./WebGPU/webgpuStencilStateComposer.js";
|
|
@@ -28,7 +27,6 @@ import { WebGPUClearQuad } from "./WebGPU/webgpuClearQuad.js";
|
|
|
28
27
|
import { WebGPURenderItemBlendColor, WebGPURenderItemScissor, WebGPURenderItemStencilRef, WebGPURenderItemViewport, WebGPUBundleList } from "./WebGPU/webgpuBundleList.js";
|
|
29
28
|
import { WebGPUTimestampQuery } from "./WebGPU/webgpuTimestampQuery.js";
|
|
30
29
|
import { WebGPUOcclusionQuery } from "./WebGPU/webgpuOcclusionQuery.js";
|
|
31
|
-
import { Observable } from "../Misc/observable.js";
|
|
32
30
|
import { ShaderCodeInliner } from "./Processors/shaderCodeInliner.js";
|
|
33
31
|
import { WebGPUTintWASM } from "./WebGPU/webgpuTintWASM.js";
|
|
34
32
|
import { WebGPUShaderProcessor } from "./WebGPU/webgpuShaderProcessor.js";
|
|
@@ -217,7 +215,6 @@ export class WebGPUEngine extends Engine {
|
|
|
217
215
|
// Page Life cycle and constants
|
|
218
216
|
this._uploadEncoderDescriptor = { label: "upload" };
|
|
219
217
|
this._renderEncoderDescriptor = { label: "render" };
|
|
220
|
-
this._renderTargetEncoderDescriptor = { label: "renderTarget" };
|
|
221
218
|
/** @internal */
|
|
222
219
|
this._clearDepthValue = 1;
|
|
223
220
|
/** @internal */
|
|
@@ -255,18 +252,26 @@ export class WebGPUEngine extends Engine {
|
|
|
255
252
|
* Max number of uncaptured error messages to log
|
|
256
253
|
*/
|
|
257
254
|
this.numMaxUncapturedErrors = 20;
|
|
258
|
-
this._commandBuffers = [null, null
|
|
255
|
+
this._commandBuffers = [null, null];
|
|
259
256
|
// Frame Buffer Life Cycle (recreated for each render target pass)
|
|
260
257
|
/** @internal */
|
|
261
258
|
this._currentRenderPass = null;
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
259
|
+
this._mainRenderPassWrapper = {
|
|
260
|
+
renderPassDescriptor: null,
|
|
261
|
+
colorAttachmentViewDescriptor: null,
|
|
262
|
+
depthAttachmentViewDescriptor: null,
|
|
263
|
+
colorAttachmentGPUTextures: [],
|
|
264
|
+
depthTextureFormat: undefined,
|
|
265
|
+
};
|
|
266
|
+
this._rttRenderPassWrapper = {
|
|
267
|
+
renderPassDescriptor: null,
|
|
268
|
+
colorAttachmentViewDescriptor: null,
|
|
269
|
+
depthAttachmentViewDescriptor: null,
|
|
270
|
+
colorAttachmentGPUTextures: [],
|
|
271
|
+
depthTextureFormat: undefined,
|
|
272
|
+
};
|
|
266
273
|
/** @internal */
|
|
267
274
|
this._pendingDebugCommands = [];
|
|
268
|
-
/** @internal */
|
|
269
|
-
this._onAfterUnbindFrameBufferObservable = new Observable();
|
|
270
275
|
this._currentOverrideVertexBuffers = null;
|
|
271
276
|
this._currentIndexBuffer = null;
|
|
272
277
|
this._colorWriteLocal = true;
|
|
@@ -296,20 +301,11 @@ export class WebGPUEngine extends Engine {
|
|
|
296
301
|
// Dynamic WebGPU States
|
|
297
302
|
//------------------------------------------------------------------------------
|
|
298
303
|
// index 0 is for main render pass, 1 for RTT render pass
|
|
299
|
-
this._viewportsCurrent =
|
|
300
|
-
|
|
301
|
-
{ x: 0, y: 0, w: 0, h: 0 },
|
|
302
|
-
];
|
|
303
|
-
this._scissorsCurrent = [
|
|
304
|
-
{ x: 0, y: 0, w: 0, h: 0 },
|
|
305
|
-
{ x: 0, y: 0, w: 0, h: 0 },
|
|
306
|
-
];
|
|
304
|
+
this._viewportsCurrent = { x: 0, y: 0, w: 0, h: 0 };
|
|
305
|
+
this._scissorsCurrent = { x: 0, y: 0, w: 0, h: 0 };
|
|
307
306
|
this._scissorCached = { x: 0, y: 0, z: 0, w: 0 };
|
|
308
|
-
this._stencilRefsCurrent =
|
|
309
|
-
this._blendColorsCurrent = [
|
|
310
|
-
[null, null, null, null],
|
|
311
|
-
[null, null, null, null],
|
|
312
|
-
];
|
|
307
|
+
this._stencilRefsCurrent = -1;
|
|
308
|
+
this._blendColorsCurrent = [null, null, null, null];
|
|
313
309
|
this._name = "WebGPU";
|
|
314
310
|
options.deviceDescriptor = options.deviceDescriptor || {};
|
|
315
311
|
options.enableGPUDebugMarkers = (_b = options.enableGPUDebugMarkers) !== null && _b !== void 0 ? _b : false;
|
|
@@ -431,8 +427,7 @@ export class WebGPUEngine extends Engine {
|
|
|
431
427
|
this._timestampQuery = new WebGPUTimestampQuery(this._device, this._bufferManager);
|
|
432
428
|
this._occlusionQuery = this._device.createQuerySet ? new WebGPUOcclusionQuery(this, this._device, this._bufferManager) : undefined;
|
|
433
429
|
this._bundleList = new WebGPUBundleList(this._device);
|
|
434
|
-
this.
|
|
435
|
-
this._snapshotRendering = new WebGPUSnapshotRendering(this, this._snapshotRenderingMode, this._bundleList, this._bundleListRenderTarget);
|
|
430
|
+
this._snapshotRendering = new WebGPUSnapshotRendering(this, this._snapshotRenderingMode, this._bundleList);
|
|
436
431
|
this._ubInvertY = this._bufferManager.createBuffer(new Float32Array([-1, 0]), WebGPUConstants.BufferUsage.Uniform | WebGPUConstants.BufferUsage.CopyDst, "UBInvertY");
|
|
437
432
|
this._ubDontInvertY = this._bufferManager.createBuffer(new Float32Array([1, 0]), WebGPUConstants.BufferUsage.Uniform | WebGPUConstants.BufferUsage.CopyDst, "UBDontInvertY");
|
|
438
433
|
if (this.dbgVerboseLogsForFirstFrames) {
|
|
@@ -443,10 +438,9 @@ export class WebGPUEngine extends Engine {
|
|
|
443
438
|
}
|
|
444
439
|
this._uploadEncoder = this._device.createCommandEncoder(this._uploadEncoderDescriptor);
|
|
445
440
|
this._renderEncoder = this._device.createCommandEncoder(this._renderEncoderDescriptor);
|
|
446
|
-
this._renderTargetEncoder = this._device.createCommandEncoder(this._renderTargetEncoderDescriptor);
|
|
447
441
|
this._initializeLimits();
|
|
448
442
|
this._emptyVertexBuffer = new VertexBuffer(this, [0], "", false, false, 1, false, 0, 1);
|
|
449
|
-
this._cacheRenderPipeline = new WebGPUCacheRenderPipelineTree(this._device, this._emptyVertexBuffer
|
|
443
|
+
this._cacheRenderPipeline = new WebGPUCacheRenderPipelineTree(this._device, this._emptyVertexBuffer);
|
|
450
444
|
this._depthCullingState = new WebGPUDepthCullingState(this._cacheRenderPipeline);
|
|
451
445
|
this._stencilStateComposer = new WebGPUStencilStateComposer(this._cacheRenderPipeline);
|
|
452
446
|
this._stencilStateComposer.stencilGlobal = this._stencilState;
|
|
@@ -513,6 +507,7 @@ export class WebGPUEngine extends Engine {
|
|
|
513
507
|
fragmentDepthSupported: true,
|
|
514
508
|
highPrecisionShaderSupported: true,
|
|
515
509
|
colorBufferFloat: true,
|
|
510
|
+
supportFloatTexturesResolve: false,
|
|
516
511
|
textureFloat: true,
|
|
517
512
|
textureFloatLinearFiltering: this._deviceEnabledExtensions.indexOf(WebGPUConstants.FeatureName.Float32Filterable) >= 0,
|
|
518
513
|
textureFloatRender: true,
|
|
@@ -580,13 +575,14 @@ export class WebGPUEngine extends Engine {
|
|
|
580
575
|
this._colorFormat = this._options.swapChainFormat;
|
|
581
576
|
this._mainRenderPassWrapper.colorAttachmentGPUTextures = [new WebGPUHardwareTexture()];
|
|
582
577
|
this._mainRenderPassWrapper.colorAttachmentGPUTextures[0].format = this._colorFormat;
|
|
578
|
+
this._setColorFormat(this._mainRenderPassWrapper);
|
|
583
579
|
}
|
|
584
580
|
// Set default values as WebGL with depth and stencil attachment for the broadest Compat.
|
|
585
581
|
_initializeMainAttachments() {
|
|
586
582
|
if (!this._bufferManager) {
|
|
587
583
|
return;
|
|
588
584
|
}
|
|
589
|
-
this.flushFramebuffer(
|
|
585
|
+
this.flushFramebuffer();
|
|
590
586
|
this._mainTextureExtends = {
|
|
591
587
|
width: this.getRenderWidth(true),
|
|
592
588
|
height: this.getRenderHeight(true),
|
|
@@ -637,6 +633,7 @@ export class WebGPUEngine extends Engine {
|
|
|
637
633
|
}
|
|
638
634
|
this._mainRenderPassWrapper.depthTextureFormat = this.isStencilEnable ? WebGPUConstants.TextureFormat.Depth24PlusStencil8 : WebGPUConstants.TextureFormat.Depth32Float;
|
|
639
635
|
this._setDepthTextureFormat(this._mainRenderPassWrapper);
|
|
636
|
+
this._setColorFormat(this._mainRenderPassWrapper);
|
|
640
637
|
const depthTextureDescriptor = {
|
|
641
638
|
label: `Texture_MainDepthStencil_${this._mainTextureExtends.width}x${this._mainTextureExtends.height}`,
|
|
642
639
|
size: this._mainTextureExtends,
|
|
@@ -695,7 +692,7 @@ export class WebGPUEngine extends Engine {
|
|
|
695
692
|
this._count = 0;
|
|
696
693
|
}
|
|
697
694
|
if (!this._count || this._count < this.dbgVerboseLogsNumFrames) {
|
|
698
|
-
console.log("frame #" + this._count + " - setSize
|
|
695
|
+
console.log("frame #" + this._count + " - setSize -", width, height);
|
|
699
696
|
}
|
|
700
697
|
}
|
|
701
698
|
this._initializeMainAttachments();
|
|
@@ -720,6 +717,23 @@ export class WebGPUEngine extends Engine {
|
|
|
720
717
|
_getShaderProcessingContext(shaderLanguage) {
|
|
721
718
|
return new WebGPUShaderProcessingContext(shaderLanguage);
|
|
722
719
|
}
|
|
720
|
+
_currentPassIsMainPass() {
|
|
721
|
+
return this._currentRenderTarget === null;
|
|
722
|
+
}
|
|
723
|
+
_getCurrentRenderPass() {
|
|
724
|
+
if (this._currentRenderTarget && !this._currentRenderPass) {
|
|
725
|
+
// delayed creation of the render target pass, but we now need to create it as we are requested the render pass
|
|
726
|
+
this._startRenderTargetRenderPass(this._currentRenderTarget, false, null, false, false);
|
|
727
|
+
}
|
|
728
|
+
else if (!this._currentRenderPass) {
|
|
729
|
+
this._startMainRenderPass(false);
|
|
730
|
+
}
|
|
731
|
+
return this._currentRenderPass;
|
|
732
|
+
}
|
|
733
|
+
/** @internal */
|
|
734
|
+
_getCurrentRenderPassWrapper() {
|
|
735
|
+
return this._currentRenderTarget ? this._rttRenderPassWrapper : this._mainRenderPassWrapper;
|
|
736
|
+
}
|
|
723
737
|
//------------------------------------------------------------------------------
|
|
724
738
|
// Static Pipeline WebGPU States
|
|
725
739
|
//------------------------------------------------------------------------------
|
|
@@ -773,37 +787,37 @@ export class WebGPUEngine extends Engine {
|
|
|
773
787
|
getColorWrite() {
|
|
774
788
|
return this._colorWriteLocal;
|
|
775
789
|
}
|
|
776
|
-
|
|
777
|
-
this._viewportsCurrent[index].x = 0;
|
|
778
|
-
this._viewportsCurrent[index].y = 0;
|
|
779
|
-
this._viewportsCurrent[index].w = 0;
|
|
780
|
-
this._viewportsCurrent[index].h = 0;
|
|
781
|
-
}
|
|
782
|
-
_mustUpdateViewport(renderPass) {
|
|
783
|
-
const index = renderPass === this._mainRenderPassWrapper.renderPass ? 0 : 1;
|
|
790
|
+
_mustUpdateViewport() {
|
|
784
791
|
const x = this._viewportCached.x, y = this._viewportCached.y, w = this._viewportCached.z, h = this._viewportCached.w;
|
|
785
|
-
const update = this._viewportsCurrent
|
|
792
|
+
const update = this._viewportsCurrent.x !== x || this._viewportsCurrent.y !== y || this._viewportsCurrent.w !== w || this._viewportsCurrent.h !== h;
|
|
786
793
|
if (update) {
|
|
787
|
-
this._viewportsCurrent
|
|
788
|
-
this._viewportsCurrent
|
|
789
|
-
this._viewportsCurrent
|
|
790
|
-
this._viewportsCurrent
|
|
794
|
+
this._viewportsCurrent.x = this._viewportCached.x;
|
|
795
|
+
this._viewportsCurrent.y = this._viewportCached.y;
|
|
796
|
+
this._viewportsCurrent.w = this._viewportCached.z;
|
|
797
|
+
this._viewportsCurrent.h = this._viewportCached.w;
|
|
791
798
|
}
|
|
792
799
|
return update;
|
|
793
800
|
}
|
|
794
|
-
_applyViewport(
|
|
795
|
-
|
|
801
|
+
_applyViewport(bundleList) {
|
|
802
|
+
const x = Math.floor(this._viewportCached.x);
|
|
803
|
+
const w = Math.floor(this._viewportCached.z);
|
|
796
804
|
const h = Math.floor(this._viewportCached.w);
|
|
805
|
+
let y = Math.floor(this._viewportCached.y);
|
|
797
806
|
if (!this._currentRenderTarget) {
|
|
798
807
|
y = this.getRenderHeight(true) - y - h;
|
|
799
808
|
}
|
|
800
|
-
|
|
809
|
+
if (bundleList) {
|
|
810
|
+
bundleList.addItem(new WebGPURenderItemViewport(x, y, w, h));
|
|
811
|
+
}
|
|
812
|
+
else {
|
|
813
|
+
this._getCurrentRenderPass().setViewport(x, y, w, h, 0, 1);
|
|
814
|
+
}
|
|
801
815
|
if (this.dbgVerboseLogsForFirstFrames) {
|
|
802
816
|
if (this._count === undefined) {
|
|
803
817
|
this._count = 0;
|
|
804
818
|
}
|
|
805
819
|
if (!this._count || this._count < this.dbgVerboseLogsNumFrames) {
|
|
806
|
-
console.log("frame #" + this._count + " - viewport applied - (", this._viewportCached.x, this._viewportCached.y, this._viewportCached.z, this._viewportCached.w, ") current pass is main pass=" +
|
|
820
|
+
console.log("frame #" + this._count + " - viewport applied - (", this._viewportCached.x, this._viewportCached.y, this._viewportCached.z, this._viewportCached.w, ") current pass is main pass=" + this._currentPassIsMainPass());
|
|
807
821
|
}
|
|
808
822
|
}
|
|
809
823
|
}
|
|
@@ -816,32 +830,31 @@ export class WebGPUEngine extends Engine {
|
|
|
816
830
|
this._viewportCached.z = width;
|
|
817
831
|
this._viewportCached.w = height;
|
|
818
832
|
}
|
|
819
|
-
|
|
820
|
-
this._scissorsCurrent[index].x = 0;
|
|
821
|
-
this._scissorsCurrent[index].y = 0;
|
|
822
|
-
this._scissorsCurrent[index].w = 0;
|
|
823
|
-
this._scissorsCurrent[index].h = 0;
|
|
824
|
-
}
|
|
825
|
-
_mustUpdateScissor(renderPass) {
|
|
826
|
-
const index = renderPass === this._mainRenderPassWrapper.renderPass ? 0 : 1;
|
|
833
|
+
_mustUpdateScissor() {
|
|
827
834
|
const x = this._scissorCached.x, y = this._scissorCached.y, w = this._scissorCached.z, h = this._scissorCached.w;
|
|
828
|
-
const update = this._scissorsCurrent
|
|
835
|
+
const update = this._scissorsCurrent.x !== x || this._scissorsCurrent.y !== y || this._scissorsCurrent.w !== w || this._scissorsCurrent.h !== h;
|
|
829
836
|
if (update) {
|
|
830
|
-
this._scissorsCurrent
|
|
831
|
-
this._scissorsCurrent
|
|
832
|
-
this._scissorsCurrent
|
|
833
|
-
this._scissorsCurrent
|
|
837
|
+
this._scissorsCurrent.x = this._scissorCached.x;
|
|
838
|
+
this._scissorsCurrent.y = this._scissorCached.y;
|
|
839
|
+
this._scissorsCurrent.w = this._scissorCached.z;
|
|
840
|
+
this._scissorsCurrent.h = this._scissorCached.w;
|
|
834
841
|
}
|
|
835
842
|
return update;
|
|
836
843
|
}
|
|
837
|
-
_applyScissor(
|
|
838
|
-
|
|
844
|
+
_applyScissor(bundleList) {
|
|
845
|
+
const y = this._currentRenderTarget ? this._scissorCached.y : this.getRenderHeight() - this._scissorCached.w - this._scissorCached.y;
|
|
846
|
+
if (bundleList) {
|
|
847
|
+
bundleList.addItem(new WebGPURenderItemScissor(this._scissorCached.x, y, this._scissorCached.z, this._scissorCached.w));
|
|
848
|
+
}
|
|
849
|
+
else {
|
|
850
|
+
this._getCurrentRenderPass().setScissorRect(this._scissorCached.x, y, this._scissorCached.z, this._scissorCached.w);
|
|
851
|
+
}
|
|
839
852
|
if (this.dbgVerboseLogsForFirstFrames) {
|
|
840
853
|
if (this._count === undefined) {
|
|
841
854
|
this._count = 0;
|
|
842
855
|
}
|
|
843
856
|
if (!this._count || this._count < this.dbgVerboseLogsNumFrames) {
|
|
844
|
-
console.log("frame #" + this._count + " - scissor applied - (", this._scissorCached.x, this._scissorCached.y, this._scissorCached.z, this._scissorCached.w, ") current pass is main pass=" +
|
|
857
|
+
console.log("frame #" + this._count + " - scissor applied - (", this._scissorCached.x, this._scissorCached.y, this._scissorCached.z, this._scissorCached.w, ") current pass is main pass=" + this._currentPassIsMainPass());
|
|
845
858
|
}
|
|
846
859
|
}
|
|
847
860
|
}
|
|
@@ -855,51 +868,52 @@ export class WebGPUEngine extends Engine {
|
|
|
855
868
|
this._scissorCached.w = height;
|
|
856
869
|
}
|
|
857
870
|
disableScissor() {
|
|
858
|
-
this._scissorCached.x = 0;
|
|
859
|
-
this.
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
this.
|
|
863
|
-
this._resetCurrentScissor(1);
|
|
864
|
-
}
|
|
865
|
-
_resetCurrentStencilRef(index) {
|
|
866
|
-
this._stencilRefsCurrent[index] = -1;
|
|
867
|
-
}
|
|
868
|
-
_mustUpdateStencilRef(renderPass) {
|
|
869
|
-
const index = renderPass === this._mainRenderPassWrapper.renderPass ? 0 : 1;
|
|
870
|
-
const update = this._stencilStateComposer.funcRef !== this._stencilRefsCurrent[index];
|
|
871
|
+
this._scissorCached.x = this._scissorCached.y = this._scissorCached.z = this._scissorCached.w = 0;
|
|
872
|
+
this._scissorsCurrent.x = this._scissorsCurrent.y = this._scissorsCurrent.w = this._scissorsCurrent.h = 0;
|
|
873
|
+
}
|
|
874
|
+
_mustUpdateStencilRef() {
|
|
875
|
+
const update = this._stencilStateComposer.funcRef !== this._stencilRefsCurrent;
|
|
871
876
|
if (update) {
|
|
872
|
-
this._stencilRefsCurrent
|
|
877
|
+
this._stencilRefsCurrent = this._stencilStateComposer.funcRef;
|
|
873
878
|
}
|
|
874
879
|
return update;
|
|
875
880
|
}
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
this._blendColorsCurrent[index][0] = this._blendColorsCurrent[index][1] = this._blendColorsCurrent[index][2] = this._blendColorsCurrent[index][3] = null;
|
|
881
|
+
_applyStencilRef(bundleList) {
|
|
882
|
+
var _a, _b;
|
|
883
|
+
if (bundleList) {
|
|
884
|
+
bundleList.addItem(new WebGPURenderItemStencilRef((_a = this._stencilStateComposer.funcRef) !== null && _a !== void 0 ? _a : 0));
|
|
885
|
+
}
|
|
886
|
+
else {
|
|
887
|
+
this._getCurrentRenderPass().setStencilReference((_b = this._stencilStateComposer.funcRef) !== null && _b !== void 0 ? _b : 0);
|
|
888
|
+
}
|
|
885
889
|
}
|
|
886
|
-
_mustUpdateBlendColor(
|
|
887
|
-
const index = renderPass === this._mainRenderPassWrapper.renderPass ? 0 : 1;
|
|
890
|
+
_mustUpdateBlendColor() {
|
|
888
891
|
const colorBlend = this._alphaState._blendConstants;
|
|
889
|
-
const update = colorBlend[0] !== this._blendColorsCurrent[
|
|
890
|
-
colorBlend[1] !== this._blendColorsCurrent[
|
|
891
|
-
colorBlend[2] !== this._blendColorsCurrent[
|
|
892
|
-
colorBlend[3] !== this._blendColorsCurrent[
|
|
892
|
+
const update = colorBlend[0] !== this._blendColorsCurrent[0] ||
|
|
893
|
+
colorBlend[1] !== this._blendColorsCurrent[1] ||
|
|
894
|
+
colorBlend[2] !== this._blendColorsCurrent[2] ||
|
|
895
|
+
colorBlend[3] !== this._blendColorsCurrent[3];
|
|
893
896
|
if (update) {
|
|
894
|
-
this._blendColorsCurrent[
|
|
895
|
-
this._blendColorsCurrent[
|
|
896
|
-
this._blendColorsCurrent[
|
|
897
|
-
this._blendColorsCurrent[
|
|
897
|
+
this._blendColorsCurrent[0] = colorBlend[0];
|
|
898
|
+
this._blendColorsCurrent[1] = colorBlend[1];
|
|
899
|
+
this._blendColorsCurrent[2] = colorBlend[2];
|
|
900
|
+
this._blendColorsCurrent[3] = colorBlend[3];
|
|
898
901
|
}
|
|
899
902
|
return update;
|
|
900
903
|
}
|
|
901
|
-
_applyBlendColor(
|
|
902
|
-
|
|
904
|
+
_applyBlendColor(bundleList) {
|
|
905
|
+
if (bundleList) {
|
|
906
|
+
bundleList.addItem(new WebGPURenderItemBlendColor(this._alphaState._blendConstants.slice()));
|
|
907
|
+
}
|
|
908
|
+
else {
|
|
909
|
+
this._getCurrentRenderPass().setBlendConstant(this._alphaState._blendConstants);
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
_resetRenderPassStates() {
|
|
913
|
+
this._viewportsCurrent.x = this._viewportsCurrent.y = this._viewportsCurrent.w = this._viewportsCurrent.h = 0;
|
|
914
|
+
this._scissorsCurrent.x = this._scissorsCurrent.y = this._scissorsCurrent.w = this._scissorsCurrent.h = 0;
|
|
915
|
+
this._stencilRefsCurrent = -1;
|
|
916
|
+
this._blendColorsCurrent[0] = this._blendColorsCurrent[1] = this._blendColorsCurrent[2] = this._blendColorsCurrent[3] = null;
|
|
903
917
|
}
|
|
904
918
|
/**
|
|
905
919
|
* Clear the current render buffer or the current render target (if any is set up)
|
|
@@ -919,67 +933,55 @@ export class WebGPUEngine extends Engine {
|
|
|
919
933
|
this._count = 0;
|
|
920
934
|
}
|
|
921
935
|
if (!this._count || this._count < this.dbgVerboseLogsNumFrames) {
|
|
922
|
-
console.log("frame #" + this._count + " - clear
|
|
936
|
+
console.log("frame #" + this._count + " - clear - backBuffer=", backBuffer, " depth=", depth, " stencil=", stencil, " scissor is active=", hasScissor);
|
|
923
937
|
}
|
|
924
938
|
}
|
|
925
939
|
// We need to recreate the render pass so that the new parameters for clear color / depth / stencil are taken into account
|
|
926
940
|
if (this._currentRenderTarget) {
|
|
927
941
|
if (hasScissor) {
|
|
928
|
-
if (!this.
|
|
942
|
+
if (!this._currentRenderPass) {
|
|
929
943
|
this._startRenderTargetRenderPass(this._currentRenderTarget, false, backBuffer ? color : null, depth, stencil);
|
|
930
944
|
}
|
|
931
|
-
|
|
932
|
-
this._bundleListRenderTarget.addItem(new WebGPURenderItemScissor(this._scissorCached.x, this._scissorCached.y, this._scissorCached.z, this._scissorCached.w));
|
|
933
|
-
}
|
|
934
|
-
else {
|
|
935
|
-
this._applyScissor(this._currentRenderPass);
|
|
936
|
-
}
|
|
945
|
+
this._applyScissor(!this.compatibilityMode ? this._bundleList : null);
|
|
937
946
|
this._clearFullQuad(backBuffer ? color : null, depth, stencil);
|
|
938
947
|
}
|
|
939
948
|
else {
|
|
940
949
|
if (this._currentRenderPass) {
|
|
941
|
-
this.
|
|
950
|
+
this._endCurrentRenderPass();
|
|
942
951
|
}
|
|
943
952
|
this._startRenderTargetRenderPass(this._currentRenderTarget, true, backBuffer ? color : null, depth, stencil);
|
|
944
953
|
}
|
|
945
954
|
}
|
|
946
955
|
else {
|
|
947
|
-
if (!this.
|
|
956
|
+
if (!this._currentRenderPass || !hasScissor) {
|
|
948
957
|
this._startMainRenderPass(!hasScissor, backBuffer ? color : null, depth, stencil);
|
|
949
958
|
}
|
|
950
959
|
if (hasScissor) {
|
|
951
|
-
|
|
952
|
-
this._bundleList.addItem(new WebGPURenderItemScissor(this._scissorCached.x, this._scissorCached.y, this._scissorCached.z, this._scissorCached.w));
|
|
953
|
-
}
|
|
954
|
-
else {
|
|
955
|
-
this._applyScissor(this._currentRenderPass);
|
|
956
|
-
}
|
|
960
|
+
this._applyScissor(!this.compatibilityMode ? this._bundleList : null);
|
|
957
961
|
this._clearFullQuad(backBuffer ? color : null, depth, stencil);
|
|
958
962
|
}
|
|
959
963
|
}
|
|
960
964
|
}
|
|
961
965
|
_clearFullQuad(clearColor, clearDepth, clearStencil) {
|
|
962
|
-
var _a, _b
|
|
966
|
+
var _a, _b;
|
|
963
967
|
const renderPass = !this.compatibilityMode ? null : this._getCurrentRenderPass();
|
|
964
|
-
const renderPassIndex = this._getCurrentRenderPassIndex();
|
|
965
|
-
const bundleList = renderPassIndex === 0 ? this._bundleList : this._bundleListRenderTarget;
|
|
966
968
|
this._clearQuad.setColorFormat(this._colorFormat);
|
|
967
969
|
this._clearQuad.setDepthStencilFormat(this._depthTextureFormat);
|
|
968
970
|
this._clearQuad.setMRTAttachments((_a = this._cacheRenderPipeline.mrtAttachments) !== null && _a !== void 0 ? _a : [], (_b = this._cacheRenderPipeline.mrtTextureArray) !== null && _b !== void 0 ? _b : [], this._cacheRenderPipeline.mrtTextureCount);
|
|
969
971
|
if (!this.compatibilityMode) {
|
|
970
|
-
|
|
972
|
+
this._bundleList.addItem(new WebGPURenderItemStencilRef(this._clearStencilValue));
|
|
971
973
|
}
|
|
972
974
|
else {
|
|
973
975
|
renderPass.setStencilReference(this._clearStencilValue);
|
|
974
976
|
}
|
|
975
977
|
const bundle = this._clearQuad.clear(renderPass, clearColor, clearDepth, clearStencil, this.currentSampleCount);
|
|
976
978
|
if (!this.compatibilityMode) {
|
|
977
|
-
|
|
978
|
-
|
|
979
|
+
this._bundleList.addBundle(bundle);
|
|
980
|
+
this._applyStencilRef(this._bundleList);
|
|
979
981
|
this._reportDrawCall();
|
|
980
982
|
}
|
|
981
983
|
else {
|
|
982
|
-
this._applyStencilRef(
|
|
984
|
+
this._applyStencilRef(null);
|
|
983
985
|
}
|
|
984
986
|
}
|
|
985
987
|
//------------------------------------------------------------------------------
|
|
@@ -1550,7 +1552,7 @@ export class WebGPUEngine extends Engine {
|
|
|
1550
1552
|
if (!gpuTexture) {
|
|
1551
1553
|
this._textureHelper.createGPUTextureForInternalTexture(texture);
|
|
1552
1554
|
}
|
|
1553
|
-
this._generateMipmaps(texture
|
|
1555
|
+
this._generateMipmaps(texture);
|
|
1554
1556
|
}
|
|
1555
1557
|
}
|
|
1556
1558
|
/**
|
|
@@ -1734,20 +1736,21 @@ export class WebGPUEngine extends Engine {
|
|
|
1734
1736
|
* @param texture texture to generate the mipmaps for
|
|
1735
1737
|
*/
|
|
1736
1738
|
generateMipmaps(texture) {
|
|
1737
|
-
this._generateMipmaps(texture
|
|
1739
|
+
this._generateMipmaps(texture);
|
|
1738
1740
|
}
|
|
1739
1741
|
/**
|
|
1740
1742
|
* @internal
|
|
1741
1743
|
*/
|
|
1742
1744
|
_generateMipmaps(texture, commandEncoder) {
|
|
1745
|
+
commandEncoder = commandEncoder !== null && commandEncoder !== void 0 ? commandEncoder : this._renderEncoder;
|
|
1743
1746
|
const gpuHardwareTexture = texture._hardwareTexture;
|
|
1744
1747
|
if (!gpuHardwareTexture) {
|
|
1745
1748
|
return;
|
|
1746
1749
|
}
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1750
|
+
if (commandEncoder === this._renderEncoder) {
|
|
1751
|
+
// 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)
|
|
1752
|
+
this._endCurrentRenderPass();
|
|
1753
|
+
}
|
|
1751
1754
|
const format = texture._hardwareTexture.format;
|
|
1752
1755
|
const mipmapCount = WebGPUTextureHelper.ComputeNumMipmapLevels(texture.width, texture.height);
|
|
1753
1756
|
if (this.dbgVerboseLogsForFirstFrames) {
|
|
@@ -1755,7 +1758,16 @@ export class WebGPUEngine extends Engine {
|
|
|
1755
1758
|
this._count = 0;
|
|
1756
1759
|
}
|
|
1757
1760
|
if (!this._count || this._count < this.dbgVerboseLogsNumFrames) {
|
|
1758
|
-
console.log("frame #" +
|
|
1761
|
+
console.log("frame #" +
|
|
1762
|
+
this._count +
|
|
1763
|
+
" - generate mipmaps - width=" +
|
|
1764
|
+
texture.width +
|
|
1765
|
+
", height=" +
|
|
1766
|
+
texture.height +
|
|
1767
|
+
", isCube=" +
|
|
1768
|
+
texture.isCube +
|
|
1769
|
+
", command encoder=" +
|
|
1770
|
+
(commandEncoder === this._renderEncoder ? "render" : "copy"));
|
|
1759
1771
|
}
|
|
1760
1772
|
}
|
|
1761
1773
|
if (texture.isCube) {
|
|
@@ -1786,7 +1798,7 @@ export class WebGPUEngine extends Engine {
|
|
|
1786
1798
|
const data = new Uint8Array(imageData.buffer, imageData.byteOffset, imageData.byteLength);
|
|
1787
1799
|
this._textureHelper.updateTexture(data, texture, width, height, texture.depth, gpuTextureWrapper.format, faceIndex, lod, texture.invertY, false, xOffset, yOffset);
|
|
1788
1800
|
if (generateMipMaps) {
|
|
1789
|
-
this._generateMipmaps(texture
|
|
1801
|
+
this._generateMipmaps(texture);
|
|
1790
1802
|
}
|
|
1791
1803
|
}
|
|
1792
1804
|
/**
|
|
@@ -1853,7 +1865,7 @@ export class WebGPUEngine extends Engine {
|
|
|
1853
1865
|
*/
|
|
1854
1866
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1855
1867
|
readPixels(x, y, width, height, hasAlpha = true, flushRenderer = true) {
|
|
1856
|
-
const renderPassWrapper = this.
|
|
1868
|
+
const renderPassWrapper = this._getCurrentRenderPassWrapper();
|
|
1857
1869
|
const hardwareTexture = renderPassWrapper.colorAttachmentGPUTextures[0];
|
|
1858
1870
|
if (!hardwareTexture) {
|
|
1859
1871
|
// we are calling readPixels for a render pass with no color texture bound
|
|
@@ -1883,18 +1895,10 @@ export class WebGPUEngine extends Engine {
|
|
|
1883
1895
|
* End the current frame
|
|
1884
1896
|
*/
|
|
1885
1897
|
endFrame() {
|
|
1886
|
-
this.
|
|
1887
|
-
this.
|
|
1898
|
+
this._endCurrentRenderPass();
|
|
1899
|
+
this._snapshotRendering.endFrame();
|
|
1888
1900
|
this._timestampQuery.endFrame(this._renderEncoder);
|
|
1889
|
-
this.flushFramebuffer(
|
|
1890
|
-
if (this.dbgVerboseLogsForFirstFrames) {
|
|
1891
|
-
if (this._count === undefined) {
|
|
1892
|
-
this._count = 0;
|
|
1893
|
-
}
|
|
1894
|
-
if (!this._count || this._count < this.dbgVerboseLogsNumFrames) {
|
|
1895
|
-
console.log("frame #" + this._count + " - counters");
|
|
1896
|
-
}
|
|
1897
|
-
}
|
|
1901
|
+
this.flushFramebuffer();
|
|
1898
1902
|
this._textureHelper.destroyDeferredTextures();
|
|
1899
1903
|
this._bufferManager.destroyDeferredBuffers();
|
|
1900
1904
|
if (this._features._collectUbosUpdatedInFrame) {
|
|
@@ -1941,53 +1945,29 @@ export class WebGPUEngine extends Engine {
|
|
|
1941
1945
|
}
|
|
1942
1946
|
/**
|
|
1943
1947
|
* Force a WebGPU flush (ie. a flush of all waiting commands)
|
|
1944
|
-
* @param reopenPass true to reopen at the end of the function the pass that was active when entering the function
|
|
1945
1948
|
*/
|
|
1946
|
-
flushFramebuffer(
|
|
1949
|
+
flushFramebuffer() {
|
|
1947
1950
|
// 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
|
|
1948
|
-
|
|
1949
|
-
let currentPasses = 0; // 0 if no pass, 1 for rtt, 2 for main pass
|
|
1950
|
-
if (this._currentRenderPass && this._currentRenderTarget) {
|
|
1951
|
-
currentPasses |= 1;
|
|
1952
|
-
this._endRenderTargetRenderPass();
|
|
1953
|
-
}
|
|
1954
|
-
if (this._mainRenderPassWrapper.renderPass) {
|
|
1955
|
-
currentPasses |= 2;
|
|
1956
|
-
this._endMainRenderPass();
|
|
1957
|
-
}
|
|
1951
|
+
this._endCurrentRenderPass();
|
|
1958
1952
|
this._commandBuffers[0] = this._uploadEncoder.finish();
|
|
1959
|
-
this._commandBuffers[1] = this.
|
|
1960
|
-
this._commandBuffers[2] = this._renderEncoder.finish();
|
|
1953
|
+
this._commandBuffers[1] = this._renderEncoder.finish();
|
|
1961
1954
|
this._device.queue.submit(this._commandBuffers);
|
|
1962
1955
|
this._uploadEncoder = this._device.createCommandEncoder(this._uploadEncoderDescriptor);
|
|
1963
1956
|
this._renderEncoder = this._device.createCommandEncoder(this._renderEncoderDescriptor);
|
|
1964
|
-
this._renderTargetEncoder = this._device.createCommandEncoder(this._renderTargetEncoderDescriptor);
|
|
1965
1957
|
this._timestampQuery.startFrame(this._uploadEncoder);
|
|
1966
1958
|
this._textureHelper.setCommandEncoder(this._uploadEncoder);
|
|
1967
1959
|
this._bundleList.reset();
|
|
1968
|
-
this._bundleListRenderTarget.reset();
|
|
1969
|
-
// restart the render pass
|
|
1970
|
-
if (reopenPass) {
|
|
1971
|
-
if (currentPasses & 2) {
|
|
1972
|
-
this._startMainRenderPass(false);
|
|
1973
|
-
}
|
|
1974
|
-
if (currentPasses & 1) {
|
|
1975
|
-
this._startRenderTargetRenderPass(this._currentRenderTarget, false, null, false, false);
|
|
1976
|
-
}
|
|
1977
|
-
if (currentRenderPassIsNULL && this._currentRenderTarget) {
|
|
1978
|
-
this._currentRenderPass = null;
|
|
1979
|
-
}
|
|
1980
|
-
}
|
|
1981
1960
|
}
|
|
1982
1961
|
/** @internal */
|
|
1983
1962
|
_currentFrameBufferIsDefaultFrameBuffer() {
|
|
1984
|
-
return this.
|
|
1963
|
+
return this._currentPassIsMainPass();
|
|
1985
1964
|
}
|
|
1986
1965
|
//------------------------------------------------------------------------------
|
|
1987
1966
|
// Render Pass
|
|
1988
1967
|
//------------------------------------------------------------------------------
|
|
1989
1968
|
_startRenderTargetRenderPass(renderTargetWrapper, setClearStates, clearColor, clearDepth, clearStencil) {
|
|
1990
1969
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1970
|
+
this._endCurrentRenderPass();
|
|
1991
1971
|
const rtWrapper = renderTargetWrapper;
|
|
1992
1972
|
const depthStencilTexture = rtWrapper._depthStencilTexture;
|
|
1993
1973
|
const gpuDepthStencilWrapper = depthStencilTexture === null || depthStencilTexture === void 0 ? void 0 : depthStencilTexture._hardwareTexture;
|
|
@@ -2084,73 +2064,36 @@ export class WebGPUEngine extends Engine {
|
|
|
2084
2064
|
: undefined,
|
|
2085
2065
|
occlusionQuerySet: ((_g = this._occlusionQuery) === null || _g === void 0 ? void 0 : _g.hasQueries) ? this._occlusionQuery.querySet : undefined,
|
|
2086
2066
|
};
|
|
2087
|
-
this.
|
|
2067
|
+
this._currentRenderPass = this._renderEncoder.beginRenderPass(this._rttRenderPassWrapper.renderPassDescriptor);
|
|
2088
2068
|
if (this.dbgVerboseLogsForFirstFrames) {
|
|
2089
2069
|
if (this._count === undefined) {
|
|
2090
2070
|
this._count = 0;
|
|
2091
2071
|
}
|
|
2092
2072
|
if (!this._count || this._count < this.dbgVerboseLogsNumFrames) {
|
|
2093
2073
|
const internalTexture = rtWrapper.texture;
|
|
2094
|
-
console.log("frame #" +
|
|
2074
|
+
console.log("frame #" +
|
|
2075
|
+
this._count +
|
|
2076
|
+
" - render target begin pass - rtt name=" +
|
|
2077
|
+
renderTargetWrapper.label +
|
|
2078
|
+
", internalTexture.uniqueId=" +
|
|
2079
|
+
internalTexture.uniqueId +
|
|
2080
|
+
", width=" +
|
|
2081
|
+
internalTexture.width +
|
|
2082
|
+
", height=" +
|
|
2083
|
+
internalTexture.height +
|
|
2084
|
+
", setClearStates=" +
|
|
2085
|
+
setClearStates, "renderPassDescriptor=", this._rttRenderPassWrapper.renderPassDescriptor);
|
|
2095
2086
|
}
|
|
2096
2087
|
}
|
|
2097
|
-
this._currentRenderPass = this._rttRenderPassWrapper.renderPass;
|
|
2098
2088
|
(_h = this._debugFlushPendingCommands) === null || _h === void 0 ? void 0 : _h.call(this);
|
|
2099
|
-
this.
|
|
2100
|
-
this._resetCurrentScissor(1);
|
|
2101
|
-
this._resetCurrentStencilRef(1);
|
|
2102
|
-
this._resetCurrentColorBlend(1);
|
|
2089
|
+
this._resetRenderPassStates();
|
|
2103
2090
|
if (!gpuDepthStencilWrapper || !WebGPUTextureHelper.HasStencilAspect(gpuDepthStencilWrapper.format)) {
|
|
2104
2091
|
this._stencilStateComposer.enabled = false;
|
|
2105
2092
|
}
|
|
2106
2093
|
}
|
|
2107
|
-
/** @internal */
|
|
2108
|
-
_endRenderTargetRenderPass() {
|
|
2109
|
-
var _a, _b, _c, _d;
|
|
2110
|
-
if (this._currentRenderPass) {
|
|
2111
|
-
const gpuWrapper = (_a = this._currentRenderTarget.texture) === null || _a === void 0 ? void 0 : _a._hardwareTexture;
|
|
2112
|
-
if (gpuWrapper && !this._snapshotRendering.endRenderTargetPass(this._currentRenderPass, gpuWrapper) && !this.compatibilityMode) {
|
|
2113
|
-
this._bundleListRenderTarget.run(this._currentRenderPass);
|
|
2114
|
-
this._bundleListRenderTarget.reset();
|
|
2115
|
-
}
|
|
2116
|
-
this._currentRenderPass.end();
|
|
2117
|
-
if (this.dbgVerboseLogsForFirstFrames) {
|
|
2118
|
-
if (this._count === undefined) {
|
|
2119
|
-
this._count = 0;
|
|
2120
|
-
}
|
|
2121
|
-
if (!this._count || this._count < this.dbgVerboseLogsNumFrames) {
|
|
2122
|
-
console.log("frame #" + this._count + " - render target end pass - internalTexture.uniqueId=", (_c = (_b = this._currentRenderTarget) === null || _b === void 0 ? void 0 : _b.texture) === null || _c === void 0 ? void 0 : _c.uniqueId);
|
|
2123
|
-
}
|
|
2124
|
-
}
|
|
2125
|
-
(_d = this._debugPopGroup) === null || _d === void 0 ? void 0 : _d.call(this, 1);
|
|
2126
|
-
this._resetCurrentViewport(1);
|
|
2127
|
-
this._viewport(0, 0, 0, 0);
|
|
2128
|
-
this._resetCurrentScissor(1);
|
|
2129
|
-
this._resetCurrentStencilRef(1);
|
|
2130
|
-
this._resetCurrentColorBlend(1);
|
|
2131
|
-
this._currentRenderPass = null;
|
|
2132
|
-
this._rttRenderPassWrapper.reset();
|
|
2133
|
-
}
|
|
2134
|
-
}
|
|
2135
|
-
_getCurrentRenderPass() {
|
|
2136
|
-
if (this._currentRenderTarget && !this._currentRenderPass) {
|
|
2137
|
-
// delayed creation of the render target pass, but we now need to create it as we are requested the render pass
|
|
2138
|
-
this._startRenderTargetRenderPass(this._currentRenderTarget, false, null, false, false);
|
|
2139
|
-
}
|
|
2140
|
-
else if (!this._currentRenderPass) {
|
|
2141
|
-
this._startMainRenderPass(false);
|
|
2142
|
-
}
|
|
2143
|
-
return this._currentRenderPass;
|
|
2144
|
-
}
|
|
2145
|
-
/** @internal */
|
|
2146
|
-
_getCurrentRenderPassIndex() {
|
|
2147
|
-
return this._currentRenderPass === null ? -1 : this._currentRenderPass === this._mainRenderPassWrapper.renderPass ? 0 : 1;
|
|
2148
|
-
}
|
|
2149
2094
|
_startMainRenderPass(setClearStates, clearColor, clearDepth, clearStencil) {
|
|
2150
2095
|
var _a, _b, _c;
|
|
2151
|
-
|
|
2152
|
-
this.flushFramebuffer(false);
|
|
2153
|
-
}
|
|
2096
|
+
this._endCurrentRenderPass();
|
|
2154
2097
|
if (this.useReverseDepthBuffer) {
|
|
2155
2098
|
this.setDepthFunctionToGreaterOrEqual();
|
|
2156
2099
|
}
|
|
@@ -2188,48 +2131,47 @@ export class WebGPUEngine extends Engine {
|
|
|
2188
2131
|
this._count = 0;
|
|
2189
2132
|
}
|
|
2190
2133
|
if (!this._count || this._count < this.dbgVerboseLogsNumFrames) {
|
|
2191
|
-
console.log("frame #" + this._count + " - main begin pass - texture width=" + this._mainTextureExtends.width, " height=" + this._mainTextureExtends.height, this._mainRenderPassWrapper.renderPassDescriptor);
|
|
2134
|
+
console.log("frame #" + this._count + " - main begin pass - texture width=" + this._mainTextureExtends.width, " height=" + this._mainTextureExtends.height + ", setClearStates=" + setClearStates, "renderPassDescriptor=", this._mainRenderPassWrapper.renderPassDescriptor);
|
|
2192
2135
|
}
|
|
2193
2136
|
}
|
|
2194
2137
|
(_b = this._debugPushGroup) === null || _b === void 0 ? void 0 : _b.call(this, "main pass", 0);
|
|
2195
2138
|
this._currentRenderPass = this._renderEncoder.beginRenderPass(this._mainRenderPassWrapper.renderPassDescriptor);
|
|
2196
|
-
this.
|
|
2139
|
+
this._setDepthTextureFormat(this._mainRenderPassWrapper);
|
|
2140
|
+
this._setColorFormat(this._mainRenderPassWrapper);
|
|
2197
2141
|
(_c = this._debugFlushPendingCommands) === null || _c === void 0 ? void 0 : _c.call(this);
|
|
2198
|
-
this.
|
|
2199
|
-
this._resetCurrentScissor(0);
|
|
2200
|
-
this._resetCurrentStencilRef(0);
|
|
2201
|
-
this._resetCurrentColorBlend(0);
|
|
2142
|
+
this._resetRenderPassStates();
|
|
2202
2143
|
if (!this._isStencilEnable) {
|
|
2203
2144
|
this._stencilStateComposer.enabled = false;
|
|
2204
2145
|
}
|
|
2205
2146
|
}
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
this.
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
}
|
|
2147
|
+
/** @internal */
|
|
2148
|
+
_endCurrentRenderPass() {
|
|
2149
|
+
var _a, _b, _c;
|
|
2150
|
+
if (!this._currentRenderPass) {
|
|
2151
|
+
return 0;
|
|
2152
|
+
}
|
|
2153
|
+
const currentPassIndex = this._currentPassIsMainPass() ? 2 : 1;
|
|
2154
|
+
if (!this._snapshotRendering.endRenderPass(this._currentRenderPass) && !this.compatibilityMode) {
|
|
2155
|
+
this._bundleList.run(this._currentRenderPass);
|
|
2156
|
+
this._bundleList.reset();
|
|
2157
|
+
}
|
|
2158
|
+
this._currentRenderPass.end();
|
|
2159
|
+
if (this.dbgVerboseLogsForFirstFrames) {
|
|
2160
|
+
if (this._count === undefined) {
|
|
2161
|
+
this._count = 0;
|
|
2222
2162
|
}
|
|
2223
|
-
(
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2163
|
+
if (!this._count || this._count < this.dbgVerboseLogsNumFrames) {
|
|
2164
|
+
console.log("frame #" +
|
|
2165
|
+
this._count +
|
|
2166
|
+
" - " +
|
|
2167
|
+
(currentPassIndex === 2 ? "main" : "render target") +
|
|
2168
|
+
" end pass" +
|
|
2169
|
+
(currentPassIndex === 1 ? " - internalTexture.uniqueId=" + ((_b = (_a = this._currentRenderTarget) === null || _a === void 0 ? void 0 : _a.texture) === null || _b === void 0 ? void 0 : _b.uniqueId) : ""));
|
|
2230
2170
|
}
|
|
2231
|
-
this._mainRenderPassWrapper.reset(false);
|
|
2232
2171
|
}
|
|
2172
|
+
(_c = this._debugPopGroup) === null || _c === void 0 ? void 0 : _c.call(this, 0);
|
|
2173
|
+
this._currentRenderPass = null;
|
|
2174
|
+
return currentPassIndex;
|
|
2233
2175
|
}
|
|
2234
2176
|
/**
|
|
2235
2177
|
* Binds the frame buffer to the specified texture.
|
|
@@ -2247,10 +2189,10 @@ export class WebGPUEngine extends Engine {
|
|
|
2247
2189
|
if (this._currentRenderTarget) {
|
|
2248
2190
|
this.unBindFramebuffer(this._currentRenderTarget);
|
|
2249
2191
|
}
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
hardwareTexture._currentLayer = texture.isCube ? layer * 6 + faceIndex : layer;
|
|
2192
|
+
else {
|
|
2193
|
+
this._endCurrentRenderPass();
|
|
2253
2194
|
}
|
|
2195
|
+
this._currentRenderTarget = texture;
|
|
2254
2196
|
this._rttRenderPassWrapper.colorAttachmentGPUTextures[0] = hardwareTexture;
|
|
2255
2197
|
this._rttRenderPassWrapper.depthTextureFormat = this._currentRenderTarget._depthStencilTexture
|
|
2256
2198
|
? WebGPUTextureHelper.GetWebGPUTextureFormat(-1, this._currentRenderTarget._depthStencilTexture.format)
|
|
@@ -2280,14 +2222,21 @@ export class WebGPUEngine extends Engine {
|
|
|
2280
2222
|
this._count = 0;
|
|
2281
2223
|
}
|
|
2282
2224
|
if (!this._count || this._count < this.dbgVerboseLogsNumFrames) {
|
|
2283
|
-
console.log("frame #" +
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2225
|
+
console.log("frame #" +
|
|
2226
|
+
this._count +
|
|
2227
|
+
" - bindFramebuffer - rtt name=" +
|
|
2228
|
+
texture.label +
|
|
2229
|
+
", internalTexture.uniqueId=" +
|
|
2230
|
+
((_b = texture.texture) === null || _b === void 0 ? void 0 : _b.uniqueId) +
|
|
2231
|
+
", face=" +
|
|
2232
|
+
faceIndex +
|
|
2233
|
+
", lodLevel=" +
|
|
2234
|
+
lodLevel +
|
|
2235
|
+
", layer=" +
|
|
2236
|
+
layer, "colorAttachmentViewDescriptor=", this._rttRenderPassWrapper.colorAttachmentViewDescriptor, "depthAttachmentViewDescriptor=", this._rttRenderPassWrapper.depthAttachmentViewDescriptor);
|
|
2237
|
+
}
|
|
2238
|
+
}
|
|
2239
|
+
// 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()...
|
|
2291
2240
|
if (this._cachedViewport && !forceFullscreenViewport) {
|
|
2292
2241
|
this.setViewport(this._cachedViewport, requiredWidth, requiredHeight);
|
|
2293
2242
|
}
|
|
@@ -2322,28 +2271,22 @@ export class WebGPUEngine extends Engine {
|
|
|
2322
2271
|
onBeforeUnbind();
|
|
2323
2272
|
}
|
|
2324
2273
|
this._currentRenderTarget = saveCRT;
|
|
2325
|
-
|
|
2326
|
-
this._endRenderTargetRenderPass();
|
|
2327
|
-
}
|
|
2274
|
+
this._endCurrentRenderPass();
|
|
2328
2275
|
if (((_a = texture.texture) === null || _a === void 0 ? void 0 : _a.generateMipMaps) && !disableGenerateMipMaps && !texture.isCube) {
|
|
2329
2276
|
this._generateMipmaps(texture.texture);
|
|
2330
2277
|
}
|
|
2331
2278
|
this._currentRenderTarget = null;
|
|
2332
|
-
this._onAfterUnbindFrameBufferObservable.notifyObservers(this);
|
|
2333
2279
|
if (this.dbgVerboseLogsForFirstFrames) {
|
|
2334
2280
|
if (this._count === undefined) {
|
|
2335
2281
|
this._count = 0;
|
|
2336
2282
|
}
|
|
2337
2283
|
if (!this._count || this._count < this.dbgVerboseLogsNumFrames) {
|
|
2338
|
-
console.log("frame #" + this._count + " - unBindFramebuffer
|
|
2284
|
+
console.log("frame #" + this._count + " - unBindFramebuffer - rtt name=" + texture.label + ", internalTexture.uniqueId=", (_b = texture.texture) === null || _b === void 0 ? void 0 : _b.uniqueId);
|
|
2339
2285
|
}
|
|
2340
2286
|
}
|
|
2341
2287
|
this._mrtAttachments = [];
|
|
2342
2288
|
this._cacheRenderPipeline.setMRT([]);
|
|
2343
2289
|
this._cacheRenderPipeline.setMRTAttachments(this._mrtAttachments);
|
|
2344
|
-
this._currentRenderPass = this._mainRenderPassWrapper.renderPass;
|
|
2345
|
-
this._setDepthTextureFormat(this._mainRenderPassWrapper);
|
|
2346
|
-
this._setColorFormat(this._mainRenderPassWrapper);
|
|
2347
2290
|
}
|
|
2348
2291
|
/**
|
|
2349
2292
|
* Unbind the current render target and bind the default framebuffer
|
|
@@ -2352,15 +2295,11 @@ export class WebGPUEngine extends Engine {
|
|
|
2352
2295
|
if (this._currentRenderTarget) {
|
|
2353
2296
|
this.unBindFramebuffer(this._currentRenderTarget);
|
|
2354
2297
|
}
|
|
2355
|
-
else {
|
|
2356
|
-
this.
|
|
2357
|
-
this._setDepthTextureFormat(this._mainRenderPassWrapper);
|
|
2358
|
-
this._setColorFormat(this._mainRenderPassWrapper);
|
|
2298
|
+
else if (!this._currentRenderPass) {
|
|
2299
|
+
this._startMainRenderPass(false);
|
|
2359
2300
|
}
|
|
2360
|
-
if (this.
|
|
2361
|
-
|
|
2362
|
-
this.setViewport(this._cachedViewport);
|
|
2363
|
-
}
|
|
2301
|
+
if (this._cachedViewport) {
|
|
2302
|
+
this.setViewport(this._cachedViewport);
|
|
2364
2303
|
}
|
|
2365
2304
|
this.wipeCaches();
|
|
2366
2305
|
}
|
|
@@ -2426,46 +2365,26 @@ export class WebGPUEngine extends Engine {
|
|
|
2426
2365
|
}
|
|
2427
2366
|
this._stencilStateComposer.stencilMaterial = stencil;
|
|
2428
2367
|
}
|
|
2429
|
-
_applyRenderPassChanges(
|
|
2430
|
-
|
|
2431
|
-
const
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
const mustUpdateBlendColor = !this._alphaState.alphaBlend ? false : this._mustUpdateBlendColor(renderPass);
|
|
2435
|
-
if (bundleList) {
|
|
2436
|
-
if (mustUpdateViewport) {
|
|
2437
|
-
bundleList.addItem(new WebGPURenderItemViewport(this._viewportCached.x, this._viewportCached.y, this._viewportCached.z, this._viewportCached.w));
|
|
2438
|
-
}
|
|
2439
|
-
if (mustUpdateScissor) {
|
|
2440
|
-
bundleList.addItem(new WebGPURenderItemScissor(this._scissorCached.x, this._scissorCached.y, this._scissorCached.z, this._scissorCached.w));
|
|
2441
|
-
}
|
|
2442
|
-
if (mustUpdateStencilRef) {
|
|
2443
|
-
bundleList.addItem(new WebGPURenderItemStencilRef((_a = this._stencilStateComposer.funcRef) !== null && _a !== void 0 ? _a : 0));
|
|
2444
|
-
}
|
|
2445
|
-
if (mustUpdateBlendColor) {
|
|
2446
|
-
bundleList.addItem(new WebGPURenderItemBlendColor(this._alphaState._blendConstants.slice()));
|
|
2447
|
-
}
|
|
2368
|
+
_applyRenderPassChanges(bundleList) {
|
|
2369
|
+
const mustUpdateStencilRef = !this._stencilStateComposer.enabled ? false : this._mustUpdateStencilRef();
|
|
2370
|
+
const mustUpdateBlendColor = !this._alphaState.alphaBlend ? false : this._mustUpdateBlendColor();
|
|
2371
|
+
if (this._mustUpdateViewport()) {
|
|
2372
|
+
this._applyViewport(bundleList);
|
|
2448
2373
|
}
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
this._applyStencilRef(renderPass);
|
|
2458
|
-
}
|
|
2459
|
-
if (mustUpdateBlendColor) {
|
|
2460
|
-
this._applyBlendColor(renderPass);
|
|
2461
|
-
}
|
|
2374
|
+
if (this._mustUpdateScissor()) {
|
|
2375
|
+
this._applyScissor(bundleList);
|
|
2376
|
+
}
|
|
2377
|
+
if (mustUpdateStencilRef) {
|
|
2378
|
+
this._applyStencilRef(bundleList);
|
|
2379
|
+
}
|
|
2380
|
+
if (mustUpdateBlendColor) {
|
|
2381
|
+
this._applyBlendColor(bundleList);
|
|
2462
2382
|
}
|
|
2463
2383
|
}
|
|
2464
2384
|
_draw(drawType, fillMode, start, count, instancesCount) {
|
|
2465
2385
|
var _a;
|
|
2466
2386
|
const renderPass = this._getCurrentRenderPass();
|
|
2467
|
-
const
|
|
2468
|
-
const bundleList = renderPassIndex === 0 ? this._bundleList : this._bundleListRenderTarget;
|
|
2387
|
+
const bundleList = this._bundleList;
|
|
2469
2388
|
this.applyStates();
|
|
2470
2389
|
const webgpuPipelineContext = this._currentEffect._pipelineContext;
|
|
2471
2390
|
this.bindUniformBufferBase(this._currentRenderTarget ? this._ubInvertY : this._ubDontInvertY, 0, WebGPUShaderProcessor.InternalsUBOName);
|
|
@@ -2484,7 +2403,7 @@ export class WebGPUEngine extends Engine {
|
|
|
2484
2403
|
const useFastPath = !this.compatibilityMode && this._currentDrawContext.fastBundle;
|
|
2485
2404
|
let renderPass2 = renderPass;
|
|
2486
2405
|
if (useFastPath || this._snapshotRendering.record) {
|
|
2487
|
-
this._applyRenderPassChanges(
|
|
2406
|
+
this._applyRenderPassChanges(bundleList);
|
|
2488
2407
|
if (!this._snapshotRendering.record) {
|
|
2489
2408
|
this._counters.numBundleReuseNonCompatMode++;
|
|
2490
2409
|
if (this._currentDrawContext.indirectDrawBuffer) {
|
|
@@ -2498,12 +2417,13 @@ export class WebGPUEngine extends Engine {
|
|
|
2498
2417
|
bundleList.numDrawCalls++;
|
|
2499
2418
|
}
|
|
2500
2419
|
let textureState = 0;
|
|
2501
|
-
if (
|
|
2420
|
+
if (this._currentMaterialContext.hasFloatOrDepthTextures) {
|
|
2502
2421
|
let bitVal = 1;
|
|
2503
2422
|
for (let i = 0; i < webgpuPipelineContext.shaderProcessingContext.textureNames.length; ++i) {
|
|
2504
2423
|
const textureName = webgpuPipelineContext.shaderProcessingContext.textureNames[i];
|
|
2505
2424
|
const texture = (_a = this._currentMaterialContext.textures[textureName]) === null || _a === void 0 ? void 0 : _a.texture;
|
|
2506
|
-
|
|
2425
|
+
const textureIsDepth = texture && texture.format >= 13 && texture.format <= 18;
|
|
2426
|
+
if (((texture === null || texture === void 0 ? void 0 : texture.type) === 1 && !this._caps.textureFloatLinearFiltering) || textureIsDepth) {
|
|
2507
2427
|
textureState |= bitVal;
|
|
2508
2428
|
}
|
|
2509
2429
|
bitVal = bitVal << 1;
|
|
@@ -2513,13 +2433,13 @@ export class WebGPUEngine extends Engine {
|
|
|
2513
2433
|
const pipeline = this._cacheRenderPipeline.getRenderPipeline(fillMode, this._currentEffect, this.currentSampleCount, textureState);
|
|
2514
2434
|
const bindGroups = this._cacheBindGroups.getBindGroups(webgpuPipelineContext, this._currentDrawContext, this._currentMaterialContext);
|
|
2515
2435
|
if (!this._snapshotRendering.record) {
|
|
2516
|
-
this._applyRenderPassChanges(
|
|
2436
|
+
this._applyRenderPassChanges(!this.compatibilityMode ? bundleList : null);
|
|
2517
2437
|
if (!this.compatibilityMode) {
|
|
2518
2438
|
this._counters.numBundleCreationNonCompatMode++;
|
|
2519
2439
|
renderPass2 = this._device.createRenderBundleEncoder({
|
|
2520
2440
|
colorFormats: this._cacheRenderPipeline.colorFormats,
|
|
2521
2441
|
depthStencilFormat: this._depthTextureFormat,
|
|
2522
|
-
sampleCount: this.currentSampleCount,
|
|
2442
|
+
sampleCount: WebGPUTextureHelper.GetSample(this.currentSampleCount),
|
|
2523
2443
|
});
|
|
2524
2444
|
}
|
|
2525
2445
|
}
|