@onerjs/core 9.0.1 → 9.0.3
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/Animations/animationGroup.pure.js.map +1 -1
- package/Buffers/buffer.pure.js +4 -0
- package/Buffers/buffer.pure.js.map +1 -1
- package/Cameras/camera.pure.d.ts +14 -0
- package/Cameras/camera.pure.js +15 -0
- package/Cameras/camera.pure.js.map +1 -1
- package/Compute/computeShader.pure.d.ts +2 -1
- package/Compute/computeShader.pure.js +29 -10
- package/Compute/computeShader.pure.js.map +1 -1
- package/Culling/ray.core.js +22 -9
- package/Culling/ray.core.js.map +1 -1
- package/Engines/IDrawContext.d.ts +2 -0
- package/Engines/IDrawContext.js.map +1 -1
- package/Engines/Native/nativeInterfaces.d.ts +55 -4
- package/Engines/Native/nativeInterfaces.js.map +1 -1
- package/Engines/Native/nativeRenderTargetWrapper.d.ts +1 -0
- package/Engines/Native/nativeRenderTargetWrapper.js +5 -1
- package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -1
- package/Engines/Processors/shaderCodeInliner.d.ts +2 -0
- package/Engines/Processors/shaderCodeInliner.js +251 -6
- package/Engines/Processors/shaderCodeInliner.js.map +1 -1
- package/Engines/Processors/shaderProcessor.js +10 -1
- package/Engines/Processors/shaderProcessor.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.debugging.pure.js +12 -0
- package/Engines/WebGPU/Extensions/engine.debugging.pure.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.pure.js +0 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.pure.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.query.pure.js +5 -0
- package/Engines/WebGPU/Extensions/engine.query.pure.js.map +1 -1
- package/Engines/WebGPU/webgpuBufferManager.js +7 -0
- package/Engines/WebGPU/webgpuBufferManager.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheTextureView.d.ts +1 -1
- package/Engines/WebGPU/webgpuCacheTextureView.js +20 -8
- package/Engines/WebGPU/webgpuCacheTextureView.js.map +1 -1
- package/Engines/WebGPU/webgpuDrawContext.d.ts +2 -0
- package/Engines/WebGPU/webgpuDrawContext.js +6 -0
- package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
- package/Engines/WebGPU/webgpuQuerySet.d.ts +3 -3
- package/Engines/WebGPU/webgpuQuerySet.js +23 -9
- package/Engines/WebGPU/webgpuQuerySet.js.map +1 -1
- package/Engines/WebGPU/webgpuRenderPassCommandStream.d.ts +156 -0
- package/Engines/WebGPU/webgpuRenderPassCommandStream.js +323 -0
- package/Engines/WebGPU/webgpuRenderPassCommandStream.js.map +1 -0
- package/Engines/WebGPU/webgpuTextureManager.d.ts +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +4 -3
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/WebGPU/webgpuTimestampQuery.d.ts +3 -1
- package/Engines/WebGPU/webgpuTimestampQuery.js +9 -6
- package/Engines/WebGPU/webgpuTimestampQuery.js.map +1 -1
- package/Engines/abstractEngine.pure.d.ts +2 -0
- package/Engines/abstractEngine.pure.js +14 -5
- package/Engines/abstractEngine.pure.js.map +1 -1
- package/Engines/constants.d.ts +6 -0
- package/Engines/constants.js +6 -0
- package/Engines/constants.js.map +1 -1
- package/Engines/engine.d.ts +198 -24
- package/Engines/pure.d.ts +1 -0
- package/Engines/pure.js +1 -0
- package/Engines/pure.js.map +1 -1
- package/Engines/renderCommandBatcher.pure.d.ts +16 -0
- package/Engines/renderCommandBatcher.pure.js +24 -0
- package/Engines/renderCommandBatcher.pure.js.map +1 -0
- package/Engines/thinEngine.functions.js +3 -2
- package/Engines/thinEngine.functions.js.map +1 -1
- package/Engines/thinEngine.pure.js +18 -2
- package/Engines/thinEngine.pure.js.map +1 -1
- package/Engines/thinNativeEngine.pure.d.ts +10 -7
- package/Engines/thinNativeEngine.pure.js +117 -46
- package/Engines/thinNativeEngine.pure.js.map +1 -1
- package/Engines/thinWebGPUEngine.d.ts +8 -0
- package/Engines/thinWebGPUEngine.js +11 -0
- package/Engines/thinWebGPUEngine.js.map +1 -1
- package/Engines/webgpuEngine.pure.d.ts +60 -1
- package/Engines/webgpuEngine.pure.js +238 -42
- package/Engines/webgpuEngine.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/Audio/flowGraphGetSoundVolumeBlock.pure.d.ts +3 -3
- package/FlowGraph/Blocks/Data/Audio/flowGraphGetSoundVolumeBlock.pure.js +2 -1
- package/FlowGraph/Blocks/Data/Audio/flowGraphGetSoundVolumeBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/Audio/flowGraphIsSoundPlayingBlock.pure.d.ts +3 -3
- package/FlowGraph/Blocks/Data/Audio/flowGraphIsSoundPlayingBlock.pure.js +2 -1
- package/FlowGraph/Blocks/Data/Audio/flowGraphIsSoundPlayingBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphMeshIntersectionEventBlock.d.ts +5 -0
- package/FlowGraph/Blocks/Event/flowGraphMeshIntersectionEventBlock.js +8 -0
- package/FlowGraph/Blocks/Event/flowGraphMeshIntersectionEventBlock.js.map +1 -0
- package/FlowGraph/Blocks/Event/flowGraphMeshIntersectionEventBlock.pure.d.ts +77 -0
- package/FlowGraph/Blocks/Event/flowGraphMeshIntersectionEventBlock.pure.js +141 -0
- package/FlowGraph/Blocks/Event/flowGraphMeshIntersectionEventBlock.pure.js.map +1 -0
- package/FlowGraph/Blocks/Event/flowGraphSoundEndedEventBlock.pure.d.ts +5 -3
- package/FlowGraph/Blocks/Event/flowGraphSoundEndedEventBlock.pure.js +38 -7
- package/FlowGraph/Blocks/Event/flowGraphSoundEndedEventBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Event/index.d.ts +1 -0
- package/FlowGraph/Blocks/Event/index.js +1 -0
- package/FlowGraph/Blocks/Event/index.js.map +1 -1
- package/FlowGraph/Blocks/Event/pure.d.ts +1 -0
- package/FlowGraph/Blocks/Event/pure.js +1 -0
- package/FlowGraph/Blocks/Event/pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphPauseSoundBlock.pure.d.ts +3 -3
- package/FlowGraph/Blocks/Execution/Audio/flowGraphPauseSoundBlock.pure.js +2 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphPauseSoundBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphPlaySoundBlock.pure.d.ts +3 -3
- package/FlowGraph/Blocks/Execution/Audio/flowGraphPlaySoundBlock.pure.js +2 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphPlaySoundBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphSetSoundVolumeBlock.pure.d.ts +3 -3
- package/FlowGraph/Blocks/Execution/Audio/flowGraphSetSoundVolumeBlock.pure.js +2 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphSetSoundVolumeBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphStopSoundBlock.pure.d.ts +3 -3
- package/FlowGraph/Blocks/Execution/Audio/flowGraphStopSoundBlock.pure.js +2 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphStopSoundBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/allBlocks.pure.js +2 -0
- package/FlowGraph/Blocks/allBlocks.pure.js.map +1 -1
- package/FlowGraph/Blocks/flowGraphBlockFactory.js +2 -0
- package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
- package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +1 -0
- package/FlowGraph/Blocks/flowGraphBlockNames.js +1 -0
- package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -1
- package/FlowGraph/flowGraph.d.ts +12 -1
- package/FlowGraph/flowGraph.js +38 -0
- package/FlowGraph/flowGraph.js.map +1 -1
- package/FlowGraph/flowGraphCoordinator.d.ts +44 -0
- package/FlowGraph/flowGraphCoordinator.js +141 -0
- package/FlowGraph/flowGraphCoordinator.js.map +1 -1
- package/FlowGraph/flowGraphDataConnection.pure.js +41 -14
- package/FlowGraph/flowGraphDataConnection.pure.js.map +1 -1
- package/FlowGraph/flowGraphParser.js +105 -5
- package/FlowGraph/flowGraphParser.js.map +1 -1
- package/FlowGraph/flowGraphSoundAssets.d.ts +40 -0
- package/FlowGraph/flowGraphSoundAssets.js +33 -0
- package/FlowGraph/flowGraphSoundAssets.js.map +1 -0
- package/FlowGraph/index.d.ts +1 -0
- package/FlowGraph/index.js +1 -0
- package/FlowGraph/index.js.map +1 -1
- package/FlowGraph/pure.d.ts +1 -0
- package/FlowGraph/pure.js +1 -0
- package/FlowGraph/pure.js.map +1 -1
- package/FlowGraph/serialization.d.ts +8 -0
- package/FlowGraph/serialization.js +31 -12
- package/FlowGraph/serialization.js.map +1 -1
- package/FlowGraph/typeDefinitions.d.ts +25 -0
- package/FlowGraph/typeDefinitions.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/taaTask.js +2 -0
- package/FrameGraph/Tasks/PostProcesses/taaTask.js.map +1 -1
- package/Instrumentation/engineInstrumentation.d.ts +1 -0
- package/Instrumentation/engineInstrumentation.js +25 -6
- package/Instrumentation/engineInstrumentation.js.map +1 -1
- package/Lights/Clustered/clusteredLightContainer.pure.js +2 -0
- package/Lights/Clustered/clusteredLightContainer.pure.js.map +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.pure.d.ts +36 -1
- package/Lights/Shadows/cascadedShadowGenerator.pure.js +202 -27
- package/Lights/Shadows/cascadedShadowGenerator.pure.js.map +1 -1
- package/Lights/directionalLight.pure.d.ts +24 -10
- package/Lights/directionalLight.pure.js +29 -11
- package/Lights/directionalLight.pure.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js +4 -4
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js.map +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.pure.js +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/Input/inputBlock.pure.js +4 -0
- package/Materials/Node/Blocks/Input/inputBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.d.ts +9 -0
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js +23 -3
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js.map +1 -1
- package/Materials/PBR/openpbrMaterial.pure.js +1 -1
- package/Materials/PBR/openpbrMaterial.pure.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.pure.d.ts +9 -0
- package/Materials/PBR/pbrBaseMaterial.pure.js +60 -1
- package/Materials/PBR/pbrBaseMaterial.pure.js.map +1 -1
- package/Materials/PBR/pbrBaseSimpleMaterial.d.ts +11 -0
- package/Materials/PBR/pbrBaseSimpleMaterial.js +21 -2
- package/Materials/PBR/pbrBaseSimpleMaterial.js.map +1 -1
- package/Materials/PBR/pbrMaterial.pure.d.ts +12 -0
- package/Materials/PBR/pbrMaterial.pure.js +23 -3
- package/Materials/PBR/pbrMaterial.pure.js.map +1 -1
- package/Materials/Textures/Filtering/hdrIrradianceFiltering.d.ts +1 -0
- package/Materials/Textures/Filtering/hdrIrradianceFiltering.js +10 -0
- package/Materials/Textures/Filtering/hdrIrradianceFiltering.js.map +1 -1
- package/Materials/Textures/HTML/htmlInCanvasPolyfill.d.ts +5 -0
- package/Materials/Textures/HTML/htmlInCanvasPolyfill.js +7 -0
- package/Materials/Textures/HTML/htmlInCanvasPolyfill.js.map +1 -1
- package/Materials/Textures/HTML/htmlInteractionManager.d.ts +9 -3
- package/Materials/Textures/HTML/htmlInteractionManager.js +64 -5
- package/Materials/Textures/HTML/htmlInteractionManager.js.map +1 -1
- package/Materials/Textures/HTML/htmlTexture.d.ts +11 -11
- package/Materials/Textures/HTML/htmlTexture.js +106 -65
- package/Materials/Textures/HTML/htmlTexture.js.map +1 -1
- package/Materials/Textures/Loaders/internalTextureLoader.d.ts +2 -1
- package/Materials/Textures/Loaders/internalTextureLoader.js.map +1 -1
- package/Materials/Textures/Loaders/ktxTextureLoader.d.ts +2 -1
- package/Materials/Textures/Loaders/ktxTextureLoader.js +4 -50
- package/Materials/Textures/Loaders/ktxTextureLoader.js.map +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.pure.js +10 -0
- package/Materials/Textures/Procedurals/proceduralTexture.pure.js.map +1 -1
- package/Materials/Textures/dynamicTexture.pure.js +6 -0
- package/Materials/Textures/dynamicTexture.pure.js.map +1 -1
- package/Materials/Textures/ktx2encoderTypes.d.ts +51 -0
- package/Materials/Textures/ktx2encoderTypes.js +2 -0
- package/Materials/Textures/ktx2encoderTypes.js.map +1 -0
- package/Materials/Textures/renderTargetTexture.pure.js +10 -2
- package/Materials/Textures/renderTargetTexture.pure.js.map +1 -1
- package/Materials/Textures/texture.pure.js +7 -1
- package/Materials/Textures/texture.pure.js.map +1 -1
- package/Materials/Textures/textureMerger.d.ts +11 -0
- package/Materials/Textures/textureMerger.js +34 -19
- package/Materials/Textures/textureMerger.js.map +1 -1
- package/Materials/Textures/textureProcessor.d.ts +145 -0
- package/Materials/Textures/textureProcessor.js +445 -45
- package/Materials/Textures/textureProcessor.js.map +1 -1
- package/Materials/Textures/textureSampling.functions.d.ts +41 -0
- package/Materials/Textures/textureSampling.functions.js +82 -0
- package/Materials/Textures/textureSampling.functions.js.map +1 -0
- package/Materials/drawWrapper.d.ts +8 -0
- package/Materials/drawWrapper.js +19 -0
- package/Materials/drawWrapper.js.map +1 -1
- package/Materials/effect.pure.d.ts +6 -0
- package/Materials/effect.pure.js +28 -6
- package/Materials/effect.pure.js.map +1 -1
- package/Materials/effect.webgl.functions.pure.js +1 -1
- package/Materials/effect.webgl.functions.pure.js.map +1 -1
- package/Materials/material.pure.d.ts +5 -0
- package/Materials/material.pure.js +9 -2
- package/Materials/material.pure.js.map +1 -1
- package/Materials/materialFlags.d.ts +6 -0
- package/Materials/materialFlags.js +14 -0
- package/Materials/materialFlags.js.map +1 -1
- package/Materials/materialHelper.functions.d.ts +2 -1
- package/Materials/materialHelper.functions.js +36 -2
- package/Materials/materialHelper.functions.js.map +1 -1
- package/Materials/materialHelper.geometryrendering.js +19 -16
- package/Materials/materialHelper.geometryrendering.js.map +1 -1
- package/Materials/materialPluginManager.pure.js +12 -8
- package/Materials/materialPluginManager.pure.js.map +1 -1
- package/Materials/prePassConfiguration.js +19 -16
- package/Materials/prePassConfiguration.js.map +1 -1
- package/Materials/shaderMaterial.pure.js +19 -6
- package/Materials/shaderMaterial.pure.js.map +1 -1
- package/Materials/shadowDepthWrapper.d.ts +6 -0
- package/Materials/shadowDepthWrapper.js +17 -0
- package/Materials/shadowDepthWrapper.js.map +1 -1
- package/Meshes/Compression/dracoCodec.d.ts +14 -0
- package/Meshes/Compression/dracoCodec.js +22 -0
- package/Meshes/Compression/dracoCodec.js.map +1 -1
- package/Meshes/Compression/dracoDecoder.d.ts +1 -0
- package/Meshes/Compression/dracoDecoder.js +27 -0
- package/Meshes/Compression/dracoDecoder.js.map +1 -1
- package/Meshes/Compression/dracoEncoder.d.ts +1 -0
- package/Meshes/Compression/dracoEncoder.js +8 -0
- package/Meshes/Compression/dracoEncoder.js.map +1 -1
- package/Meshes/Compression/meshoptCompression.d.ts +1 -0
- package/Meshes/Compression/meshoptCompression.js +9 -0
- package/Meshes/Compression/meshoptCompression.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingGpuSorter.d.ts +415 -0
- package/Meshes/GaussianSplatting/gaussianSplattingGpuSorter.js +912 -0
- package/Meshes/GaussianSplatting/gaussianSplattingGpuSorter.js.map +1 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +3 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +40 -9
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +112 -8
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +696 -74
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
- package/Meshes/abstractMesh.pure.js +12 -4
- package/Meshes/abstractMesh.pure.js.map +1 -1
- package/Meshes/geometry.d.ts +5 -0
- package/Meshes/geometry.js +25 -0
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/index.d.ts +1 -0
- package/Meshes/index.js +1 -0
- package/Meshes/index.js.map +1 -1
- package/Meshes/mesh.pure.d.ts +7 -0
- package/Meshes/mesh.pure.js +18 -13
- package/Meshes/mesh.pure.js.map +1 -1
- package/Meshes/pure.d.ts +1 -0
- package/Meshes/pure.js +1 -0
- package/Meshes/pure.js.map +1 -1
- package/Meshes/subMesh.pure.d.ts +3 -0
- package/Meshes/subMesh.pure.js +26 -0
- package/Meshes/subMesh.pure.js.map +1 -1
- package/Meshes/thinInstanceMesh.pure.js +5 -3
- package/Meshes/thinInstanceMesh.pure.js.map +1 -1
- package/Misc/index.d.ts +1 -0
- package/Misc/index.js +1 -0
- package/Misc/index.js.map +1 -1
- package/Misc/khronosTextureContainer2.d.ts +3 -2
- package/Misc/khronosTextureContainer2.js +24 -6
- package/Misc/khronosTextureContainer2.js.map +1 -1
- package/Misc/khronosTextureContainer2Encoder.d.ts +166 -0
- package/Misc/khronosTextureContainer2Encoder.js +556 -0
- package/Misc/khronosTextureContainer2Encoder.js.map +1 -0
- package/Misc/khronosTextureContainer2EncoderWorker.d.ts +61 -0
- package/Misc/khronosTextureContainer2EncoderWorker.js +55 -0
- package/Misc/khronosTextureContainer2EncoderWorker.js.map +1 -0
- package/Misc/pure.d.ts +1 -0
- package/Misc/pure.js +1 -0
- package/Misc/pure.js.map +1 -1
- package/Misc/textureFormat.functions.d.ts +6 -0
- package/Misc/textureFormat.functions.js +54 -0
- package/Misc/textureFormat.functions.js.map +1 -0
- package/Misc/textureTools.d.ts +6 -2
- package/Misc/textureTools.js +100 -42
- package/Misc/textureTools.js.map +1 -1
- package/Misc/tools.pure.js +1 -1
- package/Misc/tools.pure.js.map +1 -1
- package/Particles/Node/Blocks/systemBlock.pure.d.ts +1 -1
- package/Particles/Node/Blocks/systemBlock.pure.js +6 -3
- package/Particles/Node/Blocks/systemBlock.pure.js.map +1 -1
- package/Particles/computeShaderParticleSystem.pure.js +5 -0
- package/Particles/computeShaderParticleSystem.pure.js.map +1 -1
- package/Particles/gpuParticleSystem.pure.d.ts +2 -0
- package/Particles/gpuParticleSystem.pure.js +25 -1
- package/Particles/gpuParticleSystem.pure.js.map +1 -1
- package/Particles/solidParticle.d.ts +5 -0
- package/Particles/solidParticle.js +5 -0
- package/Particles/solidParticle.js.map +1 -1
- package/Particles/solidParticleSystem.d.ts +10 -0
- package/Particles/solidParticleSystem.js +72 -13
- package/Particles/solidParticleSystem.js.map +1 -1
- package/Particles/thinParticleSystem.pure.js +4 -0
- package/Particles/thinParticleSystem.pure.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/taaMaterialManager.pure.d.ts +27 -6
- package/PostProcesses/RenderPipeline/Pipelines/taaMaterialManager.pure.js +60 -5
- package/PostProcesses/RenderPipeline/Pipelines/taaMaterialManager.pure.js.map +1 -1
- package/PostProcesses/thinTAAPostProcess.d.ts +1 -0
- package/PostProcesses/thinTAAPostProcess.js +17 -1
- package/PostProcesses/thinTAAPostProcess.js.map +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.pure.d.ts +2 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.pure.js +6 -5
- package/PostProcesses/volumetricLightScatteringPostProcess.pure.js.map +1 -1
- package/Rendering/boundingBoxRenderer.pure.js +2 -3
- package/Rendering/boundingBoxRenderer.pure.js.map +1 -1
- package/Rendering/geometryBufferRenderer.pure.js +8 -2
- package/Rendering/geometryBufferRenderer.pure.js.map +1 -1
- package/Rendering/objectRenderer.d.ts +1 -0
- package/Rendering/objectRenderer.js +14 -0
- package/Rendering/objectRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/bumpFragmentMainFunctions.js +2 -2
- package/Shaders/ShadersInclude/bumpFragmentMainFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/bumpVertex.js +1 -1
- package/Shaders/ShadersInclude/bumpVertex.js.map +1 -1
- package/Shaders/ShadersInclude/bumpVertexDeclaration.js +1 -1
- package/Shaders/ShadersInclude/bumpVertexDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/hdrFilteringFunctions.js +5 -1
- package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/helperFunctions.js +2 -2
- package/Shaders/ShadersInclude/helperFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrBackgroundTransmission.js +1 -1
- package/Shaders/ShadersInclude/openpbrBackgroundTransmission.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrVertexDeclaration.js +6 -0
- package/Shaders/ShadersInclude/openpbrVertexDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockFinalLitComponents.js +11 -1
- package/Shaders/ShadersInclude/pbrBlockFinalLitComponents.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockNormalFinal.js +9 -0
- package/Shaders/ShadersInclude/pbrBlockNormalFinal.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockReflectance.js +1 -1
- package/Shaders/ShadersInclude/pbrBlockReflectance.js.map +1 -1
- package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js +1 -1
- package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrFragmentDeclaration.js +7 -1
- package/Shaders/ShadersInclude/pbrFragmentDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js +1 -0
- package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/pbrIBLFunctions.js +12 -0
- package/Shaders/ShadersInclude/pbrIBLFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrUboDeclaration.js +1 -1
- package/Shaders/ShadersInclude/pbrUboDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/pbrVertexDeclaration.js +3 -0
- package/Shaders/ShadersInclude/pbrVertexDeclaration.js.map +1 -1
- package/Shaders/geometry.vertex.js +6 -6
- package/Shaders/geometry.vertex.js.map +1 -1
- package/Shaders/gpuUpdateParticles.vertex.js +1 -1
- package/Shaders/gpuUpdateParticles.vertex.js.map +1 -1
- package/Shaders/lod.fragment.js +15 -2
- package/Shaders/lod.fragment.js.map +1 -1
- package/Shaders/lod3D.fragment.js +15 -2
- package/Shaders/lod3D.fragment.js.map +1 -1
- package/Shaders/lodCube.fragment.js +15 -2
- package/Shaders/lodCube.fragment.js.map +1 -1
- package/Shaders/openpbr.vertex.js +2 -0
- package/Shaders/openpbr.vertex.js.map +1 -1
- package/Shaders/pbr.fragment.js +12 -1
- package/Shaders/pbr.fragment.js.map +1 -1
- package/Shaders/pbr.vertex.js +2 -0
- package/Shaders/pbr.vertex.js.map +1 -1
- package/Shaders/textureMerger.fragment.js +28 -0
- package/Shaders/textureMerger.fragment.js.map +1 -1
- package/Shaders/textureProcessor.fragment.js +26 -4
- package/Shaders/textureProcessor.fragment.js.map +1 -1
- package/Shaders/volumetricLightScattering.fragment.js +1 -1
- package/Shaders/volumetricLightScattering.fragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/bumpFragmentMainFunctions.js +2 -2
- package/ShadersWGSL/ShadersInclude/bumpFragmentMainFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/bumpVertex.js +1 -1
- package/ShadersWGSL/ShadersInclude/bumpVertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/bumpVertexDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/bumpVertexDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/helperFunctions.js +2 -2
- package/ShadersWGSL/ShadersInclude/helperFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/lightFragment.js +44 -2
- package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js +17 -3
- package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/lightVxUboDeclaration.js +12 -1
- package/ShadersWGSL/ShadersInclude/lightVxUboDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrBackgroundTransmission.js +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrBackgroundTransmission.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockFinalLitComponents.js +11 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockFinalLitComponents.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockNormalFinal.js +9 -0
- package/ShadersWGSL/ShadersInclude/pbrBlockNormalFinal.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflectance.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflectance.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrClusteredLightingFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrClusteredLightingFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingSetupFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingSetupFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.js +1 -0
- package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrIBLFunctions.js +8 -0
- package/ShadersWGSL/ShadersInclude/pbrIBLFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/prePassVertex.js +2 -2
- package/ShadersWGSL/ShadersInclude/prePassVertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/prePassVertexDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/prePassVertexDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/sceneUboDeclaration.js +3 -1
- package/ShadersWGSL/ShadersInclude/sceneUboDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/shadowsVertex.js +16 -0
- package/ShadersWGSL/ShadersInclude/shadowsVertex.js.map +1 -1
- package/ShadersWGSL/default.fragment.js +4 -4
- package/ShadersWGSL/default.fragment.js.map +1 -1
- package/ShadersWGSL/default.vertex.js +1 -1
- package/ShadersWGSL/default.vertex.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js +3 -3
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/gpuUpdateParticles.compute.js +1 -1
- package/ShadersWGSL/gpuUpdateParticles.compute.js.map +1 -1
- package/ShadersWGSL/gsSortCount.compute.d.ts +5 -0
- package/ShadersWGSL/gsSortCount.compute.js +19 -0
- package/ShadersWGSL/gsSortCount.compute.js.map +1 -0
- package/ShadersWGSL/gsSortKeys.compute.d.ts +5 -0
- package/ShadersWGSL/gsSortKeys.compute.js +49 -0
- package/ShadersWGSL/gsSortKeys.compute.js.map +1 -0
- package/ShadersWGSL/gsSortOutput.compute.d.ts +5 -0
- package/ShadersWGSL/gsSortOutput.compute.js +28 -0
- package/ShadersWGSL/gsSortOutput.compute.js.map +1 -0
- package/ShadersWGSL/gsSortScanLocal.compute.d.ts +5 -0
- package/ShadersWGSL/gsSortScanLocal.compute.js +23 -0
- package/ShadersWGSL/gsSortScanLocal.compute.js.map +1 -0
- package/ShadersWGSL/gsSortScanSums.compute.d.ts +5 -0
- package/ShadersWGSL/gsSortScanSums.compute.js +19 -0
- package/ShadersWGSL/gsSortScanSums.compute.js.map +1 -0
- package/ShadersWGSL/gsSortScatter.compute.d.ts +5 -0
- package/ShadersWGSL/gsSortScatter.compute.js +33 -0
- package/ShadersWGSL/gsSortScatter.compute.js.map +1 -0
- package/ShadersWGSL/lod.fragment.js +14 -2
- package/ShadersWGSL/lod.fragment.js.map +1 -1
- package/ShadersWGSL/lod3D.fragment.js +14 -2
- package/ShadersWGSL/lod3D.fragment.js.map +1 -1
- package/ShadersWGSL/lodCube.fragment.js +14 -2
- package/ShadersWGSL/lodCube.fragment.js.map +1 -1
- package/ShadersWGSL/openpbr.vertex.js +3 -1
- package/ShadersWGSL/openpbr.vertex.js.map +1 -1
- package/ShadersWGSL/pbr.fragment.js +11 -0
- package/ShadersWGSL/pbr.fragment.js.map +1 -1
- package/ShadersWGSL/pbr.vertex.js +3 -1
- package/ShadersWGSL/pbr.vertex.js.map +1 -1
- package/ShadersWGSL/textureMerger.fragment.js +40 -4
- package/ShadersWGSL/textureMerger.fragment.js.map +1 -1
- package/ShadersWGSL/textureProcessor.fragment.js +26 -4
- package/ShadersWGSL/textureProcessor.fragment.js.map +1 -1
- package/Sprites/spriteRenderer.js +15 -5
- package/Sprites/spriteRenderer.js.map +1 -1
- package/package.json +1 -1
- package/scene.pure.d.ts +23 -1
- package/scene.pure.js +83 -1
- package/scene.pure.js.map +1 -1
|
@@ -46,7 +46,9 @@ import { PerfCounter } from "../Misc/perfCounter.js";
|
|
|
46
46
|
import { resetCachedPipeline } from "../Materials/effect.functions.js";
|
|
47
47
|
import { RegisterAbstractEngineDom } from "./AbstractEngine/abstractEngine.dom.pure.js";
|
|
48
48
|
import { RegisterAbstractEngineRenderPass } from "./AbstractEngine/abstractEngine.renderPass.pure.js";
|
|
49
|
+
import { RenderCommandBatcher } from "./renderCommandBatcher.pure.js";
|
|
49
50
|
import { WebGPUExternalTexture } from "./WebGPU/webgpuExternalTexture.js";
|
|
51
|
+
import { ApplyWebGPURenderPassDrawCommand, CreateWebGPURenderPassIndexedDrawCommand, CreateWebGPURenderPassNonIndexedDrawCommand, WebGPURenderPassCommandStream, WebGPURenderPassDrawKind, } from "./WebGPU/webgpuRenderPassCommandStream.js";
|
|
50
52
|
const ViewDescriptorSwapChainAntialiasing = {
|
|
51
53
|
label: `TextureView_SwapChain_ResolveTarget`,
|
|
52
54
|
dimension: "2d" /* WebGPUConstants.TextureDimension.E2d */,
|
|
@@ -68,6 +70,34 @@ const TempColor4SignedInteger = /*#__PURE__*/ new Color4();
|
|
|
68
70
|
* @since 5.0.0
|
|
69
71
|
*/
|
|
70
72
|
export class WebGPUEngine extends ThinWebGPUEngine {
|
|
73
|
+
/**
|
|
74
|
+
* Gets or sets the provider that lets the host lower render-pass draw submission into a batched
|
|
75
|
+
* command stream (see IWebGPURenderPassCommandRecorderProvider). Hosts such as BabylonNative,
|
|
76
|
+
* where every render-pass encoder call crosses the JS/native boundary, install a provider to
|
|
77
|
+
* amortize that cost across many draws — the same pattern the bgfx-based NativeEngine uses with
|
|
78
|
+
* its CommandBufferEncoder. When no provider is set (the default, and always the case in
|
|
79
|
+
* browsers), draws are submitted directly through the standard WebGPU encoder calls without
|
|
80
|
+
* constructing batched draw commands. Command-stream storage is allocated only when a provider
|
|
81
|
+
* is first installed.
|
|
82
|
+
*/
|
|
83
|
+
get renderPassCommandRecorderProvider() {
|
|
84
|
+
return this._renderPassCommandRecorderProvider;
|
|
85
|
+
}
|
|
86
|
+
set renderPassCommandRecorderProvider(provider) {
|
|
87
|
+
// Record anything batched under the previous provider before swapping contracts.
|
|
88
|
+
this._flushRenderPassCommands();
|
|
89
|
+
this._renderPassCommandRecorderProvider = provider;
|
|
90
|
+
if (provider && !this._renderPassCommandBatching) {
|
|
91
|
+
const lowering = new WebGPURenderPassCommandStream({
|
|
92
|
+
getProvider: () => this._renderPassCommandRecorderProvider,
|
|
93
|
+
});
|
|
94
|
+
this._renderPassCommandBatching = {
|
|
95
|
+
batcher: new RenderCommandBatcher(lowering, ApplyWebGPURenderPassDrawCommand),
|
|
96
|
+
indexedDrawCommand: CreateWebGPURenderPassIndexedDrawCommand(),
|
|
97
|
+
nonIndexedDrawCommand: CreateWebGPURenderPassNonIndexedDrawCommand(),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
71
101
|
/**
|
|
72
102
|
* Gets or sets the snapshot rendering mode
|
|
73
103
|
*/
|
|
@@ -302,6 +332,8 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
302
332
|
/** @internal */
|
|
303
333
|
this._virtualScenes = new Array();
|
|
304
334
|
this._commandBuffers = [null, null];
|
|
335
|
+
this._submitted = null;
|
|
336
|
+
this._resolveSubmitted = null;
|
|
305
337
|
// Frame Buffer Life Cycle (recreated for each render target pass)
|
|
306
338
|
this._mainRenderPassWrapper = {
|
|
307
339
|
renderPassDescriptor: null,
|
|
@@ -322,6 +354,8 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
322
354
|
this._currentVertexBuffers = {};
|
|
323
355
|
this._currentOverrideVertexBuffers = null;
|
|
324
356
|
this._currentIndexBuffer = null;
|
|
357
|
+
this._renderPassCommandRecorderProvider = null;
|
|
358
|
+
this._renderPassCommandBatching = null;
|
|
325
359
|
this._colorWriteLocal = true;
|
|
326
360
|
this._forceEnableEffect = false;
|
|
327
361
|
this._internalFrameCounter = 0;
|
|
@@ -356,6 +390,16 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
356
390
|
this._stencilRefsCurrent = -1;
|
|
357
391
|
this._blendColorsCurrent = [null, null, null, null];
|
|
358
392
|
this._performanceMonitor = new PerformanceMonitor();
|
|
393
|
+
/**
|
|
394
|
+
* The most frames the GPU may have in flight when a frame starts, that frame included (0, the default: no limit).
|
|
395
|
+
* A frame over the limit is not started, and the render loop asks again at the next animation frame. With 2, a frame starts
|
|
396
|
+
* once the GPU has finished every frame but the previous one. Without a limit, a page whose GPU work takes longer than its
|
|
397
|
+
* frame can queue that work far ahead of the GPU, and the screen then shows frames that far behind
|
|
398
|
+
*/
|
|
399
|
+
this.maxFramesInFlight = 0;
|
|
400
|
+
this._framesInFlight = 0;
|
|
401
|
+
this._framesInFlightDevice = null;
|
|
402
|
+
this._framesInFlightDone = null;
|
|
359
403
|
this._name = "WebGPU";
|
|
360
404
|
this._drawCalls = new PerfCounter();
|
|
361
405
|
options.deviceDescriptor = options.deviceDescriptor || {};
|
|
@@ -478,6 +522,8 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
478
522
|
return;
|
|
479
523
|
}
|
|
480
524
|
this._contextWasLost = true;
|
|
525
|
+
// the commands of the lost device will not be submitted: their readbacks go on, and fail as lost
|
|
526
|
+
this._notifySubmitted();
|
|
481
527
|
Logger.Warn("WebGPU context lost. " + info);
|
|
482
528
|
this.onContextLostObservable.notifyObservers(this);
|
|
483
529
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
@@ -859,6 +905,15 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
859
905
|
ExitPointerlock();
|
|
860
906
|
}
|
|
861
907
|
_rebuildBuffers() {
|
|
908
|
+
// Index / Vertex (WebGPUEngine does not extend Engine, so it must do what Engine._rebuildBuffers does)
|
|
909
|
+
for (const scene of this.scenes) {
|
|
910
|
+
scene.resetCachedMaterial();
|
|
911
|
+
scene._rebuildGeometries();
|
|
912
|
+
}
|
|
913
|
+
for (const scene of this._virtualScenes) {
|
|
914
|
+
scene.resetCachedMaterial();
|
|
915
|
+
scene._rebuildGeometries();
|
|
916
|
+
}
|
|
862
917
|
super._rebuildBuffers();
|
|
863
918
|
for (const storageBuffer of this._storageBuffers) {
|
|
864
919
|
// The buffer can already be rebuilt by the call to _rebuildGeometries(), which recreates the storage buffers for the ComputeShaderParticleSystem
|
|
@@ -961,6 +1016,10 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
961
1016
|
_getCurrentRenderPassWrapper() {
|
|
962
1017
|
return this._currentRenderTarget ? this._rttRenderPassWrapper : this._mainRenderPassWrapper;
|
|
963
1018
|
}
|
|
1019
|
+
/** @internal */
|
|
1020
|
+
_flushRenderPassCommands() {
|
|
1021
|
+
this._renderPassCommandBatching?.batcher.flush();
|
|
1022
|
+
}
|
|
964
1023
|
//------------------------------------------------------------------------------
|
|
965
1024
|
// Static Pipeline WebGPU States
|
|
966
1025
|
//------------------------------------------------------------------------------
|
|
@@ -1036,6 +1095,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
1036
1095
|
bundleList.addItem(new WebGPURenderItemViewport(x, y, w, h));
|
|
1037
1096
|
}
|
|
1038
1097
|
else {
|
|
1098
|
+
this._flushRenderPassCommands();
|
|
1039
1099
|
this._getCurrentRenderPass().setViewport(x, y, w, h, 0, 1);
|
|
1040
1100
|
}
|
|
1041
1101
|
}
|
|
@@ -1065,6 +1125,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
1065
1125
|
bundleList.addItem(new WebGPURenderItemScissor(this._scissorCached.x, y, this._scissorCached.z, this._scissorCached.w));
|
|
1066
1126
|
}
|
|
1067
1127
|
else {
|
|
1128
|
+
this._flushRenderPassCommands();
|
|
1068
1129
|
this._getCurrentRenderPass().setScissorRect(this._scissorCached.x, y, this._scissorCached.z, this._scissorCached.w);
|
|
1069
1130
|
}
|
|
1070
1131
|
}
|
|
@@ -1103,6 +1164,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
1103
1164
|
bundleList.addItem(new WebGPURenderItemStencilRef(this._stencilStateComposer.funcRef ?? 0));
|
|
1104
1165
|
}
|
|
1105
1166
|
else {
|
|
1167
|
+
this._flushRenderPassCommands();
|
|
1106
1168
|
this._getCurrentRenderPass().setStencilReference(this._stencilStateComposer.funcRef ?? 0);
|
|
1107
1169
|
}
|
|
1108
1170
|
}
|
|
@@ -1125,6 +1187,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
1125
1187
|
bundleList.addItem(new WebGPURenderItemBlendColor(this._alphaState._blendConstants.slice()));
|
|
1126
1188
|
}
|
|
1127
1189
|
else {
|
|
1190
|
+
this._flushRenderPassCommands();
|
|
1128
1191
|
this._getCurrentRenderPass().setBlendConstant(this._alphaState._blendConstants);
|
|
1129
1192
|
}
|
|
1130
1193
|
}
|
|
@@ -1189,6 +1252,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
1189
1252
|
}
|
|
1190
1253
|
}
|
|
1191
1254
|
_clearFullQuad(clearColor, clearDepth, clearStencil) {
|
|
1255
|
+
this._flushRenderPassCommands();
|
|
1192
1256
|
const renderPass = !this.compatibilityMode ? null : this._getCurrentRenderPass();
|
|
1193
1257
|
this._clearQuad.setColorFormat(this._colorFormat);
|
|
1194
1258
|
this._clearQuad.setDepthStencilFormat(this._depthTextureFormat);
|
|
@@ -2338,6 +2402,14 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
2338
2402
|
get performanceMonitor() {
|
|
2339
2403
|
return this._performanceMonitor;
|
|
2340
2404
|
}
|
|
2405
|
+
_processFrame(timestamp) {
|
|
2406
|
+
if (this.maxFramesInFlight > 0 && this._framesInFlightDevice === this._device && this._framesInFlight >= this.maxFramesInFlight) {
|
|
2407
|
+
// nothing of the frame has started and maxFPS has not counted it
|
|
2408
|
+
this._frameHandler = 0;
|
|
2409
|
+
return;
|
|
2410
|
+
}
|
|
2411
|
+
super._processFrame(timestamp);
|
|
2412
|
+
}
|
|
2341
2413
|
/**
|
|
2342
2414
|
* Begin a new frame
|
|
2343
2415
|
*/
|
|
@@ -2355,6 +2427,9 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
2355
2427
|
this._timestampIndex = 0;
|
|
2356
2428
|
this._internalFrameCounter = 0;
|
|
2357
2429
|
this.flushFramebuffer(true);
|
|
2430
|
+
if (this.maxFramesInFlight > 0) {
|
|
2431
|
+
this._countFrameInFlight();
|
|
2432
|
+
}
|
|
2358
2433
|
this._textureHelper.destroyDeferredTextures();
|
|
2359
2434
|
this._bufferManager.destroyDeferredBuffers();
|
|
2360
2435
|
this.countersLastFrame.numEnableEffects = this._counters.numEnableEffects;
|
|
@@ -2369,10 +2444,51 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
2369
2444
|
this._cacheBindGroups.endFrame();
|
|
2370
2445
|
super.endFrame();
|
|
2371
2446
|
}
|
|
2447
|
+
// The frame is on the GPU until the GPU has done all the work submitted so far: its intermediate flushes too
|
|
2448
|
+
_countFrameInFlight() {
|
|
2449
|
+
const device = this._device;
|
|
2450
|
+
if (this._framesInFlightDevice !== device) {
|
|
2451
|
+
// a new device: the frames of the lost one are not on it
|
|
2452
|
+
this._framesInFlightDevice = device;
|
|
2453
|
+
this._framesInFlight = 0;
|
|
2454
|
+
// one handler for all the frames of the device
|
|
2455
|
+
this._framesInFlightDone = () => {
|
|
2456
|
+
if (this._framesInFlightDevice === device) {
|
|
2457
|
+
this._framesInFlight--;
|
|
2458
|
+
}
|
|
2459
|
+
};
|
|
2460
|
+
}
|
|
2461
|
+
this._framesInFlight++;
|
|
2462
|
+
const done = this._framesInFlightDone;
|
|
2463
|
+
// eslint-disable-next-line github/no-then
|
|
2464
|
+
device.queue.onSubmittedWorkDone().then(done, done);
|
|
2465
|
+
}
|
|
2372
2466
|
/**Gets driver info if available */
|
|
2373
2467
|
extractDriverInfo() {
|
|
2374
2468
|
return "";
|
|
2375
2469
|
}
|
|
2470
|
+
/**
|
|
2471
|
+
* @internal Resolves once the commands recorded until now are submitted, by the next flushFramebuffer (from endFrame or not),
|
|
2472
|
+
* or once the device is lost or the engine disposed. The waits of one submission share one promise.
|
|
2473
|
+
* @returns a promise resolved after the next submission
|
|
2474
|
+
*/
|
|
2475
|
+
// eslint-disable-next-line no-restricted-syntax, @typescript-eslint/promise-function-async -- every wait of a submission shares this one promise, where an async method would make one per wait
|
|
2476
|
+
_whenSubmittedAsync() {
|
|
2477
|
+
if (!this._submitted) {
|
|
2478
|
+
this._submitted = new Promise((resolve) => {
|
|
2479
|
+
this._resolveSubmitted = resolve;
|
|
2480
|
+
});
|
|
2481
|
+
}
|
|
2482
|
+
return this._submitted;
|
|
2483
|
+
}
|
|
2484
|
+
_notifySubmitted() {
|
|
2485
|
+
const resolve = this._resolveSubmitted;
|
|
2486
|
+
if (resolve) {
|
|
2487
|
+
this._submitted = null;
|
|
2488
|
+
this._resolveSubmitted = null;
|
|
2489
|
+
resolve();
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2376
2492
|
/**
|
|
2377
2493
|
* Force a WebGPU flush (ie. a flush of all waiting commands)
|
|
2378
2494
|
* @internal @param _fromEndFrame defines whether the flush is triggered from endFrame or not (default: false)
|
|
@@ -2384,6 +2500,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
2384
2500
|
this._commandBuffers[0] = this._uploadEncoder.finish();
|
|
2385
2501
|
this._commandBuffers[1] = this._renderEncoder.finish();
|
|
2386
2502
|
this._device.queue.submit(this._commandBuffers);
|
|
2503
|
+
this._notifySubmitted();
|
|
2387
2504
|
const frameCounter = this._internalFrameCounter++;
|
|
2388
2505
|
// If flushFramebuffer is called from endFrame, it means the encoders are created for the next frame, but because frameId is not yet incremented at the time of the call, we use frameId + 1
|
|
2389
2506
|
this._uploadEncoderDescriptor.label = `[${_fromEndFrame ? this.frameId + 1 : this.frameId}|${frameCounter}] - UploadEncoder`;
|
|
@@ -2821,6 +2938,39 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
2821
2938
|
this._depthCullingState.cullFace = cullFace;
|
|
2822
2939
|
}
|
|
2823
2940
|
}
|
|
2941
|
+
// The front face of a draw in the current pass (1 = CCW, 2 = CW), for draws whose side is reversed or not (see setState).
|
|
2942
|
+
// Render targets are drawn Y-flipped (see the InternalsUBO yFactor in _draw), so their triangle
|
|
2943
|
+
// winding is reversed here to compensate and keep the same faces visible. XR projection-layer targets
|
|
2944
|
+
// opt out of that flip (_disableEngineYFlip) because the compositor presents them directly, so they
|
|
2945
|
+
// keep the main-framebuffer winding.
|
|
2946
|
+
_getFrontFace(reverseSide) {
|
|
2947
|
+
const invertYRenderTarget = !!this._currentRenderTarget && !this._currentRenderTarget._disableEngineYFlip;
|
|
2948
|
+
return reverseSide ? (invertYRenderTarget ? 1 : 2) : invertYRenderTarget ? 2 : 1;
|
|
2949
|
+
}
|
|
2950
|
+
// The front face of the draws of a mesh with an effect in the current pass, wound as setState does. They go through the sub mesh given,
|
|
2951
|
+
// or else the one drawn with that effect, or else the first one, with the material the draw uses (SubMesh.getMaterial: the scene's default one, a render pass's,
|
|
2952
|
+
// a multi-material's), and the side orientation Mesh.render gives Material._preBind: from the source mesh of an instance, and from the
|
|
2953
|
+
// world matrix of the mesh itself, which the next frame computes (the last one computed can predate a change of its transform). An
|
|
2954
|
+
// instance mirrored against its source is drawn on its own, the others in their source's draw: either way its own determinant's sign
|
|
2955
|
+
// gives the winding
|
|
2956
|
+
_getMeshFrontFace(mesh, effect, subMesh) {
|
|
2957
|
+
const subMeshes = mesh.subMeshes;
|
|
2958
|
+
if (!subMesh && subMeshes) {
|
|
2959
|
+
subMesh = subMeshes[0];
|
|
2960
|
+
for (const candidate of subMeshes) {
|
|
2961
|
+
if (candidate.effect === effect) {
|
|
2962
|
+
subMesh = candidate;
|
|
2963
|
+
break;
|
|
2964
|
+
}
|
|
2965
|
+
}
|
|
2966
|
+
}
|
|
2967
|
+
const material = subMesh?.getMaterial();
|
|
2968
|
+
if (!subMesh || !material) {
|
|
2969
|
+
return this._getFrontFace(false);
|
|
2970
|
+
}
|
|
2971
|
+
mesh.computeWorldMatrix(true);
|
|
2972
|
+
return this._getFrontFace(material._isReverseSide(subMesh.getRenderingMesh()._getDrawSideOrientation(material, mesh)));
|
|
2973
|
+
}
|
|
2824
2974
|
/**
|
|
2825
2975
|
* Set various states to the webGL context
|
|
2826
2976
|
* @param culling defines culling state: true to enable culling, false to disable it
|
|
@@ -2842,24 +2992,24 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
2842
2992
|
this.setZOffset(zOffset);
|
|
2843
2993
|
this.setZOffsetUnits(zOffsetUnits);
|
|
2844
2994
|
// Front face
|
|
2845
|
-
|
|
2846
|
-
// winding is reversed here to compensate and keep the same faces visible. XR projection-layer targets
|
|
2847
|
-
// opt out of that flip (_disableEngineYFlip) because the compositor presents them directly, so they
|
|
2848
|
-
// keep the main-framebuffer winding.
|
|
2849
|
-
const invertYRenderTarget = !!this._currentRenderTarget && !this._currentRenderTarget._disableEngineYFlip;
|
|
2850
|
-
const frontFace = reverseSide ? (invertYRenderTarget ? 1 : 2) : invertYRenderTarget ? 2 : 1;
|
|
2995
|
+
const frontFace = this._getFrontFace(reverseSide);
|
|
2851
2996
|
if (this._depthCullingState.frontFace !== frontFace || force) {
|
|
2852
2997
|
this._depthCullingState.frontFace = frontFace;
|
|
2853
2998
|
}
|
|
2854
2999
|
this._stencilStateComposer.stencilMaterial = stencil;
|
|
2855
3000
|
}
|
|
2856
3001
|
_applyRenderPassChanges(bundleList) {
|
|
3002
|
+
const mustUpdateViewport = this._mustUpdateViewport();
|
|
3003
|
+
const mustUpdateScissor = this._mustUpdateScissor();
|
|
2857
3004
|
const mustUpdateStencilRef = !this._stencilStateComposer.enabled ? false : this._mustUpdateStencilRef();
|
|
2858
3005
|
const mustUpdateBlendColor = !this._alphaState.alphaBlend ? false : this._mustUpdateBlendColor();
|
|
2859
|
-
if (
|
|
3006
|
+
if (mustUpdateViewport || mustUpdateScissor || mustUpdateStencilRef || mustUpdateBlendColor) {
|
|
3007
|
+
this._flushRenderPassCommands();
|
|
3008
|
+
}
|
|
3009
|
+
if (mustUpdateViewport) {
|
|
2860
3010
|
this._applyViewport(bundleList);
|
|
2861
3011
|
}
|
|
2862
|
-
if (
|
|
3012
|
+
if (mustUpdateScissor) {
|
|
2863
3013
|
this._applyScissor(bundleList);
|
|
2864
3014
|
}
|
|
2865
3015
|
if (mustUpdateStencilRef) {
|
|
@@ -2869,7 +3019,25 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
2869
3019
|
this._applyBlendColor(bundleList);
|
|
2870
3020
|
}
|
|
2871
3021
|
}
|
|
2872
|
-
|
|
3022
|
+
// A bit for each texture of the shader that is a depth texture, or a float texture the device can't filter linearly: a draw that binds
|
|
3023
|
+
// one uses a pipeline of its own (see WebGPUMaterialContext.textureState). The draws and createRenderPipelineAsync both derive it here.
|
|
3024
|
+
_getTextureState(webgpuPipelineContext, materialContext) {
|
|
3025
|
+
let textureState = 0;
|
|
3026
|
+
if (materialContext.hasFloatOrDepthTextures) {
|
|
3027
|
+
let bitVal = 1;
|
|
3028
|
+
for (let i = 0; i < webgpuPipelineContext.shaderProcessingContext.textureNames.length; ++i) {
|
|
3029
|
+
const textureName = webgpuPipelineContext.shaderProcessingContext.textureNames[i];
|
|
3030
|
+
const texture = materialContext.textures[textureName]?.texture;
|
|
3031
|
+
const textureIsDepth = texture && texture.format >= 13 && texture.format <= 18;
|
|
3032
|
+
if ((texture?.type === 1 && !this._caps.textureFloatLinearFiltering) || textureIsDepth) {
|
|
3033
|
+
textureState |= bitVal;
|
|
3034
|
+
}
|
|
3035
|
+
bitVal = bitVal << 1;
|
|
3036
|
+
}
|
|
3037
|
+
}
|
|
3038
|
+
return textureState;
|
|
3039
|
+
}
|
|
3040
|
+
_draw(drawKind, fillMode, start, count, instancesCount) {
|
|
2873
3041
|
const renderPass = this._getCurrentRenderPass();
|
|
2874
3042
|
const bundleList = this._bundleList;
|
|
2875
3043
|
this.applyStates();
|
|
@@ -2914,22 +3082,11 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
2914
3082
|
renderPass2 = bundleList.getBundleEncoder(this._cacheRenderPipeline.colorFormats, this._depthTextureFormat, this.currentSampleCount); // for snapshot recording mode
|
|
2915
3083
|
bundleList.numDrawCalls++;
|
|
2916
3084
|
}
|
|
2917
|
-
|
|
2918
|
-
if (this._currentMaterialContext.hasFloatOrDepthTextures) {
|
|
2919
|
-
let bitVal = 1;
|
|
2920
|
-
for (let i = 0; i < webgpuPipelineContext.shaderProcessingContext.textureNames.length; ++i) {
|
|
2921
|
-
const textureName = webgpuPipelineContext.shaderProcessingContext.textureNames[i];
|
|
2922
|
-
const texture = this._currentMaterialContext.textures[textureName]?.texture;
|
|
2923
|
-
const textureIsDepth = texture && texture.format >= 13 && texture.format <= 18;
|
|
2924
|
-
if ((texture?.type === 1 && !this._caps.textureFloatLinearFiltering) || textureIsDepth) {
|
|
2925
|
-
textureState |= bitVal;
|
|
2926
|
-
}
|
|
2927
|
-
bitVal = bitVal << 1;
|
|
2928
|
-
}
|
|
2929
|
-
}
|
|
3085
|
+
const textureState = this._getTextureState(webgpuPipelineContext, this._currentMaterialContext);
|
|
2930
3086
|
this._currentMaterialContext.textureState = textureState;
|
|
2931
3087
|
const pipeline = this._cacheRenderPipeline.getRenderPipeline(fillMode, this._currentEffect, this.currentSampleCount, textureState);
|
|
2932
3088
|
const bindGroups = this._cacheBindGroups.getBindGroups(webgpuPipelineContext, this._currentDrawContext, this._currentMaterialContext);
|
|
3089
|
+
const vertexBuffers = this._cacheRenderPipeline.vertexBuffers;
|
|
2933
3090
|
if (!this._snapshotRendering.record) {
|
|
2934
3091
|
this._applyRenderPassChanges(!this.compatibilityMode ? bundleList : null);
|
|
2935
3092
|
if (!this.compatibilityMode) {
|
|
@@ -2941,13 +3098,45 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
2941
3098
|
});
|
|
2942
3099
|
}
|
|
2943
3100
|
}
|
|
2944
|
-
|
|
3101
|
+
const nonCompatMode = !this.compatibilityMode && !this._snapshotRendering.record;
|
|
3102
|
+
const indirectDrawBuffer = (nonCompatMode || this._currentDrawContext._enableIndirectDrawInCompatMode) && this._currentDrawContext.indirectDrawBuffer
|
|
3103
|
+
? this._currentDrawContext.indirectDrawBuffer
|
|
3104
|
+
: null;
|
|
3105
|
+
if (indirectDrawBuffer) {
|
|
3106
|
+
this._currentDrawContext.setIndirectData(count, instancesCount || 1, start);
|
|
3107
|
+
}
|
|
3108
|
+
const commandBatching = this._renderPassCommandRecorderProvider && this._renderPassCommandBatching;
|
|
3109
|
+
if (commandBatching && this.compatibilityMode && !this._snapshotRendering.record) {
|
|
3110
|
+
let drawCommand;
|
|
3111
|
+
if (drawKind === WebGPURenderPassDrawKind.INDEXED) {
|
|
3112
|
+
const indexedDrawCommand = commandBatching.indexedDrawCommand;
|
|
3113
|
+
indexedDrawCommand.indexBuffer = this._currentIndexBuffer;
|
|
3114
|
+
indexedDrawCommand.indexFormat = this._currentIndexBuffer.is32Bits ? "uint32" /* WebGPUConstants.IndexFormat.Uint32 */ : "uint16" /* WebGPUConstants.IndexFormat.Uint16 */;
|
|
3115
|
+
drawCommand = indexedDrawCommand;
|
|
3116
|
+
}
|
|
3117
|
+
else {
|
|
3118
|
+
drawCommand = commandBatching.nonIndexedDrawCommand;
|
|
3119
|
+
}
|
|
3120
|
+
drawCommand.renderPass = renderPass2;
|
|
3121
|
+
drawCommand.pipeline = pipeline;
|
|
3122
|
+
drawCommand.bindGroups = bindGroups;
|
|
3123
|
+
drawCommand.vertexBuffers = vertexBuffers;
|
|
3124
|
+
drawCommand.count = count;
|
|
3125
|
+
drawCommand.instancesCount = instancesCount;
|
|
3126
|
+
drawCommand.start = start;
|
|
3127
|
+
drawCommand.indirectDrawBuffer = indirectDrawBuffer;
|
|
3128
|
+
commandBatching.batcher.submit(drawCommand);
|
|
3129
|
+
this._reportDrawCall();
|
|
3130
|
+
return;
|
|
3131
|
+
}
|
|
3132
|
+
// A provider can have pending compatibility-mode draws when switching to bundle recording.
|
|
3133
|
+
if (commandBatching) {
|
|
3134
|
+
commandBatching.batcher.flush();
|
|
3135
|
+
}
|
|
2945
3136
|
renderPass2.setPipeline(pipeline);
|
|
2946
|
-
// bind index/vertex buffers
|
|
2947
3137
|
if (this._currentIndexBuffer) {
|
|
2948
3138
|
renderPass2.setIndexBuffer(this._currentIndexBuffer.underlyingResource, this._currentIndexBuffer.is32Bits ? "uint32" /* WebGPUConstants.IndexFormat.Uint32 */ : "uint16" /* WebGPUConstants.IndexFormat.Uint16 */, 0);
|
|
2949
3139
|
}
|
|
2950
|
-
const vertexBuffers = this._cacheRenderPipeline.vertexBuffers;
|
|
2951
3140
|
for (let index = 0; index < vertexBuffers.length; index++) {
|
|
2952
3141
|
const vertexBuffer = vertexBuffers[index];
|
|
2953
3142
|
const buffer = vertexBuffer.effectiveBuffer;
|
|
@@ -2955,22 +3144,18 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
2955
3144
|
renderPass2.setVertexBuffer(index, buffer.underlyingResource, vertexBuffer._validOffsetRange ? 0 : vertexBuffer.byteOffset);
|
|
2956
3145
|
}
|
|
2957
3146
|
}
|
|
2958
|
-
// bind bind groups
|
|
2959
3147
|
for (let i = 0; i < bindGroups.length; i++) {
|
|
2960
3148
|
renderPass2.setBindGroup(i, bindGroups[i]);
|
|
2961
3149
|
}
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
this._currentDrawContext.setIndirectData(count, instancesCount || 1, start);
|
|
2966
|
-
if (drawType === 0) {
|
|
2967
|
-
renderPass2.drawIndexedIndirect(this._currentDrawContext.indirectDrawBuffer, 0);
|
|
3150
|
+
if (indirectDrawBuffer) {
|
|
3151
|
+
if (drawKind === WebGPURenderPassDrawKind.INDEXED) {
|
|
3152
|
+
renderPass2.drawIndexedIndirect(indirectDrawBuffer, 0);
|
|
2968
3153
|
}
|
|
2969
3154
|
else {
|
|
2970
|
-
renderPass2.drawIndirect(
|
|
3155
|
+
renderPass2.drawIndirect(indirectDrawBuffer, 0);
|
|
2971
3156
|
}
|
|
2972
3157
|
}
|
|
2973
|
-
else if (
|
|
3158
|
+
else if (drawKind === WebGPURenderPassDrawKind.INDEXED) {
|
|
2974
3159
|
renderPass2.drawIndexed(count, instancesCount || 1, start, 0, 0);
|
|
2975
3160
|
}
|
|
2976
3161
|
else {
|
|
@@ -2990,7 +3175,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
2990
3175
|
* @param instancesCount defines the number of instances to draw (if instantiation is enabled)
|
|
2991
3176
|
*/
|
|
2992
3177
|
drawElementsType(fillMode, indexStart, indexCount, instancesCount = 1) {
|
|
2993
|
-
this._draw(
|
|
3178
|
+
this._draw(WebGPURenderPassDrawKind.INDEXED, fillMode, indexStart, indexCount, instancesCount);
|
|
2994
3179
|
}
|
|
2995
3180
|
/**
|
|
2996
3181
|
* Draw a list of unindexed primitives
|
|
@@ -3001,7 +3186,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
3001
3186
|
*/
|
|
3002
3187
|
drawArraysType(fillMode, verticesStart, verticesCount, instancesCount = 1) {
|
|
3003
3188
|
this._currentIndexBuffer = null;
|
|
3004
|
-
this._draw(
|
|
3189
|
+
this._draw(WebGPURenderPassDrawKind.NON_INDEXED, fillMode, verticesStart, verticesCount, instancesCount);
|
|
3005
3190
|
}
|
|
3006
3191
|
//------------------------------------------------------------------------------
|
|
3007
3192
|
// Async Pipeline Pre-Warming
|
|
@@ -3059,14 +3244,23 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
3059
3244
|
// Rasterization state
|
|
3060
3245
|
cache.setCullEnabled(entry.cullEnabled ?? true);
|
|
3061
3246
|
cache.setCullFace(entry.cullFace ?? 1);
|
|
3062
|
-
cache.setFrontFace(entry.frontFace ??
|
|
3247
|
+
cache.setFrontFace(entry.frontFace ?? this._getMeshFrontFace(entry.mesh, entry.effect, entry.subMesh));
|
|
3063
3248
|
// Write mask
|
|
3064
3249
|
cache.setWriteMask(entry.writeMask ?? 0xf);
|
|
3065
3250
|
// Stencil
|
|
3066
3251
|
cache.setStencilEnabled(entry.stencilEnabled ?? false);
|
|
3067
3252
|
const fillMode = entry.fillMode ?? 0;
|
|
3068
3253
|
const sampleCount = entry.sampleCount ?? this.currentSampleCount;
|
|
3069
|
-
|
|
3254
|
+
// the texture state a draw gets from the same textures
|
|
3255
|
+
let textureState = 0;
|
|
3256
|
+
if (entry.textures) {
|
|
3257
|
+
const materialContext = new WebGPUMaterialContext();
|
|
3258
|
+
for (const name in entry.textures) {
|
|
3259
|
+
materialContext.setTexture(name, entry.textures[name]);
|
|
3260
|
+
}
|
|
3261
|
+
textureState = this._getTextureState(entry.effect._pipelineContext, materialContext);
|
|
3262
|
+
}
|
|
3263
|
+
const promise = cache.preWarmPipeline(fillMode, entry.effect, sampleCount, textureState);
|
|
3070
3264
|
if (promise) {
|
|
3071
3265
|
promises.push(promise);
|
|
3072
3266
|
}
|
|
@@ -3090,13 +3284,15 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
3090
3284
|
*/
|
|
3091
3285
|
dispose() {
|
|
3092
3286
|
this._isDisposed = true;
|
|
3287
|
+
// the commands not submitted yet never will be: their readbacks go on, and return nothing
|
|
3288
|
+
this._resolveSubmitted?.();
|
|
3093
3289
|
this.hideLoadingUI?.();
|
|
3094
|
-
this._timestampQuery
|
|
3290
|
+
this._timestampQuery?.dispose();
|
|
3095
3291
|
this._mainTexture?.destroy();
|
|
3096
3292
|
this._depthTexture?.destroy();
|
|
3097
|
-
this._textureHelper
|
|
3098
|
-
this._bufferManager
|
|
3099
|
-
this._device
|
|
3293
|
+
this._textureHelper?.destroyDeferredTextures();
|
|
3294
|
+
this._bufferManager?.destroyDeferredBuffers();
|
|
3295
|
+
this._device?.destroy();
|
|
3100
3296
|
_CommonDispose(this, this._renderingCanvas);
|
|
3101
3297
|
super.dispose();
|
|
3102
3298
|
// If this was the last WebGPU engine, reset the static caches shared by all WebGPU engines
|