@babylonjs/core 5.0.0-beta.3 → 5.0.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Actions/actionManager.d.ts +1 -1
- package/Actions/actionManager.js +5 -1
- package/Actions/actionManager.js.map +1 -1
- package/Audio/analyser.d.ts +2 -1
- package/Audio/analyser.js +5 -0
- package/Audio/analyser.js.map +1 -1
- package/Audio/audioSceneComponent.d.ts +1 -1
- package/Audio/audioSceneComponent.js +5 -0
- package/Audio/audioSceneComponent.js.map +1 -1
- package/Audio/sound.d.ts +1 -1
- package/Audio/sound.js +8 -1
- package/Audio/sound.js.map +1 -1
- package/Audio/soundTrack.d.ts +2 -1
- package/Audio/soundTrack.js +5 -0
- package/Audio/soundTrack.js.map +1 -1
- package/BakedVertexAnimation/bakedVertexAnimationManager.d.ts +1 -1
- package/BakedVertexAnimation/bakedVertexAnimationManager.js +5 -0
- package/BakedVertexAnimation/bakedVertexAnimationManager.js.map +1 -1
- package/Behaviors/Meshes/baseSixDofDragBehavior.js +29 -26
- package/Behaviors/Meshes/baseSixDofDragBehavior.js.map +1 -1
- package/Behaviors/Meshes/pointerDragBehavior.js +2 -0
- package/Behaviors/Meshes/pointerDragBehavior.js.map +1 -1
- package/Bones/bone.d.ts +2 -1
- package/Bones/bone.js +28 -18
- package/Bones/bone.js.map +1 -1
- package/Bones/skeleton.js +3 -3
- package/Bones/skeleton.js.map +1 -1
- package/Buffers/buffer.d.ts +4 -0
- package/Buffers/buffer.js +13 -3
- package/Buffers/buffer.js.map +1 -1
- package/Cameras/Inputs/freeCameraMouseInput.d.ts +1 -0
- package/Cameras/Inputs/freeCameraMouseInput.js +6 -3
- package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraTouchInput.js +2 -4
- package/Cameras/Inputs/freeCameraTouchInput.js.map +1 -1
- package/Cameras/Stereoscopic/anaglyphArcRotateCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/anaglyphArcRotateCamera.js.map +1 -1
- package/Cameras/Stereoscopic/anaglyphFreeCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/anaglyphFreeCamera.js.map +1 -1
- package/Cameras/Stereoscopic/anaglyphGamepadCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/anaglyphGamepadCamera.js.map +1 -1
- package/Cameras/Stereoscopic/anaglyphUniversalCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/anaglyphUniversalCamera.js.map +1 -1
- package/Cameras/Stereoscopic/stereoscopicArcRotateCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/stereoscopicArcRotateCamera.js.map +1 -1
- package/Cameras/Stereoscopic/stereoscopicFreeCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/stereoscopicFreeCamera.js.map +1 -1
- package/Cameras/Stereoscopic/stereoscopicGamepadCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/stereoscopicGamepadCamera.js.map +1 -1
- package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js.map +1 -1
- package/Cameras/Stereoscopic/stereoscopicUniversalCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/stereoscopicUniversalCamera.js.map +1 -1
- package/Cameras/VR/vrDeviceOrientationArcRotateCamera.d.ts +1 -1
- package/Cameras/VR/vrDeviceOrientationArcRotateCamera.js.map +1 -1
- package/Cameras/VR/vrDeviceOrientationFreeCamera.d.ts +1 -1
- package/Cameras/VR/vrDeviceOrientationFreeCamera.js.map +1 -1
- package/Cameras/VR/vrDeviceOrientationGamepadCamera.d.ts +1 -1
- package/Cameras/VR/vrDeviceOrientationGamepadCamera.js.map +1 -1
- package/Cameras/VR/vrExperienceHelper.d.ts +1 -0
- package/Cameras/VR/vrExperienceHelper.js +1 -0
- package/Cameras/VR/vrExperienceHelper.js.map +1 -1
- package/Cameras/VR/webVRCamera.d.ts +2 -1
- package/Cameras/VR/webVRCamera.js +3 -2
- package/Cameras/VR/webVRCamera.js.map +1 -1
- package/Cameras/arcRotateCamera.d.ts +1 -1
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Cameras/camera.d.ts +1 -1
- package/Cameras/camera.js +1 -1
- package/Cameras/camera.js.map +1 -1
- package/Cameras/deviceOrientationCamera.d.ts +1 -1
- package/Cameras/deviceOrientationCamera.js.map +1 -1
- package/Cameras/flyCamera.d.ts +1 -1
- package/Cameras/flyCamera.js.map +1 -1
- package/Cameras/followCamera.d.ts +1 -1
- package/Cameras/followCamera.js.map +1 -1
- package/Cameras/freeCamera.d.ts +1 -1
- package/Cameras/freeCamera.js.map +1 -1
- package/Cameras/gamepadCamera.d.ts +1 -1
- package/Cameras/gamepadCamera.js.map +1 -1
- package/Cameras/targetCamera.d.ts +1 -1
- package/Cameras/targetCamera.js.map +1 -1
- package/Cameras/touchCamera.d.ts +1 -1
- package/Cameras/touchCamera.js.map +1 -1
- package/Cameras/universalCamera.d.ts +1 -1
- package/Cameras/universalCamera.js.map +1 -1
- package/Cameras/virtualJoysticksCamera.d.ts +1 -1
- package/Cameras/virtualJoysticksCamera.js.map +1 -1
- package/Collisions/collider.d.ts +1 -1
- package/Collisions/collider.js +48 -2
- package/Collisions/collider.js.map +1 -1
- package/Compute/computeEffect.js +2 -2
- package/Compute/computeEffect.js.map +1 -1
- package/Culling/Octrees/octreeSceneComponent.d.ts +1 -1
- package/Culling/Octrees/octreeSceneComponent.js +5 -0
- package/Culling/Octrees/octreeSceneComponent.js.map +1 -1
- package/Culling/ray.d.ts +6 -4
- package/Culling/ray.js +31 -10
- package/Culling/ray.js.map +1 -1
- package/Debug/axesViewer.d.ts +1 -1
- package/Debug/axesViewer.js +5 -0
- package/Debug/axesViewer.js.map +1 -1
- package/Debug/debugLayer.d.ts +1 -1
- package/Debug/debugLayer.js +6 -2
- package/Debug/debugLayer.js.map +1 -1
- package/Debug/physicsViewer.d.ts +1 -1
- package/Debug/physicsViewer.js +3 -0
- package/Debug/physicsViewer.js.map +1 -1
- package/DeviceInput/Helpers/eventFactory.d.ts +1 -1
- package/DeviceInput/Helpers/eventFactory.js +2 -5
- package/DeviceInput/Helpers/eventFactory.js.map +1 -1
- package/DeviceInput/InputDevices/deviceEnums.d.ts +55 -2
- package/DeviceInput/InputDevices/deviceEnums.js +54 -0
- package/DeviceInput/InputDevices/deviceEnums.js.map +1 -1
- package/DeviceInput/InputDevices/deviceSource.d.ts +35 -0
- package/DeviceInput/InputDevices/deviceSource.js +38 -0
- package/DeviceInput/InputDevices/deviceSource.js.map +1 -0
- package/DeviceInput/InputDevices/deviceSourceManager.d.ts +14 -72
- package/DeviceInput/InputDevices/deviceSourceManager.js +10 -180
- package/DeviceInput/InputDevices/deviceSourceManager.js.map +1 -1
- package/DeviceInput/InputDevices/deviceTypes.d.ts +2 -2
- package/DeviceInput/InputDevices/deviceTypes.js.map +1 -1
- package/DeviceInput/{Interfaces → InputDevices}/inputInterfaces.d.ts +1 -5
- package/DeviceInput/{Interfaces → InputDevices}/inputInterfaces.js +0 -0
- package/DeviceInput/InputDevices/inputInterfaces.js.map +1 -0
- package/DeviceInput/InputDevices/internalDeviceSourceManager.d.ts +46 -0
- package/DeviceInput/InputDevices/internalDeviceSourceManager.js +144 -0
- package/DeviceInput/InputDevices/internalDeviceSourceManager.js.map +1 -0
- package/DeviceInput/{Implementations → InputDevices}/nativeDeviceInputSystem.d.ts +3 -7
- package/DeviceInput/{Implementations → InputDevices}/nativeDeviceInputSystem.js +11 -16
- package/DeviceInput/InputDevices/nativeDeviceInputSystem.js.map +1 -0
- package/DeviceInput/{Implementations → InputDevices}/webDeviceInputSystem.d.ts +11 -15
- package/DeviceInput/{Implementations → InputDevices}/webDeviceInputSystem.js +121 -146
- package/DeviceInput/InputDevices/webDeviceInputSystem.js.map +1 -0
- package/DeviceInput/index.d.ts +1 -5
- package/DeviceInput/index.js +1 -5
- package/DeviceInput/index.js.map +1 -1
- package/Engines/Extensions/engine.cubeTexture.d.ts +1 -1
- package/Engines/Extensions/engine.cubeTexture.js +6 -2
- package/Engines/Extensions/engine.cubeTexture.js.map +1 -1
- package/Engines/Extensions/engine.multiview.d.ts +5 -0
- package/Engines/Extensions/engine.multiview.js +4 -1
- package/Engines/Extensions/engine.multiview.js.map +1 -1
- package/Engines/Native/nativeInterfaces.d.ts +3 -2
- package/Engines/Native/nativeInterfaces.js.map +1 -1
- package/Engines/Processors/Expressions/shaderDefineExpression.js +1 -1
- package/Engines/Processors/Expressions/shaderDefineExpression.js.map +1 -1
- package/Engines/Processors/shaderCodeInliner.js +13 -13
- package/Engines/Processors/shaderCodeInliner.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.cubeTexture.js +4 -1
- package/Engines/WebGPU/Extensions/engine.cubeTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheBindGroups.js +9 -9
- package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuComputeContext.js +1 -1
- package/Engines/WebGPU/webgpuComputeContext.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js +13 -13
- package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +30 -30
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.js +13 -6
- package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
- package/Engines/engine.d.ts +2 -6
- package/Engines/engine.js +1 -5
- package/Engines/engine.js.map +1 -1
- package/Engines/engineCapabilities.d.ts +4 -0
- package/Engines/engineCapabilities.js.map +1 -1
- package/Engines/nativeEngine.d.ts +1 -0
- package/Engines/nativeEngine.js +39 -12
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.js +3 -1
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/renderTargetWrapper.d.ts +8 -0
- package/Engines/renderTargetWrapper.js +20 -0
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/thinEngine.d.ts +17 -1
- package/Engines/thinEngine.js +50 -20
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +0 -4
- package/Engines/webgpuEngine.js +7 -14
- package/Engines/webgpuEngine.js.map +1 -1
- package/Gamepads/Controllers/daydreamController.js +1 -1
- package/Gamepads/Controllers/daydreamController.js.map +1 -1
- package/Gamepads/Controllers/oculusTouchController.js +2 -2
- package/Gamepads/Controllers/oculusTouchController.js.map +1 -1
- package/Gamepads/Controllers/webVRController.d.ts +1 -0
- package/Gamepads/Controllers/webVRController.js +1 -0
- package/Gamepads/Controllers/webVRController.js.map +1 -1
- package/Gamepads/gamepadManager.js +1 -1
- package/Gamepads/gamepadManager.js.map +1 -1
- package/Gizmos/gizmoManager.d.ts +2 -0
- package/Gizmos/gizmoManager.js +28 -24
- package/Gizmos/gizmoManager.js.map +1 -1
- package/Helpers/sceneHelpers.d.ts +1 -0
- package/Helpers/sceneHelpers.js.map +1 -1
- package/Inputs/scene.inputManager.d.ts +2 -2
- package/Inputs/scene.inputManager.js +11 -13
- package/Inputs/scene.inputManager.js.map +1 -1
- package/Instrumentation/sceneInstrumentation.js +2 -2
- package/Instrumentation/sceneInstrumentation.js.map +1 -1
- package/Layers/effectLayer.d.ts +1 -1
- package/Layers/effectLayer.js +1 -1
- package/Layers/effectLayer.js.map +1 -1
- package/Layers/effectLayerSceneComponent.d.ts +1 -1
- package/Layers/effectLayerSceneComponent.js +7 -3
- package/Layers/effectLayerSceneComponent.js.map +1 -1
- package/Layers/glowLayer.d.ts +1 -1
- package/Layers/glowLayer.js.map +1 -1
- package/Layers/highlightLayer.d.ts +1 -1
- package/Layers/highlightLayer.js +2 -1
- package/Layers/highlightLayer.js.map +1 -1
- package/Layers/layer.d.ts +2 -2
- package/Layers/layer.js.map +1 -1
- package/Layers/layerSceneComponent.d.ts +1 -1
- package/Layers/layerSceneComponent.js +7 -3
- package/Layers/layerSceneComponent.js.map +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js +2 -2
- package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +2 -2
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js +115 -29
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Loading/loadingScreen.js +8 -8
- package/Loading/loadingScreen.js.map +1 -1
- package/Loading/sceneLoader.js +3 -3
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/Background/backgroundMaterial.d.ts +1 -1
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/Node/Blocks/Dual/clipPlanesBlock.d.ts +37 -0
- package/Materials/Node/Blocks/Dual/clipPlanesBlock.js +117 -0
- package/Materials/Node/Blocks/Dual/clipPlanesBlock.js.map +1 -0
- package/Materials/Node/Blocks/Dual/currentScreenBlock.js +12 -12
- package/Materials/Node/Blocks/Dual/currentScreenBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/fogBlock.js +5 -5
- package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js +13 -13
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/index.d.ts +1 -0
- package/Materials/Node/Blocks/Dual/index.js +1 -0
- package/Materials/Node/Blocks/Dual/index.js.map +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.js +10 -10
- package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +28 -28
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBlock.js +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.js +7 -7
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/textureBlock.js +32 -32
- package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/derivativeBlock.js +2 -2
- package/Materials/Node/Blocks/Fragment/derivativeBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/discardBlock.js +1 -1
- package/Materials/Node/Blocks/Fragment/discardBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragCoordBlock.js +1 -1
- package/Materials/Node/Blocks/Fragment/fragCoordBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +10 -10
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js +7 -7
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +12 -12
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/screenSizeBlock.js +1 -1
- package/Materials/Node/Blocks/Fragment/screenSizeBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/screenSpaceBlock.js +7 -7
- package/Materials/Node/Blocks/Fragment/screenSpaceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/twirlBlock.js +4 -4
- package/Materials/Node/Blocks/Fragment/twirlBlock.js.map +1 -1
- package/Materials/Node/Blocks/Input/inputBlock.d.ts +2 -1
- package/Materials/Node/Blocks/Input/inputBlock.js +29 -24
- package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/anisotropyBlock.js +5 -5
- package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js +5 -5
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +33 -33
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/reflectionBlock.js +11 -11
- package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/refractionBlock.js +11 -11
- package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/sheenBlock.js +3 -3
- package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +1 -1
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Particle/particleBlendMultiplyBlock.js +1 -1
- package/Materials/Node/Blocks/Particle/particleBlendMultiplyBlock.js.map +1 -1
- package/Materials/Node/Blocks/Particle/particleRampGradientBlock.js +1 -1
- package/Materials/Node/Blocks/Particle/particleRampGradientBlock.js.map +1 -1
- package/Materials/Node/Blocks/Particle/particleTextureBlock.js +7 -7
- package/Materials/Node/Blocks/Particle/particleTextureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/bonesBlock.js +3 -3
- package/Materials/Node/Blocks/Vertex/bonesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/instancesBlock.js +3 -3
- package/Materials/Node/Blocks/Vertex/instancesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/lightInformationBlock.js +5 -5
- package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +16 -16
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js +1 -1
- package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/addBlock.js +1 -1
- package/Materials/Node/Blocks/addBlock.js.map +1 -1
- package/Materials/Node/Blocks/arcTan2Block.js +1 -1
- package/Materials/Node/Blocks/arcTan2Block.js.map +1 -1
- package/Materials/Node/Blocks/clampBlock.js +3 -3
- package/Materials/Node/Blocks/clampBlock.js.map +1 -1
- package/Materials/Node/Blocks/cloudBlock.js +7 -7
- package/Materials/Node/Blocks/cloudBlock.js.map +1 -1
- package/Materials/Node/Blocks/colorMergerBlock.js +8 -8
- package/Materials/Node/Blocks/colorMergerBlock.js.map +1 -1
- package/Materials/Node/Blocks/colorSplitterBlock.js +5 -5
- package/Materials/Node/Blocks/colorSplitterBlock.js.map +1 -1
- package/Materials/Node/Blocks/conditionalBlock.js +10 -10
- package/Materials/Node/Blocks/conditionalBlock.js.map +1 -1
- package/Materials/Node/Blocks/crossBlock.js +1 -1
- package/Materials/Node/Blocks/crossBlock.js.map +1 -1
- package/Materials/Node/Blocks/customBlock.js +1 -1
- package/Materials/Node/Blocks/customBlock.js.map +1 -1
- package/Materials/Node/Blocks/desaturateBlock.js +4 -4
- package/Materials/Node/Blocks/desaturateBlock.js.map +1 -1
- package/Materials/Node/Blocks/distanceBlock.js +1 -1
- package/Materials/Node/Blocks/distanceBlock.js.map +1 -1
- package/Materials/Node/Blocks/divideBlock.js +1 -1
- package/Materials/Node/Blocks/divideBlock.js.map +1 -1
- package/Materials/Node/Blocks/dotBlock.js +1 -1
- package/Materials/Node/Blocks/dotBlock.js.map +1 -1
- package/Materials/Node/Blocks/elbowBlock.d.ts +27 -0
- package/Materials/Node/Blocks/elbowBlock.js +60 -0
- package/Materials/Node/Blocks/elbowBlock.js.map +1 -0
- package/Materials/Node/Blocks/fresnelBlock.js +2 -2
- package/Materials/Node/Blocks/fresnelBlock.js.map +1 -1
- package/Materials/Node/Blocks/gradientBlock.js +8 -8
- package/Materials/Node/Blocks/gradientBlock.js.map +1 -1
- package/Materials/Node/Blocks/index.d.ts +1 -0
- package/Materials/Node/Blocks/index.js +1 -0
- package/Materials/Node/Blocks/index.js.map +1 -1
- package/Materials/Node/Blocks/lengthBlock.js +1 -1
- package/Materials/Node/Blocks/lengthBlock.js.map +1 -1
- package/Materials/Node/Blocks/lerpBlock.js +1 -1
- package/Materials/Node/Blocks/lerpBlock.js.map +1 -1
- package/Materials/Node/Blocks/matrixBuilderBlock.js +1 -1
- package/Materials/Node/Blocks/matrixBuilderBlock.js.map +1 -1
- package/Materials/Node/Blocks/maxBlock.js +1 -1
- package/Materials/Node/Blocks/maxBlock.js.map +1 -1
- package/Materials/Node/Blocks/minBlock.js +1 -1
- package/Materials/Node/Blocks/minBlock.js.map +1 -1
- package/Materials/Node/Blocks/modBlock.js +1 -1
- package/Materials/Node/Blocks/modBlock.js.map +1 -1
- package/Materials/Node/Blocks/multiplyBlock.js +1 -1
- package/Materials/Node/Blocks/multiplyBlock.js.map +1 -1
- package/Materials/Node/Blocks/nLerpBlock.js +1 -1
- package/Materials/Node/Blocks/nLerpBlock.js.map +1 -1
- package/Materials/Node/Blocks/negateBlock.js +1 -1
- package/Materials/Node/Blocks/negateBlock.js.map +1 -1
- package/Materials/Node/Blocks/normalBlendBlock.js +5 -5
- package/Materials/Node/Blocks/normalBlendBlock.js.map +1 -1
- package/Materials/Node/Blocks/normalizeBlock.js +1 -1
- package/Materials/Node/Blocks/normalizeBlock.js.map +1 -1
- package/Materials/Node/Blocks/oneMinusBlock.js +1 -1
- package/Materials/Node/Blocks/oneMinusBlock.js.map +1 -1
- package/Materials/Node/Blocks/posterizeBlock.js +1 -1
- package/Materials/Node/Blocks/posterizeBlock.js.map +1 -1
- package/Materials/Node/Blocks/powBlock.js +1 -1
- package/Materials/Node/Blocks/powBlock.js.map +1 -1
- package/Materials/Node/Blocks/randomNumberBlock.js +2 -2
- package/Materials/Node/Blocks/randomNumberBlock.js.map +1 -1
- package/Materials/Node/Blocks/reciprocalBlock.js +1 -1
- package/Materials/Node/Blocks/reciprocalBlock.js.map +1 -1
- package/Materials/Node/Blocks/reflectBlock.js +1 -1
- package/Materials/Node/Blocks/reflectBlock.js.map +1 -1
- package/Materials/Node/Blocks/refractBlock.js +1 -1
- package/Materials/Node/Blocks/refractBlock.js.map +1 -1
- package/Materials/Node/Blocks/remapBlock.js +3 -3
- package/Materials/Node/Blocks/remapBlock.js.map +1 -1
- package/Materials/Node/Blocks/replaceColorBlock.js +3 -3
- package/Materials/Node/Blocks/replaceColorBlock.js.map +1 -1
- package/Materials/Node/Blocks/rotate2dBlock.js +1 -1
- package/Materials/Node/Blocks/rotate2dBlock.js.map +1 -1
- package/Materials/Node/Blocks/scaleBlock.js +1 -1
- package/Materials/Node/Blocks/scaleBlock.js.map +1 -1
- package/Materials/Node/Blocks/simplexPerlin3DBlock.js +1 -1
- package/Materials/Node/Blocks/simplexPerlin3DBlock.js.map +1 -1
- package/Materials/Node/Blocks/smoothStepBlock.js +1 -1
- package/Materials/Node/Blocks/smoothStepBlock.js.map +1 -1
- package/Materials/Node/Blocks/stepBlock.js +1 -1
- package/Materials/Node/Blocks/stepBlock.js.map +1 -1
- package/Materials/Node/Blocks/subtractBlock.js +1 -1
- package/Materials/Node/Blocks/subtractBlock.js.map +1 -1
- package/Materials/Node/Blocks/transformBlock.js +13 -13
- package/Materials/Node/Blocks/transformBlock.js.map +1 -1
- package/Materials/Node/Blocks/trigonometryBlock.js +2 -2
- package/Materials/Node/Blocks/trigonometryBlock.js.map +1 -1
- package/Materials/Node/Blocks/vectorMergerBlock.js +22 -22
- package/Materials/Node/Blocks/vectorMergerBlock.js.map +1 -1
- package/Materials/Node/Blocks/vectorSplitterBlock.js +8 -8
- package/Materials/Node/Blocks/vectorSplitterBlock.js.map +1 -1
- package/Materials/Node/Blocks/viewDirectionBlock.js +1 -1
- package/Materials/Node/Blocks/viewDirectionBlock.js.map +1 -1
- package/Materials/Node/Blocks/voronoiNoiseBlock.js +5 -5
- package/Materials/Node/Blocks/voronoiNoiseBlock.js.map +1 -1
- package/Materials/Node/Blocks/waveBlock.js +3 -3
- package/Materials/Node/Blocks/waveBlock.js.map +1 -1
- package/Materials/Node/Blocks/worleyNoise3DBlock.js +5 -5
- package/Materials/Node/Blocks/worleyNoise3DBlock.js.map +1 -1
- package/Materials/Node/Enums/nodeMaterialSystemValues.d.ts +3 -1
- package/Materials/Node/Enums/nodeMaterialSystemValues.js +2 -0
- package/Materials/Node/Enums/nodeMaterialSystemValues.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +4 -0
- package/Materials/Node/nodeMaterial.js +22 -11
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBlock.js +12 -12
- package/Materials/Node/nodeMaterialBlock.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.js +24 -24
- package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildStateSharedData.js +1 -1
- package/Materials/Node/nodeMaterialBuildStateSharedData.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.d.ts +2 -1
- package/Materials/PBR/pbrBaseMaterial.js +4 -3
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/PBR/pbrBaseSimpleMaterial.d.ts +1 -1
- package/Materials/PBR/pbrBaseSimpleMaterial.js.map +1 -1
- package/Materials/PBR/pbrMaterial.d.ts +1 -1
- package/Materials/PBR/pbrMaterial.js +2 -3
- package/Materials/PBR/pbrMaterial.js.map +1 -1
- package/Materials/PBR/pbrMetallicRoughnessMaterial.d.ts +1 -1
- package/Materials/PBR/pbrMetallicRoughnessMaterial.js.map +1 -1
- package/Materials/PBR/pbrSpecularGlossinessMaterial.d.ts +1 -1
- package/Materials/PBR/pbrSpecularGlossinessMaterial.js.map +1 -1
- package/Materials/Textures/Loaders/ddsTextureLoader.js +8 -1
- package/Materials/Textures/Loaders/ddsTextureLoader.js.map +1 -1
- package/Materials/Textures/Loaders/ktxTextureLoader.js +2 -2
- package/Materials/Textures/Loaders/ktxTextureLoader.js.map +1 -1
- package/Materials/Textures/MultiviewRenderTarget.d.ts +2 -1
- package/Materials/Textures/MultiviewRenderTarget.js +10 -2
- package/Materials/Textures/MultiviewRenderTarget.js.map +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.js +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
- package/Materials/Textures/baseTexture.d.ts +1 -1
- package/Materials/Textures/baseTexture.js.map +1 -1
- package/Materials/Textures/equiRectangularCubeTexture.js +1 -1
- package/Materials/Textures/equiRectangularCubeTexture.js.map +1 -1
- package/Materials/Textures/internalTexture.d.ts +2 -0
- package/Materials/Textures/internalTexture.js +2 -0
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Materials/Textures/mirrorTexture.d.ts +2 -2
- package/Materials/Textures/mirrorTexture.js +7 -3
- package/Materials/Textures/mirrorTexture.js.map +1 -1
- package/Materials/Textures/multiRenderTarget.d.ts +1 -1
- package/Materials/Textures/multiRenderTarget.js.map +1 -1
- package/Materials/Textures/prePassRenderTarget.d.ts +1 -1
- package/Materials/Textures/prePassRenderTarget.js.map +1 -1
- package/Materials/Textures/refractionTexture.d.ts +1 -1
- package/Materials/Textures/refractionTexture.js +2 -2
- package/Materials/Textures/refractionTexture.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.d.ts +1 -1
- package/Materials/Textures/renderTargetTexture.js +2 -2
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/texture.d.ts +1 -1
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/Textures/videoTexture.js +1 -0
- package/Materials/Textures/videoTexture.js.map +1 -1
- package/Materials/effect.js +3 -3
- package/Materials/effect.js.map +1 -1
- package/Materials/material.d.ts +3 -1
- package/Materials/material.js +11 -3
- package/Materials/material.js.map +1 -1
- package/Materials/materialHelper.js +9 -1
- package/Materials/materialHelper.js.map +1 -1
- package/Materials/materialPluginManager.js +3 -3
- package/Materials/materialPluginManager.js.map +1 -1
- package/Materials/multiMaterial.d.ts +3 -1
- package/Materials/multiMaterial.js +13 -11
- package/Materials/multiMaterial.js.map +1 -1
- package/Materials/pushMaterial.d.ts +1 -1
- package/Materials/pushMaterial.js.map +1 -1
- package/Materials/shaderMaterial.js +8 -4
- package/Materials/shaderMaterial.js.map +1 -1
- package/Materials/shadowDepthWrapper.d.ts +1 -1
- package/Materials/shadowDepthWrapper.js +3 -3
- package/Materials/shadowDepthWrapper.js.map +1 -1
- package/Materials/standardMaterial.d.ts +2 -6
- package/Materials/standardMaterial.js +5 -10
- package/Materials/standardMaterial.js.map +1 -1
- package/Maths/math.size.js +1 -1
- package/Maths/math.size.js.map +1 -1
- package/Maths/math.vector.d.ts +4 -2
- package/Maths/math.vector.js +34 -32
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Builders/cylinderBuilder.d.ts +1 -1
- package/Meshes/Builders/cylinderBuilder.js +1 -1
- package/Meshes/Builders/cylinderBuilder.js.map +1 -1
- package/Meshes/Builders/linesBuilder.js.map +1 -1
- package/Meshes/Compression/dracoCompression.d.ts +3 -0
- package/Meshes/Compression/dracoCompression.js +23 -7
- package/Meshes/Compression/dracoCompression.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +6 -0
- package/Meshes/abstractMesh.js +18 -2
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/geometry.d.ts +1 -1
- package/Meshes/geometry.js +7 -3
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/groundMesh.d.ts +1 -1
- package/Meshes/groundMesh.js.map +1 -1
- package/Meshes/mesh.js +21 -6
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/mesh.lts.d.ts +1 -1
- package/Meshes/mesh.lts.js.map +1 -1
- package/Meshes/mesh.vertexData.d.ts +1 -1
- package/Meshes/mesh.vertexData.js +2 -2
- package/Meshes/mesh.vertexData.js.map +1 -1
- package/Meshes/polygonMesh.js +2 -2
- package/Meshes/polygonMesh.js.map +1 -1
- package/Meshes/subMesh.js +1 -2
- package/Meshes/subMesh.js.map +1 -1
- package/Meshes/subMesh.project.js +1 -2
- package/Meshes/subMesh.project.js.map +1 -1
- package/Meshes/thinInstanceMesh.js +5 -0
- package/Meshes/thinInstanceMesh.js.map +1 -1
- package/Meshes/trailMesh.d.ts +1 -1
- package/Meshes/trailMesh.js.map +1 -1
- package/Meshes/transformNode.js +40 -13
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.d.ts +5 -0
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js +13 -2
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js.map +1 -1
- package/Misc/PerformanceViewer/performanceViewerCollectionStrategies.js +6 -12
- package/Misc/PerformanceViewer/performanceViewerCollectionStrategies.js.map +1 -1
- package/Misc/PerformanceViewer/performanceViewerCollector.js +6 -6
- package/Misc/PerformanceViewer/performanceViewerCollector.js.map +1 -1
- package/Misc/assetsManager.d.ts +2 -1
- package/Misc/assetsManager.js +15 -1
- package/Misc/assetsManager.js.map +1 -1
- package/Misc/basis.js +1 -1
- package/Misc/basis.js.map +1 -1
- package/Misc/brdfTextureTools.js +4 -1
- package/Misc/brdfTextureTools.js.map +1 -1
- package/Misc/dds.js +7 -0
- package/Misc/dds.js.map +1 -1
- package/Misc/devTools.js +1 -1
- package/Misc/devTools.js.map +1 -1
- package/Misc/environmentTextureTools.js +2 -2
- package/Misc/environmentTextureTools.js.map +1 -1
- package/Misc/fileTools.js +4 -4
- package/Misc/fileTools.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.js +4 -3
- package/Misc/khronosTextureContainer2.js.map +1 -1
- package/Misc/reflector.js +6 -6
- package/Misc/reflector.js.map +1 -1
- package/Misc/tools.js +15 -13
- package/Misc/tools.js.map +1 -1
- package/Misc/uniqueIdGenerator.js +1 -1
- package/Misc/uniqueIdGenerator.js.map +1 -1
- package/Offline/database.js +1 -1
- package/Offline/database.js.map +1 -1
- package/Particles/baseParticleSystem.d.ts +4 -1
- package/Particles/baseParticleSystem.js +20 -5
- package/Particles/baseParticleSystem.js.map +1 -1
- package/Particles/gpuParticleSystem.js +2 -1
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/particleHelper.js +2 -2
- package/Particles/particleHelper.js.map +1 -1
- package/Physics/Plugins/ammoJSPlugin.d.ts +5 -1
- package/Physics/Plugins/ammoJSPlugin.js +16 -11
- package/Physics/Plugins/ammoJSPlugin.js.map +1 -1
- package/Physics/physicsEngine.d.ts +1 -0
- package/Physics/physicsEngine.js +3 -1
- package/Physics/physicsEngine.js.map +1 -1
- package/Physics/physicsImpostor.d.ts +2 -2
- package/Physics/physicsImpostor.js.map +1 -1
- package/PostProcesses/blurPostProcess.js +5 -5
- package/PostProcesses/blurPostProcess.js.map +1 -1
- package/PostProcesses/imageProcessingPostProcess.js +1 -1
- package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
- package/PostProcesses/postProcess.js +1 -1
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/postProcessManager.js +2 -2
- package/PostProcesses/postProcessManager.js.map +1 -1
- package/Probes/reflectionProbe.js +2 -2
- package/Probes/reflectionProbe.js.map +1 -1
- package/Rendering/depthPeelingRenderer.js +3 -3
- package/Rendering/depthPeelingRenderer.js.map +1 -1
- package/Rendering/geometryBufferRenderer.js +8 -8
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Rendering/outlineRenderer.js +1 -1
- package/Rendering/outlineRenderer.js.map +1 -1
- package/Rendering/utilityLayerRenderer.js +4 -0
- package/Rendering/utilityLayerRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/instancesDeclaration.js +1 -1
- package/Shaders/ShadersInclude/instancesDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.js +1 -1
- package/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.js.map +1 -1
- package/Shaders/ShadersInclude/pbrFragmentExtraDeclaration.js +1 -1
- package/Shaders/ShadersInclude/pbrFragmentExtraDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/prePassVertex.js +1 -1
- package/Shaders/ShadersInclude/prePassVertex.js.map +1 -1
- package/Shaders/color.fragment.js +1 -1
- package/Shaders/color.fragment.js.map +1 -1
- package/Shaders/color.vertex.js +1 -1
- package/Shaders/color.vertex.js.map +1 -1
- package/Shaders/default.fragment.js +1 -1
- package/Shaders/default.fragment.js.map +1 -1
- package/Shaders/default.vertex.js +1 -1
- package/Shaders/default.vertex.js.map +1 -1
- package/Shaders/geometry.vertex.js +1 -1
- package/Shaders/geometry.vertex.js.map +1 -1
- package/Shaders/pbr.vertex.js +1 -1
- package/Shaders/pbr.vertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/instancesDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/instancesDeclaration.js.map +1 -1
- package/ShadersWGSL/gpuUpdateParticles.compute.js +1 -1
- package/ShadersWGSL/gpuUpdateParticles.compute.js.map +1 -1
- package/Sprites/spriteManager.js +9 -10
- package/Sprites/spriteManager.js.map +1 -1
- package/Sprites/spriteMap.js +2 -2
- package/Sprites/spriteMap.js.map +1 -1
- package/Sprites/spriteRenderer.js +1 -1
- package/Sprites/spriteRenderer.js.map +1 -1
- package/XR/features/WebXRControllerPointerSelection.js +15 -9
- package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
- package/XR/features/WebXRDOMOverlay.js +1 -1
- package/XR/features/WebXRDOMOverlay.js.map +1 -1
- package/XR/features/WebXRHandTracking.js +30 -30
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/XR/features/WebXRImageTracking.js +2 -2
- package/XR/features/WebXRImageTracking.js.map +1 -1
- package/XR/features/WebXRLayers.d.ts +28 -5
- package/XR/features/WebXRLayers.js +54 -20
- package/XR/features/WebXRLayers.js.map +1 -1
- package/XR/features/WebXRNearInteraction.d.ts +35 -3
- package/XR/features/WebXRNearInteraction.js +201 -40
- package/XR/features/WebXRNearInteraction.js.map +1 -1
- package/XR/motionController/webXRAbstractMotionController.js +1 -1
- package/XR/motionController/webXRAbstractMotionController.js.map +1 -1
- package/XR/motionController/webXRMotionControllerManager.js +2 -2
- package/XR/motionController/webXRMotionControllerManager.js.map +1 -1
- package/XR/motionController/webXRProfiledMotionController.js +1 -1
- package/XR/motionController/webXRProfiledMotionController.js.map +1 -1
- package/XR/webXRCamera.js +17 -4
- package/XR/webXRCamera.js.map +1 -1
- package/XR/webXRDefaultExperience.js +3 -0
- package/XR/webXRDefaultExperience.js.map +1 -1
- package/XR/webXREnterExitUI.js +2 -2
- package/XR/webXREnterExitUI.js.map +1 -1
- package/XR/webXRExperienceHelper.js +3 -2
- package/XR/webXRExperienceHelper.js.map +1 -1
- package/XR/webXRFeaturesManager.js +6 -6
- package/XR/webXRFeaturesManager.js.map +1 -1
- package/XR/webXRInputSource.js +3 -3
- package/XR/webXRInputSource.js.map +1 -1
- package/XR/webXRRenderTargetTextureProvider.d.ts +3 -2
- package/XR/webXRRenderTargetTextureProvider.js +37 -18
- package/XR/webXRRenderTargetTextureProvider.js.map +1 -1
- package/XR/webXRSessionManager.d.ts +1 -0
- package/XR/webXRSessionManager.js +6 -1
- package/XR/webXRSessionManager.js.map +1 -1
- package/assetContainer.d.ts +1 -1
- package/assetContainer.js +4 -0
- package/assetContainer.js.map +1 -1
- package/node.d.ts +1 -1
- package/node.js.map +1 -1
- package/package.json +22 -13
- package/scene.d.ts +5 -2
- package/scene.js +31 -5
- package/scene.js.map +1 -1
- package/DeviceInput/Implementations/nativeDeviceInputSystem.js.map +0 -1
- package/DeviceInput/Implementations/webDeviceInputSystem.js.map +0 -1
- package/DeviceInput/Interfaces/inputInterfaces.js.map +0 -1
- package/DeviceInput/deviceInputSystem.d.ts +0 -60
- package/DeviceInput/deviceInputSystem.js +0 -84
- package/DeviceInput/deviceInputSystem.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shaderDefineExpression.js","sourceRoot":"","sources":["../../../../../sourceES6/core/Engines/Processors/Expressions/shaderDefineExpression.ts"],"names":[],"mappings":"AAAA,cAAc;AACd;IAAA;IAgGA,CAAC;IA/FU,uCAAM,GAAb,UAAc,aAAwC;QAClD,OAAO,IAAI,CAAC;IAChB,CAAC;IAWa,qCAAc,GAA5B,UAA6B,OAAiB;QAC1C,IAAM,KAAK,GAAa,EAAE,CAAC;QAE3B,KAAc,UAAO,EAAP,mBAAO,EAAP,qBAAO,EAAP,IAAO,EAAE;YAAlB,IAAI,CAAC,gBAAA;YACN,IAAI,sBAAsB,CAAC,iBAAiB,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE;gBAC3D,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACjB;iBAAM;gBACH,IAAM,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,EAC9B,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;gBAEjC,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC;gBAClB,KAAK,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"shaderDefineExpression.js","sourceRoot":"","sources":["../../../../../sourceES6/core/Engines/Processors/Expressions/shaderDefineExpression.ts"],"names":[],"mappings":"AAAA,cAAc;AACd;IAAA;IAgGA,CAAC;IA/FU,uCAAM,GAAb,UAAc,aAAwC;QAClD,OAAO,IAAI,CAAC;IAChB,CAAC;IAWa,qCAAc,GAA5B,UAA6B,OAAiB;QAC1C,IAAM,KAAK,GAAa,EAAE,CAAC;QAE3B,KAAc,UAAO,EAAP,mBAAO,EAAP,qBAAO,EAAP,IAAO,EAAE;YAAlB,IAAI,CAAC,gBAAA;YACN,IAAI,sBAAsB,CAAC,iBAAiB,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE;gBAC3D,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACjB;iBAAM;gBACH,IAAM,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,EA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B;QAC3D,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,CAAC;QACN,IAAI,EAAE,CAAC;QACP,IAAI,EAAE,CAAC;KACV,CAAC;IAEa,6BAAM,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAoF7G,6BAAC;CAAA,AAhGD,IAgGC;SAhGY,sBAAsB","sourcesContent":["/** @hidden */\r\nexport class ShaderDefineExpression {\r\n public isTrue(preprocessors: { [key: string]: string }): boolean {\r\n return true;\r\n }\r\n\r\n private static _OperatorPriority: { [name: string]: number } = {\r\n \")\": 0,\r\n \"(\": 1,\r\n \"||\": 2,\r\n \"&&\": 3,\r\n };\r\n\r\n private static _Stack = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''];\r\n\r\n public static postfixToInfix(postfix: string[]): string {\r\n const stack: string[] = [];\r\n\r\n for (let c of postfix) {\r\n if (ShaderDefineExpression._OperatorPriority[c] === undefined) {\r\n stack.push(c);\r\n } else {\r\n const v1 = stack[stack.length - 1],\r\n v2 = stack[stack.length - 2];\r\n\r\n stack.length -= 2;\r\n stack.push(`(${v2}${c}${v1})`);\r\n }\r\n }\r\n\r\n return stack[stack.length - 1];\r\n }\r\n\r\n public static infixToPostfix(infix: string): string[] {\r\n const result: string[] = [];\r\n\r\n let stackIdx = -1;\r\n\r\n const pushOperand = () => {\r\n operand = operand.trim();\r\n if (operand !== '') {\r\n result.push(operand);\r\n operand = '';\r\n }\r\n };\r\n\r\n const push = (s: string) => {\r\n if (stackIdx < ShaderDefineExpression._Stack.length - 1) {\r\n ShaderDefineExpression._Stack[++stackIdx] = s;\r\n }\r\n };\r\n\r\n const peek = () => ShaderDefineExpression._Stack[stackIdx];\r\n\r\n const pop = () => stackIdx === -1 ? '!!INVALID EXPRESSION!!' : ShaderDefineExpression._Stack[stackIdx--];\r\n\r\n let idx = 0,\r\n operand = '';\r\n\r\n while (idx < infix.length) {\r\n const c = infix.charAt(idx),\r\n token = idx < infix.length - 1 ? infix.substr(idx, 2) : '';\r\n\r\n if (c === '(') {\r\n operand = '';\r\n push(c);\r\n } else if (c === ')') {\r\n pushOperand();\r\n while (stackIdx !== -1 && peek() !== '(') {\r\n result.push(pop());\r\n }\r\n pop();\r\n } else if (ShaderDefineExpression._OperatorPriority[token] > 1) {\r\n pushOperand();\r\n while (stackIdx !== -1 && ShaderDefineExpression._OperatorPriority[peek()] >= ShaderDefineExpression._OperatorPriority[token]) {\r\n result.push(pop());\r\n }\r\n push(token);\r\n idx++;\r\n } else {\r\n operand += c;\r\n }\r\n idx++;\r\n }\r\n\r\n pushOperand();\r\n\r\n while (stackIdx !== -1) {\r\n if (peek() === '(') {\r\n pop();\r\n } else {\r\n result.push(pop());\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n}"]}
|
|
@@ -30,7 +30,7 @@ var ShaderCodeInliner = /** @class */ (function () {
|
|
|
30
30
|
*/
|
|
31
31
|
ShaderCodeInliner.prototype.processCode = function () {
|
|
32
32
|
if (this.debug) {
|
|
33
|
-
console.log("Start inlining process (code size="
|
|
33
|
+
console.log("Start inlining process (code size=".concat(this._sourceCode.length, ")..."));
|
|
34
34
|
}
|
|
35
35
|
this._collectFunctions();
|
|
36
36
|
this._processInlining(this._numMaxIterations);
|
|
@@ -49,7 +49,7 @@ var ShaderCodeInliner = /** @class */ (function () {
|
|
|
49
49
|
var funcParamsStartIndex = this._sourceCode.indexOf("(", inlineTokenIndex + this.inlineToken.length);
|
|
50
50
|
if (funcParamsStartIndex < 0) {
|
|
51
51
|
if (this.debug) {
|
|
52
|
-
console.warn("Could not find the opening parenthesis after the token. startIndex="
|
|
52
|
+
console.warn("Could not find the opening parenthesis after the token. startIndex=".concat(startIndex));
|
|
53
53
|
}
|
|
54
54
|
startIndex = inlineTokenIndex + this.inlineToken.length;
|
|
55
55
|
continue;
|
|
@@ -57,7 +57,7 @@ var ShaderCodeInliner = /** @class */ (function () {
|
|
|
57
57
|
var funcNameMatch = ShaderCodeInliner._RegexpFindFunctionNameAndType.exec(this._sourceCode.substring(inlineTokenIndex + this.inlineToken.length, funcParamsStartIndex));
|
|
58
58
|
if (!funcNameMatch) {
|
|
59
59
|
if (this.debug) {
|
|
60
|
-
console.warn("Could not extract the name/type of the function from: "
|
|
60
|
+
console.warn("Could not extract the name/type of the function from: ".concat(this._sourceCode.substring(inlineTokenIndex + this.inlineToken.length, funcParamsStartIndex)));
|
|
61
61
|
}
|
|
62
62
|
startIndex = inlineTokenIndex + this.inlineToken.length;
|
|
63
63
|
continue;
|
|
@@ -67,7 +67,7 @@ var ShaderCodeInliner = /** @class */ (function () {
|
|
|
67
67
|
var funcParamsEndIndex = ExtractBetweenMarkers('(', ')', this._sourceCode, funcParamsStartIndex);
|
|
68
68
|
if (funcParamsEndIndex < 0) {
|
|
69
69
|
if (this.debug) {
|
|
70
|
-
console.warn("Could not extract the parameters the function '"
|
|
70
|
+
console.warn("Could not extract the parameters the function '".concat(funcName, "' (type=").concat(funcType, "). funcParamsStartIndex=").concat(funcParamsStartIndex));
|
|
71
71
|
}
|
|
72
72
|
startIndex = inlineTokenIndex + this.inlineToken.length;
|
|
73
73
|
continue;
|
|
@@ -77,7 +77,7 @@ var ShaderCodeInliner = /** @class */ (function () {
|
|
|
77
77
|
var funcBodyStartIndex = SkipWhitespaces(this._sourceCode, funcParamsEndIndex + 1);
|
|
78
78
|
if (funcBodyStartIndex === this._sourceCode.length) {
|
|
79
79
|
if (this.debug) {
|
|
80
|
-
console.warn("Could not extract the body of the function '"
|
|
80
|
+
console.warn("Could not extract the body of the function '".concat(funcName, "' (type=").concat(funcType, "). funcParamsEndIndex=").concat(funcParamsEndIndex));
|
|
81
81
|
}
|
|
82
82
|
startIndex = inlineTokenIndex + this.inlineToken.length;
|
|
83
83
|
continue;
|
|
@@ -85,7 +85,7 @@ var ShaderCodeInliner = /** @class */ (function () {
|
|
|
85
85
|
var funcBodyEndIndex = ExtractBetweenMarkers('{', '}', this._sourceCode, funcBodyStartIndex);
|
|
86
86
|
if (funcBodyEndIndex < 0) {
|
|
87
87
|
if (this.debug) {
|
|
88
|
-
console.warn("Could not extract the body of the function '"
|
|
88
|
+
console.warn("Could not extract the body of the function '".concat(funcName, "' (type=").concat(funcType, "). funcBodyStartIndex=").concat(funcBodyStartIndex));
|
|
89
89
|
}
|
|
90
90
|
startIndex = inlineTokenIndex + this.inlineToken.length;
|
|
91
91
|
continue;
|
|
@@ -121,7 +121,7 @@ var ShaderCodeInliner = /** @class */ (function () {
|
|
|
121
121
|
startIndex -= funcBodyEndIndex + 1 - inlineTokenIndex;
|
|
122
122
|
}
|
|
123
123
|
if (this.debug) {
|
|
124
|
-
console.log("Collect functions: "
|
|
124
|
+
console.log("Collect functions: ".concat(this._functionDescr.length, " functions found. functionDescr="), this._functionDescr);
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
127
|
ShaderCodeInliner.prototype._processInlining = function (numMaxIterations) {
|
|
@@ -132,7 +132,7 @@ var ShaderCodeInliner = /** @class */ (function () {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
if (this.debug) {
|
|
135
|
-
console.log("numMaxIterations is "
|
|
135
|
+
console.log("numMaxIterations is ".concat(numMaxIterations, " after inlining process"));
|
|
136
136
|
}
|
|
137
137
|
return numMaxIterations >= 0;
|
|
138
138
|
};
|
|
@@ -163,7 +163,7 @@ var ShaderCodeInliner = /** @class */ (function () {
|
|
|
163
163
|
var callParamsEndIndex = ExtractBetweenMarkers('(', ')', this._sourceCode, callParamsStartIndex);
|
|
164
164
|
if (callParamsEndIndex < 0) {
|
|
165
165
|
if (this.debug) {
|
|
166
|
-
console.warn("Could not extract the parameters of the function call. Function '"
|
|
166
|
+
console.warn("Could not extract the parameters of the function call. Function '".concat(name_1, "' (type=").concat(type, "). callParamsStartIndex=").concat(callParamsStartIndex));
|
|
167
167
|
}
|
|
168
168
|
startIndex = functionCallIndex + name_1.length;
|
|
169
169
|
continue;
|
|
@@ -197,7 +197,7 @@ var ShaderCodeInliner = /** @class */ (function () {
|
|
|
197
197
|
var params = splitParameterCall(RemoveComments(callParams));
|
|
198
198
|
if (params === null) {
|
|
199
199
|
if (this.debug) {
|
|
200
|
-
console.warn("Invalid function call: can't extract the parameters of the function call. Function '"
|
|
200
|
+
console.warn("Invalid function call: can't extract the parameters of the function call. Function '".concat(name_1, "' (type=").concat(type, "). callParamsStartIndex=").concat(callParamsStartIndex, ", callParams=") + callParams);
|
|
201
201
|
}
|
|
202
202
|
startIndex = functionCallIndex + name_1.length;
|
|
203
203
|
continue;
|
|
@@ -213,7 +213,7 @@ var ShaderCodeInliner = /** @class */ (function () {
|
|
|
213
213
|
}
|
|
214
214
|
if (paramNames.length !== parameters.length) {
|
|
215
215
|
if (this.debug) {
|
|
216
|
-
console.warn("Invalid function call: not the same number of parameters for the call than the number expected by the function. Function '"
|
|
216
|
+
console.warn("Invalid function call: not the same number of parameters for the call than the number expected by the function. Function '".concat(name_1, "' (type=").concat(type, "). function parameters=").concat(parameters, ", call parameters=").concat(paramNames));
|
|
217
217
|
}
|
|
218
218
|
startIndex = functionCallIndex + name_1.length;
|
|
219
219
|
continue;
|
|
@@ -233,7 +233,7 @@ var ShaderCodeInliner = /** @class */ (function () {
|
|
|
233
233
|
var partBetween = this._sourceCode.substring(injectDeclarationIndex + 1, functionCallIndex);
|
|
234
234
|
this._sourceCode = partBefore + type + " " + retParamName + ";\n" + funcBody + "\n" + partBetween + retParamName + partAfter;
|
|
235
235
|
if (this.debug) {
|
|
236
|
-
console.log("Replace function call by code. Function '"
|
|
236
|
+
console.log("Replace function call by code. Function '".concat(name_1, "' (type=").concat(type, "). injectDeclarationIndex=").concat(injectDeclarationIndex, ", call parameters=").concat(paramNames));
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
else {
|
|
@@ -241,7 +241,7 @@ var ShaderCodeInliner = /** @class */ (function () {
|
|
|
241
241
|
this._sourceCode = partBefore + funcBody + partAfter;
|
|
242
242
|
startIndex += funcBody.length - (callParamsEndIndex + 1 - functionCallIndex);
|
|
243
243
|
if (this.debug) {
|
|
244
|
-
console.log("Replace function call by code. Function '"
|
|
244
|
+
console.log("Replace function call by code. Function '".concat(name_1, "' (type=").concat(type, "). functionCallIndex=").concat(functionCallIndex, ", call parameters=").concat(paramNames));
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
doAgain = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shaderCodeInliner.js","sourceRoot":"","sources":["../../../../sourceES6/core/Engines/Processors/shaderCodeInliner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAUzJ;;EAEE;AACF;IAmBI;;;;OAIG;IACH,2BAAY,UAAkB,EAAE,gBAAqB;QAArB,iCAAA,EAAA,qBAAqB;QAbrD,kCAAkC;QAC3B,UAAK,GAAY,KAAK,CAAC;QAa1B,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;QAC1C,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,gBAAgB,CAAC;IACxC,CAAC;IAdD,sBAAW,mCAAI;QADf,+CAA+C;aAC/C;YACI,OAAO,IAAI,CAAC,WAAW,CAAC;QAC5B,CAAC;;;OAAA;IAcD;;OAEG;IACI,uCAAW,GAAlB;QACI,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,OAAO,CAAC,GAAG,CAAC,uCAAqC,IAAI,CAAC,WAAW,CAAC,MAA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EscapeRegExp, ExtractBetweenMarkers, FindBackward, IsIdentifierChar, RemoveComments, SkipWhitespaces } from \"../../Misc/codeStringParsingTools\";\r\n\r\ninterface IInlineFunctionDescr {\r\n name: string;\r\n type: string;\r\n parameters: string[];\r\n body: string;\r\n callIndex: number;\r\n}\r\n\r\n/**\r\n * Class used to inline functions in shader code\r\n*/\r\nexport class ShaderCodeInliner {\r\n\r\n private static readonly _RegexpFindFunctionNameAndType = /((\\s+?)(\\w+)\\s+(\\w+)\\s*?)$/;\r\n\r\n private _sourceCode: string;\r\n private _functionDescr: IInlineFunctionDescr[];\r\n private _numMaxIterations: number;\r\n\r\n /** Gets or sets the token used to mark the functions to inline */\r\n public inlineToken: string;\r\n\r\n /** Gets or sets the debug mode */\r\n public debug: boolean = false;\r\n\r\n /** Gets the code after the inlining process */\r\n public get code(): string {\r\n return this._sourceCode;\r\n }\r\n\r\n /**\r\n * Initializes the inliner\r\n * @param sourceCode shader code source to inline\r\n * @param numMaxIterations maximum number of iterations (used to detect recursive calls)\r\n */\r\n constructor(sourceCode: string, numMaxIterations = 20) {\r\n this._sourceCode = sourceCode;\r\n this._numMaxIterations = numMaxIterations;\r\n this._functionDescr = [];\r\n this.inlineToken = \"#define inline\";\r\n }\r\n\r\n /**\r\n * Start the processing of the shader code\r\n */\r\n public processCode() {\r\n if (this.debug) {\r\n console.log(`Start inlining process (code size=${this._sourceCode.length})...`);\r\n }\r\n this._collectFunctions();\r\n this._processInlining(this._numMaxIterations);\r\n if (this.debug) {\r\n console.log(\"End of inlining process.\");\r\n }\r\n }\r\n\r\n private _collectFunctions() {\r\n let startIndex = 0;\r\n\r\n while (startIndex < this._sourceCode.length) {\r\n // locate the function to inline and extract its name\r\n const inlineTokenIndex = this._sourceCode.indexOf(this.inlineToken, startIndex);\r\n if (inlineTokenIndex < 0) {\r\n break;\r\n }\r\n\r\n const funcParamsStartIndex = this._sourceCode.indexOf(\"(\", inlineTokenIndex + this.inlineToken.length);\r\n if (funcParamsStartIndex < 0) {\r\n if (this.debug) {\r\n console.warn(`Could not find the opening parenthesis after the token. startIndex=${startIndex}`);\r\n }\r\n startIndex = inlineTokenIndex + this.inlineToken.length;\r\n continue;\r\n }\r\n\r\n const funcNameMatch = ShaderCodeInliner._RegexpFindFunctionNameAndType.exec(this._sourceCode.substring(inlineTokenIndex + this.inlineToken.length, funcParamsStartIndex));\r\n if (!funcNameMatch) {\r\n if (this.debug) {\r\n console.warn(`Could not extract the name/type of the function from: ${this._sourceCode.substring(inlineTokenIndex + this.inlineToken.length, funcParamsStartIndex)}`);\r\n }\r\n startIndex = inlineTokenIndex + this.inlineToken.length;\r\n continue;\r\n }\r\n const [funcType, funcName] = [funcNameMatch[3], funcNameMatch[4]];\r\n\r\n // extract the parameters of the function as a whole string (without the leading / trailing parenthesis)\r\n const funcParamsEndIndex = ExtractBetweenMarkers('(', ')', this._sourceCode, funcParamsStartIndex);\r\n if (funcParamsEndIndex < 0) {\r\n if (this.debug) {\r\n console.warn(`Could not extract the parameters the function '${funcName}' (type=${funcType}). funcParamsStartIndex=${funcParamsStartIndex}`);\r\n }\r\n startIndex = inlineTokenIndex + this.inlineToken.length;\r\n continue;\r\n }\r\n const funcParams = this._sourceCode.substring(funcParamsStartIndex + 1, funcParamsEndIndex);\r\n\r\n // extract the body of the function (with the curly brackets)\r\n const funcBodyStartIndex = SkipWhitespaces(this._sourceCode, funcParamsEndIndex + 1);\r\n if (funcBodyStartIndex === this._sourceCode.length) {\r\n if (this.debug) {\r\n console.warn(`Could not extract the body of the function '${funcName}' (type=${funcType}). funcParamsEndIndex=${funcParamsEndIndex}`);\r\n }\r\n startIndex = inlineTokenIndex + this.inlineToken.length;\r\n continue;\r\n }\r\n\r\n const funcBodyEndIndex = ExtractBetweenMarkers('{', '}', this._sourceCode, funcBodyStartIndex);\r\n if (funcBodyEndIndex < 0) {\r\n if (this.debug) {\r\n console.warn(`Could not extract the body of the function '${funcName}' (type=${funcType}). funcBodyStartIndex=${funcBodyStartIndex}`);\r\n }\r\n startIndex = inlineTokenIndex + this.inlineToken.length;\r\n continue;\r\n }\r\n const funcBody = this._sourceCode.substring(funcBodyStartIndex, funcBodyEndIndex + 1);\r\n\r\n // process the parameters: extract each names\r\n const params = RemoveComments(funcParams).split(\",\");\r\n const paramNames = [];\r\n\r\n for (let p = 0; p < params.length; ++p) {\r\n const param = params[p].trim();\r\n const idx = param.lastIndexOf(\" \");\r\n\r\n if (idx >= 0) {\r\n paramNames.push(param.substring(idx + 1));\r\n }\r\n }\r\n\r\n if (funcType !== 'void') {\r\n // for functions that return a value, we will replace \"return\" by \"tempvarname = \", tempvarname being a unique generated name\r\n paramNames.push('return');\r\n }\r\n\r\n // collect the function\r\n this._functionDescr.push({\r\n \"name\": funcName,\r\n \"type\": funcType,\r\n \"parameters\": paramNames,\r\n \"body\": funcBody,\r\n \"callIndex\": 0,\r\n });\r\n\r\n startIndex = funcBodyEndIndex + 1;\r\n\r\n // remove the function from the source code\r\n const partBefore = inlineTokenIndex > 0 ? this._sourceCode.substring(0, inlineTokenIndex) : \"\";\r\n const partAfter = funcBodyEndIndex + 1 < this._sourceCode.length - 1 ? this._sourceCode.substring(funcBodyEndIndex + 1) : \"\";\r\n\r\n this._sourceCode = partBefore + partAfter;\r\n\r\n startIndex -= funcBodyEndIndex + 1 - inlineTokenIndex;\r\n }\r\n\r\n if (this.debug) {\r\n console.log(`Collect functions: ${this._functionDescr.length} functions found. functionDescr=`, this._functionDescr);\r\n }\r\n }\r\n\r\n private _processInlining(numMaxIterations: number = 20): boolean {\r\n while (numMaxIterations-- >= 0) {\r\n if (!this._replaceFunctionCallsByCode()) {\r\n break;\r\n }\r\n }\r\n\r\n if (this.debug) {\r\n console.log(`numMaxIterations is ${numMaxIterations} after inlining process`);\r\n }\r\n\r\n return numMaxIterations >= 0;\r\n }\r\n\r\n private _replaceFunctionCallsByCode(): boolean {\r\n let doAgain = false;\r\n\r\n for (const func of this._functionDescr) {\r\n const { name, type, parameters, body } = func;\r\n\r\n let startIndex = 0;\r\n\r\n while (startIndex < this._sourceCode.length) {\r\n // Look for the function name in the source code\r\n const functionCallIndex = this._sourceCode.indexOf(name, startIndex);\r\n\r\n if (functionCallIndex < 0) {\r\n break;\r\n }\r\n\r\n // Make sure \"name\" is not part of a bigger string\r\n if (functionCallIndex === 0 || IsIdentifierChar(this._sourceCode.charAt(functionCallIndex - 1))) {\r\n startIndex = functionCallIndex + name.length;\r\n continue;\r\n }\r\n\r\n // Find the opening parenthesis\r\n const callParamsStartIndex = SkipWhitespaces(this._sourceCode, functionCallIndex + name.length);\r\n if (callParamsStartIndex === this._sourceCode.length || this._sourceCode.charAt(callParamsStartIndex) !== '(') {\r\n startIndex = functionCallIndex + name.length;\r\n continue;\r\n }\r\n\r\n // extract the parameters of the function call as a whole string (without the leading / trailing parenthesis)\r\n const callParamsEndIndex = ExtractBetweenMarkers('(', ')', this._sourceCode, callParamsStartIndex);\r\n if (callParamsEndIndex < 0) {\r\n if (this.debug) {\r\n console.warn(`Could not extract the parameters of the function call. Function '${name}' (type=${type}). callParamsStartIndex=${callParamsStartIndex}`);\r\n }\r\n startIndex = functionCallIndex + name.length;\r\n continue;\r\n }\r\n const callParams = this._sourceCode.substring(callParamsStartIndex + 1, callParamsEndIndex);\r\n\r\n // process the parameter call: extract each names\r\n\r\n // this function split the parameter list used in the function call at ',' boundaries by taking care of potential parenthesis like in:\r\n // myfunc(a, vec2(1., 0.), 4.)\r\n const splitParameterCall = (s: string) => {\r\n const parameters = [];\r\n let curIdx = 0, startParamIdx = 0;\r\n while (curIdx < s.length) {\r\n if (s.charAt(curIdx) === '(') {\r\n const idx2 = ExtractBetweenMarkers('(', ')', s, curIdx);\r\n if (idx2 < 0) {\r\n return null;\r\n }\r\n curIdx = idx2;\r\n } else if (s.charAt(curIdx) === ',') {\r\n parameters.push(s.substring(startParamIdx, curIdx));\r\n startParamIdx = curIdx + 1;\r\n }\r\n curIdx++;\r\n }\r\n if (startParamIdx < curIdx) {\r\n parameters.push(s.substring(startParamIdx, curIdx));\r\n }\r\n return parameters;\r\n };\r\n\r\n const params = splitParameterCall(RemoveComments(callParams));\r\n\r\n if (params === null) {\r\n if (this.debug) {\r\n console.warn(`Invalid function call: can't extract the parameters of the function call. Function '${name}' (type=${type}). callParamsStartIndex=${callParamsStartIndex}, callParams=` + callParams);\r\n }\r\n startIndex = functionCallIndex + name.length;\r\n continue;\r\n }\r\n\r\n const paramNames = [];\r\n\r\n for (let p = 0; p < params.length; ++p) {\r\n const param = params[p].trim();\r\n paramNames.push(param);\r\n }\r\n\r\n const retParamName = type !== 'void' ? name + '_' + (func.callIndex++) : null;\r\n\r\n if (retParamName) {\r\n paramNames.push(retParamName + ' =');\r\n }\r\n\r\n if (paramNames.length !== parameters.length) {\r\n if (this.debug) {\r\n console.warn(`Invalid function call: not the same number of parameters for the call than the number expected by the function. Function '${name}' (type=${type}). function parameters=${parameters}, call parameters=${paramNames}`);\r\n }\r\n startIndex = functionCallIndex + name.length;\r\n continue;\r\n }\r\n\r\n startIndex = callParamsEndIndex + 1;\r\n\r\n // replace the function call by the body function\r\n const funcBody = this._replaceNames(body, parameters, paramNames);\r\n\r\n let partBefore = functionCallIndex > 0 ? this._sourceCode.substring(0, functionCallIndex) : \"\";\r\n let partAfter = callParamsEndIndex + 1 < this._sourceCode.length - 1 ? this._sourceCode.substring(callParamsEndIndex + 1) : \"\";\r\n\r\n if (retParamName) {\r\n // case where the function returns a value. We generate:\r\n // FUNCTYPE retParamName;\r\n // {function body}\r\n // and replace the function call by retParamName\r\n const injectDeclarationIndex = FindBackward(this._sourceCode, functionCallIndex - 1, '\\n');\r\n\r\n partBefore = this._sourceCode.substring(0, injectDeclarationIndex + 1);\r\n let partBetween = this._sourceCode.substring(injectDeclarationIndex + 1, functionCallIndex);\r\n\r\n this._sourceCode = partBefore + type + \" \" + retParamName + \";\\n\" + funcBody + \"\\n\" + partBetween + retParamName + partAfter;\r\n\r\n if (this.debug) {\r\n console.log(`Replace function call by code. Function '${name}' (type=${type}). injectDeclarationIndex=${injectDeclarationIndex}, call parameters=${paramNames}`);\r\n }\r\n } else {\r\n // simple case where the return value of the function is \"void\"\r\n this._sourceCode = partBefore + funcBody + partAfter;\r\n\r\n startIndex += funcBody.length - (callParamsEndIndex + 1 - functionCallIndex);\r\n\r\n if (this.debug) {\r\n console.log(`Replace function call by code. Function '${name}' (type=${type}). functionCallIndex=${functionCallIndex}, call parameters=${paramNames}`);\r\n }\r\n }\r\n\r\n doAgain = true;\r\n }\r\n }\r\n\r\n return doAgain;\r\n }\r\n\r\n private _replaceNames(code: string, sources: string[], destinations: string[]): string {\r\n for (let i = 0; i < sources.length; ++i) {\r\n const source = new RegExp(EscapeRegExp(sources[i]), 'g'),\r\n sourceLen = sources[i].length,\r\n destination = destinations[i];\r\n\r\n code = code.replace(source, (match, ...args) => {\r\n const offset: number = args[0];\r\n // Make sure \"source\" is not part of a bigger identifier (for eg, if source=view and we matched it with viewDirection)\r\n if (IsIdentifierChar(code.charAt(offset - 1)) || IsIdentifierChar(code.charAt(offset + sourceLen))) {\r\n return sources[i];\r\n }\r\n return destination;\r\n });\r\n }\r\n\r\n return code;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"shaderCodeInliner.js","sourceRoot":"","sources":["../../../../sourceES6/core/Engines/Processors/shaderCodeInliner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAUzJ;;EAEE;AACF;IAmBI;;;;OAIG;IACH,2BAAY,UAAkB,EAAE,gBAAqB;QAArB,iCAAA,EAAA,qBAAqB;QAbrD,kCAAkC;QAC3B,UAAK,GAAY,KAAK,CAAC;QAa1B,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;QAC1C,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QACzB,IA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OAAO,CAAC,CAAC,CAAC,CAAC;iBACrB;gBACD,OAAO,WAAW,CAAC;YACvB,CAAC,CAAC,CAAC;;QAZP,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;oBAA9B,CAAC;SAaT;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IA3TuB,gDAA8B,GAAG,4BAA4B,CAAC;IA4T1F,wBAAC;CAAA,AA9TD,IA8TC;SA9TY,iBAAiB","sourcesContent":["import { EscapeRegExp, ExtractBetweenMarkers, FindBackward, IsIdentifierChar, RemoveComments, SkipWhitespaces } from \"../../Misc/codeStringParsingTools\";\r\n\r\ninterface IInlineFunctionDescr {\r\n name: string;\r\n type: string;\r\n parameters: string[];\r\n body: string;\r\n callIndex: number;\r\n}\r\n\r\n/**\r\n * Class used to inline functions in shader code\r\n*/\r\nexport class ShaderCodeInliner {\r\n\r\n private static readonly _RegexpFindFunctionNameAndType = /((\\s+?)(\\w+)\\s+(\\w+)\\s*?)$/;\r\n\r\n private _sourceCode: string;\r\n private _functionDescr: IInlineFunctionDescr[];\r\n private _numMaxIterations: number;\r\n\r\n /** Gets or sets the token used to mark the functions to inline */\r\n public inlineToken: string;\r\n\r\n /** Gets or sets the debug mode */\r\n public debug: boolean = false;\r\n\r\n /** Gets the code after the inlining process */\r\n public get code(): string {\r\n return this._sourceCode;\r\n }\r\n\r\n /**\r\n * Initializes the inliner\r\n * @param sourceCode shader code source to inline\r\n * @param numMaxIterations maximum number of iterations (used to detect recursive calls)\r\n */\r\n constructor(sourceCode: string, numMaxIterations = 20) {\r\n this._sourceCode = sourceCode;\r\n this._numMaxIterations = numMaxIterations;\r\n this._functionDescr = [];\r\n this.inlineToken = \"#define inline\";\r\n }\r\n\r\n /**\r\n * Start the processing of the shader code\r\n */\r\n public processCode() {\r\n if (this.debug) {\r\n console.log(`Start inlining process (code size=${this._sourceCode.length})...`);\r\n }\r\n this._collectFunctions();\r\n this._processInlining(this._numMaxIterations);\r\n if (this.debug) {\r\n console.log(\"End of inlining process.\");\r\n }\r\n }\r\n\r\n private _collectFunctions() {\r\n let startIndex = 0;\r\n\r\n while (startIndex < this._sourceCode.length) {\r\n // locate the function to inline and extract its name\r\n const inlineTokenIndex = this._sourceCode.indexOf(this.inlineToken, startIndex);\r\n if (inlineTokenIndex < 0) {\r\n break;\r\n }\r\n\r\n const funcParamsStartIndex = this._sourceCode.indexOf(\"(\", inlineTokenIndex + this.inlineToken.length);\r\n if (funcParamsStartIndex < 0) {\r\n if (this.debug) {\r\n console.warn(`Could not find the opening parenthesis after the token. startIndex=${startIndex}`);\r\n }\r\n startIndex = inlineTokenIndex + this.inlineToken.length;\r\n continue;\r\n }\r\n\r\n const funcNameMatch = ShaderCodeInliner._RegexpFindFunctionNameAndType.exec(this._sourceCode.substring(inlineTokenIndex + this.inlineToken.length, funcParamsStartIndex));\r\n if (!funcNameMatch) {\r\n if (this.debug) {\r\n console.warn(`Could not extract the name/type of the function from: ${this._sourceCode.substring(inlineTokenIndex + this.inlineToken.length, funcParamsStartIndex)}`);\r\n }\r\n startIndex = inlineTokenIndex + this.inlineToken.length;\r\n continue;\r\n }\r\n const [funcType, funcName] = [funcNameMatch[3], funcNameMatch[4]];\r\n\r\n // extract the parameters of the function as a whole string (without the leading / trailing parenthesis)\r\n const funcParamsEndIndex = ExtractBetweenMarkers('(', ')', this._sourceCode, funcParamsStartIndex);\r\n if (funcParamsEndIndex < 0) {\r\n if (this.debug) {\r\n console.warn(`Could not extract the parameters the function '${funcName}' (type=${funcType}). funcParamsStartIndex=${funcParamsStartIndex}`);\r\n }\r\n startIndex = inlineTokenIndex + this.inlineToken.length;\r\n continue;\r\n }\r\n const funcParams = this._sourceCode.substring(funcParamsStartIndex + 1, funcParamsEndIndex);\r\n\r\n // extract the body of the function (with the curly brackets)\r\n const funcBodyStartIndex = SkipWhitespaces(this._sourceCode, funcParamsEndIndex + 1);\r\n if (funcBodyStartIndex === this._sourceCode.length) {\r\n if (this.debug) {\r\n console.warn(`Could not extract the body of the function '${funcName}' (type=${funcType}). funcParamsEndIndex=${funcParamsEndIndex}`);\r\n }\r\n startIndex = inlineTokenIndex + this.inlineToken.length;\r\n continue;\r\n }\r\n\r\n const funcBodyEndIndex = ExtractBetweenMarkers('{', '}', this._sourceCode, funcBodyStartIndex);\r\n if (funcBodyEndIndex < 0) {\r\n if (this.debug) {\r\n console.warn(`Could not extract the body of the function '${funcName}' (type=${funcType}). funcBodyStartIndex=${funcBodyStartIndex}`);\r\n }\r\n startIndex = inlineTokenIndex + this.inlineToken.length;\r\n continue;\r\n }\r\n const funcBody = this._sourceCode.substring(funcBodyStartIndex, funcBodyEndIndex + 1);\r\n\r\n // process the parameters: extract each names\r\n const params = RemoveComments(funcParams).split(\",\");\r\n const paramNames = [];\r\n\r\n for (let p = 0; p < params.length; ++p) {\r\n const param = params[p].trim();\r\n const idx = param.lastIndexOf(\" \");\r\n\r\n if (idx >= 0) {\r\n paramNames.push(param.substring(idx + 1));\r\n }\r\n }\r\n\r\n if (funcType !== 'void') {\r\n // for functions that return a value, we will replace \"return\" by \"tempvarname = \", tempvarname being a unique generated name\r\n paramNames.push('return');\r\n }\r\n\r\n // collect the function\r\n this._functionDescr.push({\r\n \"name\": funcName,\r\n \"type\": funcType,\r\n \"parameters\": paramNames,\r\n \"body\": funcBody,\r\n \"callIndex\": 0,\r\n });\r\n\r\n startIndex = funcBodyEndIndex + 1;\r\n\r\n // remove the function from the source code\r\n const partBefore = inlineTokenIndex > 0 ? this._sourceCode.substring(0, inlineTokenIndex) : \"\";\r\n const partAfter = funcBodyEndIndex + 1 < this._sourceCode.length - 1 ? this._sourceCode.substring(funcBodyEndIndex + 1) : \"\";\r\n\r\n this._sourceCode = partBefore + partAfter;\r\n\r\n startIndex -= funcBodyEndIndex + 1 - inlineTokenIndex;\r\n }\r\n\r\n if (this.debug) {\r\n console.log(`Collect functions: ${this._functionDescr.length} functions found. functionDescr=`, this._functionDescr);\r\n }\r\n }\r\n\r\n private _processInlining(numMaxIterations: number = 20): boolean {\r\n while (numMaxIterations-- >= 0) {\r\n if (!this._replaceFunctionCallsByCode()) {\r\n break;\r\n }\r\n }\r\n\r\n if (this.debug) {\r\n console.log(`numMaxIterations is ${numMaxIterations} after inlining process`);\r\n }\r\n\r\n return numMaxIterations >= 0;\r\n }\r\n\r\n private _replaceFunctionCallsByCode(): boolean {\r\n let doAgain = false;\r\n\r\n for (const func of this._functionDescr) {\r\n const { name, type, parameters, body } = func;\r\n\r\n let startIndex = 0;\r\n\r\n while (startIndex < this._sourceCode.length) {\r\n // Look for the function name in the source code\r\n const functionCallIndex = this._sourceCode.indexOf(name, startIndex);\r\n\r\n if (functionCallIndex < 0) {\r\n break;\r\n }\r\n\r\n // Make sure \"name\" is not part of a bigger string\r\n if (functionCallIndex === 0 || IsIdentifierChar(this._sourceCode.charAt(functionCallIndex - 1))) {\r\n startIndex = functionCallIndex + name.length;\r\n continue;\r\n }\r\n\r\n // Find the opening parenthesis\r\n const callParamsStartIndex = SkipWhitespaces(this._sourceCode, functionCallIndex + name.length);\r\n if (callParamsStartIndex === this._sourceCode.length || this._sourceCode.charAt(callParamsStartIndex) !== '(') {\r\n startIndex = functionCallIndex + name.length;\r\n continue;\r\n }\r\n\r\n // extract the parameters of the function call as a whole string (without the leading / trailing parenthesis)\r\n const callParamsEndIndex = ExtractBetweenMarkers('(', ')', this._sourceCode, callParamsStartIndex);\r\n if (callParamsEndIndex < 0) {\r\n if (this.debug) {\r\n console.warn(`Could not extract the parameters of the function call. Function '${name}' (type=${type}). callParamsStartIndex=${callParamsStartIndex}`);\r\n }\r\n startIndex = functionCallIndex + name.length;\r\n continue;\r\n }\r\n const callParams = this._sourceCode.substring(callParamsStartIndex + 1, callParamsEndIndex);\r\n\r\n // process the parameter call: extract each names\r\n\r\n // this function split the parameter list used in the function call at ',' boundaries by taking care of potential parenthesis like in:\r\n // myfunc(a, vec2(1., 0.), 4.)\r\n const splitParameterCall = (s: string) => {\r\n const parameters = [];\r\n let curIdx = 0, startParamIdx = 0;\r\n while (curIdx < s.length) {\r\n if (s.charAt(curIdx) === '(') {\r\n const idx2 = ExtractBetweenMarkers('(', ')', s, curIdx);\r\n if (idx2 < 0) {\r\n return null;\r\n }\r\n curIdx = idx2;\r\n } else if (s.charAt(curIdx) === ',') {\r\n parameters.push(s.substring(startParamIdx, curIdx));\r\n startParamIdx = curIdx + 1;\r\n }\r\n curIdx++;\r\n }\r\n if (startParamIdx < curIdx) {\r\n parameters.push(s.substring(startParamIdx, curIdx));\r\n }\r\n return parameters;\r\n };\r\n\r\n const params = splitParameterCall(RemoveComments(callParams));\r\n\r\n if (params === null) {\r\n if (this.debug) {\r\n console.warn(`Invalid function call: can't extract the parameters of the function call. Function '${name}' (type=${type}). callParamsStartIndex=${callParamsStartIndex}, callParams=` + callParams);\r\n }\r\n startIndex = functionCallIndex + name.length;\r\n continue;\r\n }\r\n\r\n const paramNames = [];\r\n\r\n for (let p = 0; p < params.length; ++p) {\r\n const param = params[p].trim();\r\n paramNames.push(param);\r\n }\r\n\r\n const retParamName = type !== 'void' ? name + '_' + (func.callIndex++) : null;\r\n\r\n if (retParamName) {\r\n paramNames.push(retParamName + ' =');\r\n }\r\n\r\n if (paramNames.length !== parameters.length) {\r\n if (this.debug) {\r\n console.warn(`Invalid function call: not the same number of parameters for the call than the number expected by the function. Function '${name}' (type=${type}). function parameters=${parameters}, call parameters=${paramNames}`);\r\n }\r\n startIndex = functionCallIndex + name.length;\r\n continue;\r\n }\r\n\r\n startIndex = callParamsEndIndex + 1;\r\n\r\n // replace the function call by the body function\r\n const funcBody = this._replaceNames(body, parameters, paramNames);\r\n\r\n let partBefore = functionCallIndex > 0 ? this._sourceCode.substring(0, functionCallIndex) : \"\";\r\n let partAfter = callParamsEndIndex + 1 < this._sourceCode.length - 1 ? this._sourceCode.substring(callParamsEndIndex + 1) : \"\";\r\n\r\n if (retParamName) {\r\n // case where the function returns a value. We generate:\r\n // FUNCTYPE retParamName;\r\n // {function body}\r\n // and replace the function call by retParamName\r\n const injectDeclarationIndex = FindBackward(this._sourceCode, functionCallIndex - 1, '\\n');\r\n\r\n partBefore = this._sourceCode.substring(0, injectDeclarationIndex + 1);\r\n let partBetween = this._sourceCode.substring(injectDeclarationIndex + 1, functionCallIndex);\r\n\r\n this._sourceCode = partBefore + type + \" \" + retParamName + \";\\n\" + funcBody + \"\\n\" + partBetween + retParamName + partAfter;\r\n\r\n if (this.debug) {\r\n console.log(`Replace function call by code. Function '${name}' (type=${type}). injectDeclarationIndex=${injectDeclarationIndex}, call parameters=${paramNames}`);\r\n }\r\n } else {\r\n // simple case where the return value of the function is \"void\"\r\n this._sourceCode = partBefore + funcBody + partAfter;\r\n\r\n startIndex += funcBody.length - (callParamsEndIndex + 1 - functionCallIndex);\r\n\r\n if (this.debug) {\r\n console.log(`Replace function call by code. Function '${name}' (type=${type}). functionCallIndex=${functionCallIndex}, call parameters=${paramNames}`);\r\n }\r\n }\r\n\r\n doAgain = true;\r\n }\r\n }\r\n\r\n return doAgain;\r\n }\r\n\r\n private _replaceNames(code: string, sources: string[], destinations: string[]): string {\r\n for (let i = 0; i < sources.length; ++i) {\r\n const source = new RegExp(EscapeRegExp(sources[i]), 'g'),\r\n sourceLen = sources[i].length,\r\n destination = destinations[i];\r\n\r\n code = code.replace(source, (match, ...args) => {\r\n const offset: number = args[0];\r\n // Make sure \"source\" is not part of a bigger identifier (for eg, if source=view and we matched it with viewDirection)\r\n if (IsIdentifierChar(code.charAt(offset - 1)) || IsIdentifierChar(code.charAt(offset + sourceLen))) {\r\n return sources[i];\r\n }\r\n return destination;\r\n });\r\n }\r\n\r\n return code;\r\n }\r\n}\r\n"]}
|
|
@@ -41,9 +41,12 @@ WebGPUEngine.prototype.createCubeTexture = function (rootUrl, scene, files, noMi
|
|
|
41
41
|
}
|
|
42
42
|
}, !!useSRGBBuffer);
|
|
43
43
|
};
|
|
44
|
-
WebGPUEngine.prototype._setCubeMapTextureParams = function (texture, loadMipmap) {
|
|
44
|
+
WebGPUEngine.prototype._setCubeMapTextureParams = function (texture, loadMipmap, maxLevel) {
|
|
45
45
|
texture.samplingMode = loadMipmap ? 3 : 2;
|
|
46
46
|
texture._cachedWrapU = 0;
|
|
47
47
|
texture._cachedWrapV = 0;
|
|
48
|
+
if (maxLevel) {
|
|
49
|
+
texture._maxLodLevel = maxLevel;
|
|
50
|
+
}
|
|
48
51
|
};
|
|
49
52
|
//# sourceMappingURL=engine.cubeTexture.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.cubeTexture.js","sourceRoot":"","sources":["../../../../../sourceES6/core/Engines/WebGPU/Extensions/engine.cubeTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAIrG,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIlD,YAAY,CAAC,SAAS,CAAC,8BAA8B,GAAG,UAAU,IAAY,EAAE,OAAoC;IAChH,IAAM,eAAe,GAAG,IAAI,eAAe,CAAC,IAAI,EAAE,qBAAqB,CAAC,YAAY,CAAC,CAAC;IAEtF,eAAe,CAAC,MAAM,GAAG,IAAI,CAAC;IAE9B,IAAM,eAAe,cACjB,iBAAiB,EAAE,KAAK,EACxB,kBAAkB,EAAE,CAAC,EACrB,eAAe,EAAE,KAAK,EACtB,OAAO,EAAE,CAAC,IACP,OAAO,CACb,CAAC;IAEF,0CAA0C;IAC1C,eAAe,CAAC,MAAM,GAAG,eAAe,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAEnE,IAAI,CAAC,yBAAyB,CAAC,eAAe,EAAE,IAAI,EAAE,eAAe,CAAC,eAAe,EAAE,eAAe,CAAC,iBAAiB,EAAE,eAAe,CAAC,kBAAkB,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;IAEvL,IAAI,CAAC,cAAc,CAAC,kCAAkC,CA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AAC;KACnC;AACL,CAAC,CAAC","sourcesContent":["import { InternalTexture, InternalTextureSource } from \"../../../Materials/Textures/internalTexture\";\r\nimport { Nullable } from \"../../../types\";\r\n\r\nimport { DepthTextureCreationOptions } from \"../../../Materials/Textures/textureCreationOptions\";\r\nimport { WebGPUEngine } from \"../../webgpuEngine\";\r\n\r\ndeclare type Scene = import(\"../../../scene\").Scene;\r\n\r\nWebGPUEngine.prototype._createDepthStencilCubeTexture = function (size: number, options: DepthTextureCreationOptions): InternalTexture {\r\n const internalTexture = new InternalTexture(this, InternalTextureSource.DepthStencil);\r\n\r\n internalTexture.isCube = true;\r\n\r\n const internalOptions = {\r\n bilinearFiltering: false,\r\n comparisonFunction: 0,\r\n generateStencil: false,\r\n samples: 1,\r\n ...options\r\n };\r\n\r\n // TODO WEBGPU allow to choose the format?\r\n internalTexture.format = internalOptions.generateStencil ? 13 : 14;\r\n\r\n this._setupDepthStencilTexture(internalTexture, size, internalOptions.generateStencil, internalOptions.bilinearFiltering, internalOptions.comparisonFunction, internalOptions.samples);\r\n\r\n this._textureHelper.createGPUTextureForInternalTexture(internalTexture);\r\n\r\n this._internalTexturesCache.push(internalTexture);\r\n\r\n return internalTexture;\r\n};\r\n\r\nWebGPUEngine.prototype.createCubeTexture = function (rootUrl: string, scene: Nullable<Scene>, files: Nullable<string[]>, noMipmap?: boolean, onLoad: Nullable<(data?: any) => void> = null,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null, format?: number, forcedExtension: any = null, createPolynomials: boolean = false, lodScale: number = 0, lodOffset: number = 0,\r\n fallback: Nullable<InternalTexture> = null, useSRGBBuffer = false): InternalTexture {\r\n return this.createCubeTextureBase(\r\n rootUrl, scene, files, !!noMipmap, onLoad, onError, format, forcedExtension, createPolynomials, lodScale, lodOffset, fallback,\r\n null,\r\n (texture: InternalTexture, imgs: HTMLImageElement[] | ImageBitmap[]) => {\r\n const imageBitmaps = imgs as ImageBitmap[]; // we will always get an ImageBitmap array in WebGPU\r\n const width = imageBitmaps[0].width;\r\n const height = width;\r\n\r\n this._setCubeMapTextureParams(texture, !noMipmap);\r\n texture.format = format ?? -1;\r\n\r\n const gpuTextureWrapper = this._textureHelper.createGPUTextureForInternalTexture(texture, width, height);\r\n\r\n this._textureHelper.updateCubeTextures(imageBitmaps, gpuTextureWrapper.underlyingResource!, width, height, gpuTextureWrapper.format, false, false, 0, 0);\r\n\r\n if (!noMipmap) {\r\n this._generateMipmaps(texture, this._uploadEncoder);\r\n }\r\n\r\n texture.isReady = true;\r\n\r\n texture.onLoadedObservable.notifyObservers(texture);\r\n texture.onLoadedObservable.clear();\r\n\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n }, !!useSRGBBuffer\r\n );\r\n};\r\n\r\nWebGPUEngine.prototype._setCubeMapTextureParams = function (texture: InternalTexture, loadMipmap: boolean, maxLevel?: number) {\r\n texture.samplingMode = loadMipmap ? 3 : 2;\r\n texture._cachedWrapU = 0;\r\n texture._cachedWrapV = 0;\r\n if (maxLevel) {\r\n texture._maxLodLevel = maxLevel;\r\n }\r\n};\r\n"]}
|
|
@@ -108,50 +108,50 @@ var WebGPUCacheBindGroups = /** @class */ (function () {
|
|
|
108
108
|
var sampler = bindingInfo.sampler;
|
|
109
109
|
if (!sampler) {
|
|
110
110
|
if (this._engine.dbgSanityChecks) {
|
|
111
|
-
Logger.Error("Trying to bind a null sampler! entry="
|
|
111
|
+
Logger.Error("Trying to bind a null sampler! entry=".concat(JSON.stringify(entry), ", name=").concat(name_1, ", bindingInfo=").concat(JSON.stringify(bindingInfo, function (key, value) { return key === 'texture' ? '<no dump>' : value; }), ", materialContext.uniqueId=").concat(materialContext.uniqueId), 50);
|
|
112
112
|
}
|
|
113
113
|
continue;
|
|
114
114
|
}
|
|
115
115
|
entries[j].resource = this._cacheSampler.getSampler(sampler, false, bindingInfo.hashCode);
|
|
116
116
|
}
|
|
117
117
|
else {
|
|
118
|
-
Logger.Error("Sampler \""
|
|
118
|
+
Logger.Error("Sampler \"".concat(name_1, "\" could not be bound. entry=").concat(JSON.stringify(entry), ", materialContext=").concat(JSON.stringify(materialContext, function (key, value) { return key === 'texture' || key === 'sampler' ? '<no dump>' : value; })), 50);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
else if (entry.texture || entry.storageTexture) {
|
|
122
122
|
var bindingInfo = materialContext.textures[name_1];
|
|
123
123
|
if (bindingInfo) {
|
|
124
124
|
if (this._engine.dbgSanityChecks && bindingInfo.texture === null) {
|
|
125
|
-
Logger.Error("Trying to bind a null texture! entry="
|
|
125
|
+
Logger.Error("Trying to bind a null texture! entry=".concat(JSON.stringify(entry), ", bindingInfo=").concat(JSON.stringify(bindingInfo, function (key, value) { return key === 'texture' ? '<no dump>' : value; }), ", materialContext.uniqueId=").concat(materialContext.uniqueId), 50);
|
|
126
126
|
continue;
|
|
127
127
|
}
|
|
128
128
|
var hardwareTexture = bindingInfo.texture._hardwareTexture;
|
|
129
129
|
if (this._engine.dbgSanityChecks && (!hardwareTexture || entry.texture && !hardwareTexture.view || entry.storageTexture && !hardwareTexture.viewForWriting)) {
|
|
130
|
-
Logger.Error("Trying to bind a null gpu texture or view! entry="
|
|
130
|
+
Logger.Error("Trying to bind a null gpu texture or view! entry=".concat(JSON.stringify(entry), ", name=").concat(name_1, ", bindingInfo=").concat(JSON.stringify(bindingInfo, function (key, value) { return key === 'texture' ? '<no dump>' : value; }), ", isReady=").concat((_j = bindingInfo.texture) === null || _j === void 0 ? void 0 : _j.isReady, ", materialContext.uniqueId=").concat(materialContext.uniqueId), 50);
|
|
131
131
|
continue;
|
|
132
132
|
}
|
|
133
133
|
entries[j].resource = entry.storageTexture ? hardwareTexture.viewForWriting : hardwareTexture.view;
|
|
134
134
|
}
|
|
135
135
|
else {
|
|
136
|
-
Logger.Error("Texture \""
|
|
136
|
+
Logger.Error("Texture \"".concat(name_1, "\" could not be bound. entry=").concat(JSON.stringify(entry), ", materialContext=").concat(JSON.stringify(materialContext, function (key, value) { return key === 'texture' || key === 'sampler' ? '<no dump>' : value; })), 50);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
else if (entry.externalTexture) {
|
|
140
140
|
var bindingInfo = materialContext.textures[name_1];
|
|
141
141
|
if (bindingInfo) {
|
|
142
142
|
if (this._engine.dbgSanityChecks && bindingInfo.texture === null) {
|
|
143
|
-
Logger.Error("Trying to bind a null external texture! entry="
|
|
143
|
+
Logger.Error("Trying to bind a null external texture! entry=".concat(JSON.stringify(entry), ", name=").concat(name_1, ", bindingInfo=").concat(JSON.stringify(bindingInfo, function (key, value) { return key === 'texture' ? '<no dump>' : value; }), ", materialContext.uniqueId=").concat(materialContext.uniqueId), 50);
|
|
144
144
|
continue;
|
|
145
145
|
}
|
|
146
146
|
var externalTexture = bindingInfo.texture.underlyingResource;
|
|
147
147
|
if (this._engine.dbgSanityChecks && !externalTexture) {
|
|
148
|
-
Logger.Error("Trying to bind a null gpu external texture! entry="
|
|
148
|
+
Logger.Error("Trying to bind a null gpu external texture! entry=".concat(JSON.stringify(entry), ", name=").concat(name_1, ", bindingInfo=").concat(JSON.stringify(bindingInfo, function (key, value) { return key === 'texture' ? '<no dump>' : value; }), ", isReady=").concat((_k = bindingInfo.texture) === null || _k === void 0 ? void 0 : _k.isReady, ", materialContext.uniqueId=").concat(materialContext.uniqueId), 50);
|
|
149
149
|
continue;
|
|
150
150
|
}
|
|
151
151
|
entries[j].resource = this._device.importExternalTexture({ source: externalTexture });
|
|
152
152
|
}
|
|
153
153
|
else {
|
|
154
|
-
Logger.Error("Texture \""
|
|
154
|
+
Logger.Error("Texture \"".concat(name_1, "\" could not be bound. entry=").concat(JSON.stringify(entry), ", materialContext=").concat(JSON.stringify(materialContext, function (key, value) { return key === 'texture' || key === 'sampler' ? '<no dump>' : value; })), 50);
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
else if (entry.buffer) {
|
|
@@ -162,7 +162,7 @@ var WebGPUCacheBindGroups = /** @class */ (function () {
|
|
|
162
162
|
entries[j].resource.size = dataBuffer.capacity;
|
|
163
163
|
}
|
|
164
164
|
else {
|
|
165
|
-
Logger.Error("Can't find buffer \""
|
|
165
|
+
Logger.Error("Can't find buffer \"".concat(name_1, "\". entry=").concat(JSON.stringify(entry), ", buffers=").concat(JSON.stringify(drawContext.buffers), ", drawContext.uniqueId=").concat(drawContext.uniqueId), 50);
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpuCacheBindGroups.js","sourceRoot":"","sources":["../../../../sourceES6/core/Engines/WebGPU/webgpuCacheBindGroups.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAU3C;IAII;QACI,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACrB,CAAC;IACL,+BAAC;AAAD,CAAC,AAPD,IAOC;AAED,cAAc;AACd;IA4BI,+BAAY,MAAiB,EAAE,YAAgC,EAAE,MAAoB;QAX9E,aAAQ,GAAG,KAAK,CAAC;QAYpB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAbD,sBAAkB,mCAAU;aAA5B;YACI,OAAO;gBACH,YAAY,EAAE,qBAAqB,CAAC,yBAAyB;gBAC7D,gBAAgB,EAAE,qBAAqB,CAAC,6BAA6B;gBACrE,eAAe,EAAE,qBAAqB,CAAC,4BAA4B;gBACnE,iBAAiB,EAAE,qBAAqB,CAAC,8BAA8B;aAC1E,CAAC;QACN,CAAC;;;OAAA;IAQM,wCAAQ,GAAf;QACI,qBAAqB,CAAC,6BAA6B,GAAG,qBAAqB,CAAC,iCAAiC,CAAC;QAC9G,qBAAqB,CAAC,4BAA4B,GAAG,qBAAqB,CAAC,gCAAgC,CAAC;QAC5G,qBAAqB,CAAC,8BAA8B,GAAG,qBAAqB,CAAC,kCAAk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AElE,uDAAiC,GAAG,CAAC,CAAC;IACtC,sDAAgC,GAAG,CAAC,CAAC;IACrC,wDAAkC,GAAG,CAAC,CAAC;IAqL1D,4BAAC;CAAA,AAhMD,IAgMC;SAhMY,qBAAqB","sourcesContent":["import { Logger } from \"../../Misc/logger\";\r\nimport { WebGPUCacheSampler } from \"./webgpuCacheSampler\";\r\nimport { WebGPUMaterialContext } from \"./webgpuMaterialContext\";\r\nimport { WebGPUPipelineContext } from \"./webgpuPipelineContext\";\r\nimport { WebGPUEngine } from \"../webgpuEngine\";\r\nimport { WebGPUHardwareTexture } from \"./webgpuHardwareTexture\";\r\nimport { InternalTexture } from \"../../Materials/Textures/internalTexture\";\r\nimport { ExternalTexture } from \"../../Materials/Textures/externalTexture\";\r\nimport { WebGPUDrawContext } from \"./webgpuDrawContext\";\r\n\r\nclass WebGPUBindGroupCacheNode {\r\n public values: { [id: number]: WebGPUBindGroupCacheNode };\r\n public bindGroups: GPUBindGroup[];\r\n\r\n constructor() {\r\n this.values = {};\r\n }\r\n}\r\n\r\n/** @hidden */\r\nexport class WebGPUCacheBindGroups {\r\n\r\n public static NumBindGroupsCreatedTotal = 0;\r\n public static NumBindGroupsCreatedLastFrame = 0;\r\n public static NumBindGroupsLookupLastFrame = 0;\r\n public static NumBindGroupsNoLookupLastFrame = 0;\r\n\r\n private static _Cache: WebGPUBindGroupCacheNode = new WebGPUBindGroupCacheNode();\r\n\r\n private static _NumBindGroupsCreatedCurrentFrame = 0;\r\n private static _NumBindGroupsLookupCurrentFrame = 0;\r\n private static _NumBindGroupsNoLookupCurrentFrame = 0;\r\n\r\n private _device: GPUDevice;\r\n private _cacheSampler: WebGPUCacheSampler;\r\n private _engine: WebGPUEngine;\r\n\r\n public disabled = false;\r\n\r\n public static get Statistics() {\r\n return {\r\n totalCreated: WebGPUCacheBindGroups.NumBindGroupsCreatedTotal,\r\n lastFrameCreated: WebGPUCacheBindGroups.NumBindGroupsCreatedLastFrame,\r\n lookupLastFrame: WebGPUCacheBindGroups.NumBindGroupsLookupLastFrame,\r\n noLookupLastFrame: WebGPUCacheBindGroups.NumBindGroupsNoLookupLastFrame,\r\n };\r\n }\r\n\r\n constructor(device: GPUDevice, cacheSampler: WebGPUCacheSampler, engine: WebGPUEngine) {\r\n this._device = device;\r\n this._cacheSampler = cacheSampler;\r\n this._engine = engine;\r\n }\r\n\r\n public endFrame(): void {\r\n WebGPUCacheBindGroups.NumBindGroupsCreatedLastFrame = WebGPUCacheBindGroups._NumBindGroupsCreatedCurrentFrame;\r\n WebGPUCacheBindGroups.NumBindGroupsLookupLastFrame = WebGPUCacheBindGroups._NumBindGroupsLookupCurrentFrame;\r\n WebGPUCacheBindGroups.NumBindGroupsNoLookupLastFrame = WebGPUCacheBindGroups._NumBindGroupsNoLookupCurrentFrame;\r\n WebGPUCacheBindGroups._NumBindGroupsCreatedCurrentFrame = 0;\r\n WebGPUCacheBindGroups._NumBindGroupsLookupCurrentFrame = 0;\r\n WebGPUCacheBindGroups._NumBindGroupsNoLookupCurrentFrame = 0;\r\n }\r\n\r\n /**\r\n * Cache is currently based on the uniform/storage buffers, samplers and textures used by the binding groups.\r\n * Note that all uniform buffers have an offset of 0 in Babylon and we don't have a use case where we would have the same buffer used with different capacity values:\r\n * that means we don't need to factor in the offset/size of the buffer in the cache, only the id\r\n */\r\n public getBindGroups(webgpuPipelineContext: WebGPUPipelineContext, drawContext: WebGPUDrawContext, materialContext: WebGPUMaterialContext): GPUBindGroup[] {\r\n let bindGroups: GPUBindGroup[] | undefined = undefined;\r\n let node = WebGPUCacheBindGroups._Cache;\r\n\r\n const cacheIsDisabled = this.disabled || materialContext.forceBindGroupCreation;\r\n if (!cacheIsDisabled) {\r\n if (!drawContext.isDirty(materialContext.updateId) && !materialContext.isDirty) {\r\n WebGPUCacheBindGroups._NumBindGroupsNoLookupCurrentFrame++;\r\n return drawContext.bindGroups!;\r\n }\r\n\r\n for (const bufferName of webgpuPipelineContext.shaderProcessingContext.bufferNames) {\r\n const uboId = drawContext.buffers[bufferName]?.uniqueId ?? 0;\r\n let nextNode = node.values[uboId];\r\n if (!nextNode) {\r\n nextNode = new WebGPUBindGroupCacheNode();\r\n node.values[uboId] = nextNode;\r\n }\r\n node = nextNode;\r\n }\r\n\r\n for (const samplerName of webgpuPipelineContext.shaderProcessingContext.samplerNames) {\r\n const samplerHashCode = materialContext.samplers[samplerName]?.hashCode ?? 0;\r\n let nextNode = node.values[samplerHashCode];\r\n if (!nextNode) {\r\n nextNode = new WebGPUBindGroupCacheNode();\r\n node.values[samplerHashCode] = nextNode;\r\n }\r\n node = nextNode;\r\n }\r\n\r\n for (const textureName of webgpuPipelineContext.shaderProcessingContext.textureNames) {\r\n const textureId = materialContext.textures[textureName]?.texture?.uniqueId ?? 0;\r\n let nextNode = node.values[textureId];\r\n if (!nextNode) {\r\n nextNode = new WebGPUBindGroupCacheNode();\r\n node.values[textureId] = nextNode;\r\n }\r\n node = nextNode;\r\n }\r\n\r\n bindGroups = node.bindGroups;\r\n }\r\n\r\n drawContext.resetIsDirty(materialContext.updateId);\r\n materialContext.isDirty = false;\r\n\r\n if (bindGroups) {\r\n drawContext.bindGroups = bindGroups;\r\n WebGPUCacheBindGroups._NumBindGroupsLookupCurrentFrame++;\r\n return bindGroups;\r\n }\r\n\r\n bindGroups = [];\r\n drawContext.bindGroups = bindGroups;\r\n\r\n if (!cacheIsDisabled) {\r\n node.bindGroups = bindGroups;\r\n }\r\n\r\n WebGPUCacheBindGroups.NumBindGroupsCreatedTotal++;\r\n WebGPUCacheBindGroups._NumBindGroupsCreatedCurrentFrame++;\r\n\r\n const bindGroupLayouts = webgpuPipelineContext.bindGroupLayouts;\r\n for (let i = 0; i < webgpuPipelineContext.shaderProcessingContext.bindGroupLayoutEntries.length; i++) {\r\n const setDefinition = webgpuPipelineContext.shaderProcessingContext.bindGroupLayoutEntries[i];\r\n\r\n const entries = webgpuPipelineContext.shaderProcessingContext.bindGroupEntries[i];\r\n for (let j = 0; j < setDefinition.length; j++) {\r\n const entry = webgpuPipelineContext.shaderProcessingContext.bindGroupLayoutEntries[i][j];\r\n const entryInfo = webgpuPipelineContext.shaderProcessingContext.bindGroupLayoutEntryInfo[i][entry.binding];\r\n const name = entryInfo.nameInArrayOfTexture ?? entryInfo.name;\r\n\r\n if (entry.sampler) {\r\n const bindingInfo = materialContext.samplers[name];\r\n if (bindingInfo) {\r\n const sampler = bindingInfo.sampler;\r\n if (!sampler) {\r\n if (this._engine.dbgSanityChecks) {\r\n Logger.Error(`Trying to bind a null sampler! entry=${JSON.stringify(entry)}, name=${name}, bindingInfo=${JSON.stringify(bindingInfo, (key: string, value: any) => key === 'texture' ? '<no dump>' : value)}, materialContext.uniqueId=${materialContext.uniqueId}`, 50);\r\n }\r\n continue;\r\n }\r\n entries[j].resource = this._cacheSampler.getSampler(sampler, false, bindingInfo.hashCode);\r\n } else {\r\n Logger.Error(`Sampler \"${name}\" could not be bound. entry=${JSON.stringify(entry)}, materialContext=${JSON.stringify(materialContext, (key: string, value: any) => key === 'texture' || key === 'sampler' ? '<no dump>' : value)}`, 50);\r\n }\r\n } else if (entry.texture || entry.storageTexture) {\r\n const bindingInfo = materialContext.textures[name];\r\n if (bindingInfo) {\r\n if (this._engine.dbgSanityChecks && bindingInfo.texture === null) {\r\n Logger.Error(`Trying to bind a null texture! entry=${JSON.stringify(entry)}, bindingInfo=${JSON.stringify(bindingInfo, (key: string, value: any) => key === 'texture' ? '<no dump>' : value)}, materialContext.uniqueId=${materialContext.uniqueId}`, 50);\r\n continue;\r\n }\r\n const hardwareTexture = (bindingInfo.texture as InternalTexture)._hardwareTexture as WebGPUHardwareTexture;\r\n\r\n if (this._engine.dbgSanityChecks && (!hardwareTexture || entry.texture && !hardwareTexture.view || entry.storageTexture && !hardwareTexture.viewForWriting)) {\r\n Logger.Error(`Trying to bind a null gpu texture or view! entry=${JSON.stringify(entry)}, name=${name}, bindingInfo=${JSON.stringify(bindingInfo, (key: string, value: any) => key === 'texture' ? '<no dump>' : value)}, isReady=${bindingInfo.texture?.isReady}, materialContext.uniqueId=${materialContext.uniqueId}`, 50);\r\n continue;\r\n }\r\n\r\n entries[j].resource = entry.storageTexture ? hardwareTexture.viewForWriting! : hardwareTexture.view!;\r\n } else {\r\n Logger.Error(`Texture \"${name}\" could not be bound. entry=${JSON.stringify(entry)}, materialContext=${JSON.stringify(materialContext, (key: string, value: any) => key === 'texture' || key === 'sampler' ? '<no dump>' : value)}`, 50);\r\n }\r\n } else if (entry.externalTexture) {\r\n const bindingInfo = materialContext.textures[name];\r\n if (bindingInfo) {\r\n if (this._engine.dbgSanityChecks && bindingInfo.texture === null) {\r\n Logger.Error(`Trying to bind a null external texture! entry=${JSON.stringify(entry)}, name=${name}, bindingInfo=${JSON.stringify(bindingInfo, (key: string, value: any) => key === 'texture' ? '<no dump>' : value)}, materialContext.uniqueId=${materialContext.uniqueId}`, 50);\r\n continue;\r\n }\r\n const externalTexture = (bindingInfo.texture as ExternalTexture).underlyingResource;\r\n\r\n if (this._engine.dbgSanityChecks && !externalTexture) {\r\n Logger.Error(`Trying to bind a null gpu external texture! entry=${JSON.stringify(entry)}, name=${name}, bindingInfo=${JSON.stringify(bindingInfo, (key: string, value: any) => key === 'texture' ? '<no dump>' : value)}, isReady=${bindingInfo.texture?.isReady}, materialContext.uniqueId=${materialContext.uniqueId}`, 50);\r\n continue;\r\n }\r\n\r\n entries[j].resource = this._device.importExternalTexture({ source: externalTexture });\r\n } else {\r\n Logger.Error(`Texture \"${name}\" could not be bound. entry=${JSON.stringify(entry)}, materialContext=${JSON.stringify(materialContext, (key: string, value: any) => key === 'texture' || key === 'sampler' ? '<no dump>' : value)}`, 50);\r\n }\r\n } else if (entry.buffer) {\r\n const dataBuffer = drawContext.buffers[name];\r\n if (dataBuffer) {\r\n const webgpuBuffer = dataBuffer.underlyingResource as GPUBuffer;\r\n (entries[j].resource as GPUBufferBinding).buffer = webgpuBuffer;\r\n (entries[j].resource as GPUBufferBinding).size = dataBuffer.capacity;\r\n } else {\r\n Logger.Error(`Can't find buffer \"${name}\". entry=${JSON.stringify(entry)}, buffers=${JSON.stringify(drawContext.buffers)}, drawContext.uniqueId=${drawContext.uniqueId}`, 50);\r\n }\r\n }\r\n }\r\n\r\n let groupLayout = bindGroupLayouts[i];\r\n bindGroups[i] = this._device.createBindGroup({\r\n layout: groupLayout,\r\n entries,\r\n });\r\n }\r\n\r\n return bindGroups;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"webgpuCacheBindGroups.js","sourceRoot":"","sources":["../../../../sourceES6/core/Engines/WebGPU/webgpuCacheBindGroups.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAU3C;IAII;QACI,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACrB,CAAC;IACL,+BAAC;AAAD,CAAC,AAPD,IAOC;AAED,cAAc;AACd;IA4BI,+BAAY,MAAiB,EAAE,YAAgC,EAAE,MAAoB;QAX9E,aAAQ,GAAG,KAAK,CAAC;QAYpB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAbD,sBAAkB,mCAAU;aAA5B;YACI,OAAO;gBACH,YAAY,EAAE,qBAAqB,CAAC,yBAAyB;gBAC7D,gBAAgB,EAAE,qBAAqB,CAAC,6BAA6B;gBACrE,eAAe,EAAE,qBAAqB,CAAC,4BAA4B;gBACnE,iBAAiB,EAAE,qBAAqB,CAAC,8BAA8B;aAC1E,CAAC;QACN,CAAC;;;OAAA;IAQM,wCAAQ,GAAf;QACI,qBAAqB,CAAC,6BAA6B,GAAG,qBAAqB,CAAC,iCAAiC,CAAC;QAC9G,qBAAqB,CAAC,4BAA4B,GAAG,qBAAqB,CAAC,gCAAgC,CAAC;QAC5G,qBAAqB,CAAC,8BAA8B,GAAG,qBAAqB,CAAC,kCAAkC,CAAC;QACh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AC,CAAC;IAElC,4BAAM,GAA6B,IAAI,wBAAwB,EAAE,CAAC;IAElE,uDAAiC,GAAG,CAAC,CAAC;IACtC,sDAAgC,GAAG,CAAC,CAAC;IACrC,wDAAkC,GAAG,CAAC,CAAC;IAqL1D,4BAAC;CAAA,AAhMD,IAgMC;SAhMY,qBAAqB","sourcesContent":["import { Logger } from \"../../Misc/logger\";\r\nimport { WebGPUCacheSampler } from \"./webgpuCacheSampler\";\r\nimport { WebGPUMaterialContext } from \"./webgpuMaterialContext\";\r\nimport { WebGPUPipelineContext } from \"./webgpuPipelineContext\";\r\nimport { WebGPUEngine } from \"../webgpuEngine\";\r\nimport { WebGPUHardwareTexture } from \"./webgpuHardwareTexture\";\r\nimport { InternalTexture } from \"../../Materials/Textures/internalTexture\";\r\nimport { ExternalTexture } from \"../../Materials/Textures/externalTexture\";\r\nimport { WebGPUDrawContext } from \"./webgpuDrawContext\";\r\n\r\nclass WebGPUBindGroupCacheNode {\r\n public values: { [id: number]: WebGPUBindGroupCacheNode };\r\n public bindGroups: GPUBindGroup[];\r\n\r\n constructor() {\r\n this.values = {};\r\n }\r\n}\r\n\r\n/** @hidden */\r\nexport class WebGPUCacheBindGroups {\r\n\r\n public static NumBindGroupsCreatedTotal = 0;\r\n public static NumBindGroupsCreatedLastFrame = 0;\r\n public static NumBindGroupsLookupLastFrame = 0;\r\n public static NumBindGroupsNoLookupLastFrame = 0;\r\n\r\n private static _Cache: WebGPUBindGroupCacheNode = new WebGPUBindGroupCacheNode();\r\n\r\n private static _NumBindGroupsCreatedCurrentFrame = 0;\r\n private static _NumBindGroupsLookupCurrentFrame = 0;\r\n private static _NumBindGroupsNoLookupCurrentFrame = 0;\r\n\r\n private _device: GPUDevice;\r\n private _cacheSampler: WebGPUCacheSampler;\r\n private _engine: WebGPUEngine;\r\n\r\n public disabled = false;\r\n\r\n public static get Statistics() {\r\n return {\r\n totalCreated: WebGPUCacheBindGroups.NumBindGroupsCreatedTotal,\r\n lastFrameCreated: WebGPUCacheBindGroups.NumBindGroupsCreatedLastFrame,\r\n lookupLastFrame: WebGPUCacheBindGroups.NumBindGroupsLookupLastFrame,\r\n noLookupLastFrame: WebGPUCacheBindGroups.NumBindGroupsNoLookupLastFrame,\r\n };\r\n }\r\n\r\n constructor(device: GPUDevice, cacheSampler: WebGPUCacheSampler, engine: WebGPUEngine) {\r\n this._device = device;\r\n this._cacheSampler = cacheSampler;\r\n this._engine = engine;\r\n }\r\n\r\n public endFrame(): void {\r\n WebGPUCacheBindGroups.NumBindGroupsCreatedLastFrame = WebGPUCacheBindGroups._NumBindGroupsCreatedCurrentFrame;\r\n WebGPUCacheBindGroups.NumBindGroupsLookupLastFrame = WebGPUCacheBindGroups._NumBindGroupsLookupCurrentFrame;\r\n WebGPUCacheBindGroups.NumBindGroupsNoLookupLastFrame = WebGPUCacheBindGroups._NumBindGroupsNoLookupCurrentFrame;\r\n WebGPUCacheBindGroups._NumBindGroupsCreatedCurrentFrame = 0;\r\n WebGPUCacheBindGroups._NumBindGroupsLookupCurrentFrame = 0;\r\n WebGPUCacheBindGroups._NumBindGroupsNoLookupCurrentFrame = 0;\r\n }\r\n\r\n /**\r\n * Cache is currently based on the uniform/storage buffers, samplers and textures used by the binding groups.\r\n * Note that all uniform buffers have an offset of 0 in Babylon and we don't have a use case where we would have the same buffer used with different capacity values:\r\n * that means we don't need to factor in the offset/size of the buffer in the cache, only the id\r\n */\r\n public getBindGroups(webgpuPipelineContext: WebGPUPipelineContext, drawContext: WebGPUDrawContext, materialContext: WebGPUMaterialContext): GPUBindGroup[] {\r\n let bindGroups: GPUBindGroup[] | undefined = undefined;\r\n let node = WebGPUCacheBindGroups._Cache;\r\n\r\n const cacheIsDisabled = this.disabled || materialContext.forceBindGroupCreation;\r\n if (!cacheIsDisabled) {\r\n if (!drawContext.isDirty(materialContext.updateId) && !materialContext.isDirty) {\r\n WebGPUCacheBindGroups._NumBindGroupsNoLookupCurrentFrame++;\r\n return drawContext.bindGroups!;\r\n }\r\n\r\n for (const bufferName of webgpuPipelineContext.shaderProcessingContext.bufferNames) {\r\n const uboId = drawContext.buffers[bufferName]?.uniqueId ?? 0;\r\n let nextNode = node.values[uboId];\r\n if (!nextNode) {\r\n nextNode = new WebGPUBindGroupCacheNode();\r\n node.values[uboId] = nextNode;\r\n }\r\n node = nextNode;\r\n }\r\n\r\n for (const samplerName of webgpuPipelineContext.shaderProcessingContext.samplerNames) {\r\n const samplerHashCode = materialContext.samplers[samplerName]?.hashCode ?? 0;\r\n let nextNode = node.values[samplerHashCode];\r\n if (!nextNode) {\r\n nextNode = new WebGPUBindGroupCacheNode();\r\n node.values[samplerHashCode] = nextNode;\r\n }\r\n node = nextNode;\r\n }\r\n\r\n for (const textureName of webgpuPipelineContext.shaderProcessingContext.textureNames) {\r\n const textureId = materialContext.textures[textureName]?.texture?.uniqueId ?? 0;\r\n let nextNode = node.values[textureId];\r\n if (!nextNode) {\r\n nextNode = new WebGPUBindGroupCacheNode();\r\n node.values[textureId] = nextNode;\r\n }\r\n node = nextNode;\r\n }\r\n\r\n bindGroups = node.bindGroups;\r\n }\r\n\r\n drawContext.resetIsDirty(materialContext.updateId);\r\n materialContext.isDirty = false;\r\n\r\n if (bindGroups) {\r\n drawContext.bindGroups = bindGroups;\r\n WebGPUCacheBindGroups._NumBindGroupsLookupCurrentFrame++;\r\n return bindGroups;\r\n }\r\n\r\n bindGroups = [];\r\n drawContext.bindGroups = bindGroups;\r\n\r\n if (!cacheIsDisabled) {\r\n node.bindGroups = bindGroups;\r\n }\r\n\r\n WebGPUCacheBindGroups.NumBindGroupsCreatedTotal++;\r\n WebGPUCacheBindGroups._NumBindGroupsCreatedCurrentFrame++;\r\n\r\n const bindGroupLayouts = webgpuPipelineContext.bindGroupLayouts;\r\n for (let i = 0; i < webgpuPipelineContext.shaderProcessingContext.bindGroupLayoutEntries.length; i++) {\r\n const setDefinition = webgpuPipelineContext.shaderProcessingContext.bindGroupLayoutEntries[i];\r\n\r\n const entries = webgpuPipelineContext.shaderProcessingContext.bindGroupEntries[i];\r\n for (let j = 0; j < setDefinition.length; j++) {\r\n const entry = webgpuPipelineContext.shaderProcessingContext.bindGroupLayoutEntries[i][j];\r\n const entryInfo = webgpuPipelineContext.shaderProcessingContext.bindGroupLayoutEntryInfo[i][entry.binding];\r\n const name = entryInfo.nameInArrayOfTexture ?? entryInfo.name;\r\n\r\n if (entry.sampler) {\r\n const bindingInfo = materialContext.samplers[name];\r\n if (bindingInfo) {\r\n const sampler = bindingInfo.sampler;\r\n if (!sampler) {\r\n if (this._engine.dbgSanityChecks) {\r\n Logger.Error(`Trying to bind a null sampler! entry=${JSON.stringify(entry)}, name=${name}, bindingInfo=${JSON.stringify(bindingInfo, (key: string, value: any) => key === 'texture' ? '<no dump>' : value)}, materialContext.uniqueId=${materialContext.uniqueId}`, 50);\r\n }\r\n continue;\r\n }\r\n entries[j].resource = this._cacheSampler.getSampler(sampler, false, bindingInfo.hashCode);\r\n } else {\r\n Logger.Error(`Sampler \"${name}\" could not be bound. entry=${JSON.stringify(entry)}, materialContext=${JSON.stringify(materialContext, (key: string, value: any) => key === 'texture' || key === 'sampler' ? '<no dump>' : value)}`, 50);\r\n }\r\n } else if (entry.texture || entry.storageTexture) {\r\n const bindingInfo = materialContext.textures[name];\r\n if (bindingInfo) {\r\n if (this._engine.dbgSanityChecks && bindingInfo.texture === null) {\r\n Logger.Error(`Trying to bind a null texture! entry=${JSON.stringify(entry)}, bindingInfo=${JSON.stringify(bindingInfo, (key: string, value: any) => key === 'texture' ? '<no dump>' : value)}, materialContext.uniqueId=${materialContext.uniqueId}`, 50);\r\n continue;\r\n }\r\n const hardwareTexture = (bindingInfo.texture as InternalTexture)._hardwareTexture as WebGPUHardwareTexture;\r\n\r\n if (this._engine.dbgSanityChecks && (!hardwareTexture || entry.texture && !hardwareTexture.view || entry.storageTexture && !hardwareTexture.viewForWriting)) {\r\n Logger.Error(`Trying to bind a null gpu texture or view! entry=${JSON.stringify(entry)}, name=${name}, bindingInfo=${JSON.stringify(bindingInfo, (key: string, value: any) => key === 'texture' ? '<no dump>' : value)}, isReady=${bindingInfo.texture?.isReady}, materialContext.uniqueId=${materialContext.uniqueId}`, 50);\r\n continue;\r\n }\r\n\r\n entries[j].resource = entry.storageTexture ? hardwareTexture.viewForWriting! : hardwareTexture.view!;\r\n } else {\r\n Logger.Error(`Texture \"${name}\" could not be bound. entry=${JSON.stringify(entry)}, materialContext=${JSON.stringify(materialContext, (key: string, value: any) => key === 'texture' || key === 'sampler' ? '<no dump>' : value)}`, 50);\r\n }\r\n } else if (entry.externalTexture) {\r\n const bindingInfo = materialContext.textures[name];\r\n if (bindingInfo) {\r\n if (this._engine.dbgSanityChecks && bindingInfo.texture === null) {\r\n Logger.Error(`Trying to bind a null external texture! entry=${JSON.stringify(entry)}, name=${name}, bindingInfo=${JSON.stringify(bindingInfo, (key: string, value: any) => key === 'texture' ? '<no dump>' : value)}, materialContext.uniqueId=${materialContext.uniqueId}`, 50);\r\n continue;\r\n }\r\n const externalTexture = (bindingInfo.texture as ExternalTexture).underlyingResource;\r\n\r\n if (this._engine.dbgSanityChecks && !externalTexture) {\r\n Logger.Error(`Trying to bind a null gpu external texture! entry=${JSON.stringify(entry)}, name=${name}, bindingInfo=${JSON.stringify(bindingInfo, (key: string, value: any) => key === 'texture' ? '<no dump>' : value)}, isReady=${bindingInfo.texture?.isReady}, materialContext.uniqueId=${materialContext.uniqueId}`, 50);\r\n continue;\r\n }\r\n\r\n entries[j].resource = this._device.importExternalTexture({ source: externalTexture });\r\n } else {\r\n Logger.Error(`Texture \"${name}\" could not be bound. entry=${JSON.stringify(entry)}, materialContext=${JSON.stringify(materialContext, (key: string, value: any) => key === 'texture' || key === 'sampler' ? '<no dump>' : value)}`, 50);\r\n }\r\n } else if (entry.buffer) {\r\n const dataBuffer = drawContext.buffers[name];\r\n if (dataBuffer) {\r\n const webgpuBuffer = dataBuffer.underlyingResource as GPUBuffer;\r\n (entries[j].resource as GPUBufferBinding).buffer = webgpuBuffer;\r\n (entries[j].resource as GPUBufferBinding).size = dataBuffer.capacity;\r\n } else {\r\n Logger.Error(`Can't find buffer \"${name}\". entry=${JSON.stringify(entry)}, buffers=${JSON.stringify(drawContext.buffers)}, drawContext.uniqueId=${drawContext.uniqueId}`, 50);\r\n }\r\n }\r\n }\r\n\r\n let groupLayout = bindGroupLayouts[i];\r\n bindGroups[i] = this._device.createBindGroup({\r\n layout: groupLayout,\r\n entries,\r\n });\r\n }\r\n\r\n return bindGroups;\r\n }\r\n}\r\n"]}
|
|
@@ -515,7 +515,7 @@ var WebGPUCacheRenderPipeline = /** @class */ (function () {
|
|
|
515
515
|
}
|
|
516
516
|
break;
|
|
517
517
|
}
|
|
518
|
-
throw new Error("Invalid Format '"
|
|
518
|
+
throw new Error("Invalid Format '".concat(vertexBuffer.getKind(), "' - type=").concat(type, ", normalized=").concat(normalized, ", size=").concat(size));
|
|
519
519
|
};
|
|
520
520
|
WebGPUCacheRenderPipeline.prototype._getAphaBlendState = function () {
|
|
521
521
|
if (!this._alphaBlendEnabled) {
|