@babylonjs/core 7.35.2 → 7.37.0
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/Collisions/gpuPicker.js.map +1 -1
- package/Engines/Extensions/engine.multiRender.d.ts +11 -0
- package/Engines/Extensions/engine.multiRender.js +71 -32
- package/Engines/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/Extensions/engine.rawTexture.d.ts +8 -8
- package/Engines/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/Extensions/engine.renderTarget.js +1 -13
- package/Engines/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/Extensions/engine.renderTargetCube.js.map +1 -1
- package/Engines/WebGL/webGLRenderTargetWrapper.d.ts +2 -0
- package/Engines/WebGL/webGLRenderTargetWrapper.js +37 -7
- package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.d.ts +11 -0
- package/Engines/WebGPU/Extensions/engine.multiRender.js +30 -11
- package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.rawTexture.d.ts +9 -9
- package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js +2 -5
- package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTargetCube.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +3 -2
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuConstants.d.ts +6 -0
- package/Engines/WebGPU/webgpuConstants.js +6 -0
- package/Engines/WebGPU/webgpuConstants.js.map +1 -1
- package/Engines/WebGPU/webgpuHardwareTexture.d.ts +3 -1
- package/Engines/WebGPU/webgpuHardwareTexture.js +5 -4
- package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.js +18 -0
- package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +8 -2
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/abstractEngine.d.ts +12 -1
- package/Engines/abstractEngine.js +4 -4
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/constants.d.ts +17 -1
- package/Engines/constants.js +17 -1
- package/Engines/constants.js.map +1 -1
- package/Engines/engine.d.ts +31 -1
- package/Engines/engine.js +17 -1
- package/Engines/engine.js.map +1 -1
- package/Engines/engineCapabilities.d.ts +2 -0
- package/Engines/engineCapabilities.js.map +1 -1
- package/Engines/nativeEngine.js +1 -0
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.d.ts +2 -2
- package/Engines/nullEngine.js +3 -2
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/renderTargetWrapper.d.ts +33 -1
- package/Engines/renderTargetWrapper.js +64 -4
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/thinEngine.d.ts +13 -1
- package/Engines/thinEngine.functions.d.ts +4 -0
- package/Engines/thinEngine.functions.js +17 -0
- package/Engines/thinEngine.functions.js.map +1 -1
- package/Engines/thinEngine.js +151 -32
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/thinWebGPUEngine.d.ts +2 -0
- package/Engines/thinWebGPUEngine.js +7 -0
- package/Engines/thinWebGPUEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +12 -3
- package/Engines/webgpuEngine.js +40 -9
- package/Engines/webgpuEngine.js.map +1 -1
- package/FrameGraph/Node/Blocks/Textures/clearBlock.d.ts +8 -0
- package/FrameGraph/Node/Blocks/Textures/clearBlock.js +22 -1
- package/FrameGraph/Node/Blocks/Textures/clearBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/inputBlock.d.ts +4 -9
- package/FrameGraph/Node/Blocks/inputBlock.js +15 -25
- package/FrameGraph/Node/Blocks/inputBlock.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js +10 -2
- package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js.map +1 -1
- package/FrameGraph/Passes/renderPass.d.ts +10 -10
- package/FrameGraph/Passes/renderPass.js +10 -10
- package/FrameGraph/Passes/renderPass.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/bloomTask.d.ts +10 -5
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js +29 -14
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js +4 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.d.ts +11 -6
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js +30 -13
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +4 -6
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/cullObjectsTask.d.ts +1 -1
- package/FrameGraph/Tasks/Rendering/cullObjectsTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +3 -3
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +33 -32
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +4 -2
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js +8 -12
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js +13 -18
- package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +15 -2
- package/FrameGraph/Tasks/Texture/clearTextureTask.js +17 -4
- package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js +2 -2
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/generateMipMapsTask.js +3 -3
- package/FrameGraph/Tasks/Texture/generateMipMapsTask.js.map +1 -1
- package/FrameGraph/frameGraph.d.ts +11 -74
- package/FrameGraph/frameGraph.js +12 -126
- package/FrameGraph/frameGraph.js.map +1 -1
- package/FrameGraph/frameGraphRenderContext.d.ts +17 -8
- package/FrameGraph/frameGraphRenderContext.js +55 -43
- package/FrameGraph/frameGraphRenderContext.js.map +1 -1
- package/FrameGraph/frameGraphRenderTarget.d.ts +16 -0
- package/FrameGraph/frameGraphRenderTarget.js +67 -0
- package/FrameGraph/frameGraphRenderTarget.js.map +1 -0
- package/FrameGraph/frameGraphTask.d.ts +4 -3
- package/FrameGraph/frameGraphTask.js +41 -8
- package/FrameGraph/frameGraphTask.js.map +1 -1
- package/FrameGraph/frameGraphTextureManager.d.ts +130 -22
- package/FrameGraph/frameGraphTextureManager.js +312 -130
- package/FrameGraph/frameGraphTextureManager.js.map +1 -1
- package/FrameGraph/frameGraphTypes.d.ts +28 -13
- package/FrameGraph/frameGraphTypes.js.map +1 -1
- package/FrameGraph/index.d.ts +1 -0
- package/FrameGraph/index.js +1 -0
- package/FrameGraph/index.js.map +1 -1
- package/Helpers/environmentHelper.js.map +1 -1
- package/Layers/effectLayer.d.ts +1 -1
- package/Layers/effectLayer.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.map +1 -1
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Materials/Node/Blocks/conditionalBlock.d.ts +2 -0
- package/Materials/Node/Blocks/conditionalBlock.js +13 -0
- package/Materials/Node/Blocks/conditionalBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js +12 -4
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
- package/Materials/Textures/MultiviewRenderTarget.js.map +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
- package/Materials/Textures/baseTexture.js.map +1 -1
- package/Materials/Textures/colorGradingTexture.js.map +1 -1
- package/Materials/Textures/internalTexture.d.ts +20 -0
- package/Materials/Textures/internalTexture.js +48 -0
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Materials/Textures/mirrorTexture.js.map +1 -1
- package/Materials/Textures/multiRenderTarget.d.ts +5 -0
- package/Materials/Textures/multiRenderTarget.js.map +1 -1
- package/Materials/Textures/rawCubeTexture.d.ts +2 -2
- package/Materials/Textures/rawCubeTexture.js +2 -2
- package/Materials/Textures/rawCubeTexture.js.map +1 -1
- package/Materials/Textures/rawTexture.js.map +1 -1
- package/Materials/Textures/rawTexture2DArray.d.ts +1 -1
- package/Materials/Textures/rawTexture2DArray.js +1 -1
- package/Materials/Textures/rawTexture2DArray.js.map +1 -1
- package/Materials/Textures/rawTexture3D.d.ts +1 -1
- package/Materials/Textures/rawTexture3D.js +1 -1
- package/Materials/Textures/rawTexture3D.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/textureCreationOptions.d.ts +6 -6
- package/Materials/Textures/textureCreationOptions.js.map +1 -1
- package/Materials/drawWrapper.d.ts +6 -1
- package/Materials/drawWrapper.js +18 -2
- package/Materials/drawWrapper.js.map +1 -1
- package/Materials/effect.d.ts +6 -1
- package/Materials/effect.functions.d.ts +5 -0
- package/Materials/effect.functions.js +19 -0
- package/Materials/effect.functions.js.map +1 -1
- package/Materials/effect.js +22 -20
- package/Materials/effect.js.map +1 -1
- package/Materials/effect.webgl.functions.js +12 -4
- package/Materials/effect.webgl.functions.js.map +1 -1
- package/Maths/math.color.d.ts +16 -0
- package/Maths/math.color.js +16 -0
- package/Maths/math.color.js.map +1 -1
- package/Maths/math.vector.d.ts +32 -0
- package/Maths/math.vector.js +32 -0
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Compression/dracoCompression.d.ts +3 -1
- package/Meshes/Compression/dracoCompression.js +5 -2
- package/Meshes/Compression/dracoCompression.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +2 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +1 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/Node/Blocks/Matrices/rotationXBlock.d.ts +0 -1
- package/Meshes/Node/Blocks/Matrices/rotationXBlock.js +1 -9
- package/Meshes/Node/Blocks/Matrices/rotationXBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Matrices/rotationYBlock.d.ts +0 -1
- package/Meshes/Node/Blocks/Matrices/rotationYBlock.js +1 -9
- package/Meshes/Node/Blocks/Matrices/rotationYBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Matrices/rotationZBlock.d.ts +0 -1
- package/Meshes/Node/Blocks/Matrices/rotationZBlock.js +1 -9
- package/Meshes/Node/Blocks/Matrices/rotationZBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/latticeBlock.js +3 -1
- package/Meshes/Node/Blocks/Set/latticeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/conditionBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/conditionBlock.js +15 -0
- package/Meshes/Node/Blocks/conditionBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryClampBlock.d.ts +4 -4
- package/Meshes/Node/Blocks/geometryClampBlock.js +16 -25
- package/Meshes/Node/Blocks/geometryClampBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryLerpBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryLerpBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryNLerpBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryNLerpBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryReplaceColorBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryReplaceColorBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryRotate2dBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryRotate2dBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometrySmoothStepBlock.js +3 -3
- package/Meshes/Node/Blocks/geometrySmoothStepBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryStepBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryStepBlock.js.map +1 -1
- package/Meshes/Node/nodeGeometry.js +1 -1
- package/Meshes/Node/nodeGeometry.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlock.d.ts +3 -1
- package/Meshes/Node/nodeGeometryBlock.js +2 -1
- package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +10 -2
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +5 -3
- package/Meshes/abstractMesh.js +9 -7
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/subMesh.d.ts +5 -3
- package/Meshes/subMesh.js +9 -7
- package/Meshes/subMesh.js.map +1 -1
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js.map +1 -1
- package/Misc/dds.d.ts +1 -1
- package/Misc/dds.js.map +1 -1
- package/Misc/environmentTextureTools.js.map +1 -1
- package/Misc/observable.d.ts +1 -3
- package/Misc/observable.js +9 -7
- package/Misc/observable.js.map +1 -1
- package/Misc/screenshotTools.js.map +1 -1
- package/Misc/snapshotRenderingHelper.js +3 -0
- package/Misc/snapshotRenderingHelper.js.map +1 -1
- package/Misc/textureTools.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.d.ts +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js.map +1 -1
- package/PostProcesses/bloomMergePostProcess.js.map +1 -1
- package/PostProcesses/blurPostProcess.js.map +1 -1
- package/PostProcesses/chromaticAberrationPostProcess.js.map +1 -1
- package/PostProcesses/circleOfConfusionPostProcess.js.map +1 -1
- package/PostProcesses/convolutionPostProcess.js.map +1 -1
- package/PostProcesses/depthOfFieldBlurPostProcess.js.map +1 -1
- package/PostProcesses/depthOfFieldMergePostProcess.js.map +1 -1
- package/PostProcesses/extractHighlightsPostProcess.js.map +1 -1
- package/PostProcesses/fxaaPostProcess.js.map +1 -1
- package/PostProcesses/grainPostProcess.js.map +1 -1
- package/PostProcesses/highlightsPostProcess.d.ts +1 -1
- package/PostProcesses/highlightsPostProcess.js +1 -1
- package/PostProcesses/highlightsPostProcess.js.map +1 -1
- package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
- package/PostProcesses/motionBlurPostProcess.js.map +1 -1
- package/PostProcesses/passPostProcess.js.map +1 -1
- package/PostProcesses/postProcess.d.ts +1 -1
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/screenSpaceCurvaturePostProcess.js.map +1 -1
- package/PostProcesses/screenSpaceReflectionPostProcess.js.map +1 -1
- package/PostProcesses/sharpenPostProcess.js.map +1 -1
- package/PostProcesses/subSurfaceScatteringPostProcess.js.map +1 -1
- package/PostProcesses/tonemapPostProcess.d.ts +1 -1
- package/PostProcesses/tonemapPostProcess.js +1 -1
- package/PostProcesses/tonemapPostProcess.js.map +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsImportanceSamplingRenderer.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsSpatialBlurPass.js.map +1 -1
- package/Rendering/prePassRenderer.js.map +1 -1
- package/ShadersWGSL/pbr.fragment.js +4 -3
- package/ShadersWGSL/pbr.fragment.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webGLRenderTargetWrapper.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/WebGL/webGLRenderTargetWrapper.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG7D,gBAAgB;AAChB,MAAM,OAAO,wBAAyB,SAAQ,mBAAmB;IAoC7D,YAAY,OAAgB,EAAE,MAAe,EAAE,IAAiB,EAAE,MAAkB,EAAE,OAA8B;QAChH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAlCzC;;WAEG;QACI,iBAAY,GAA+B,IAAI,CAAC;QACvD;;WAEG;QACI,wBAAmB,GAAgC,IAAI,CAAC;QAC/D,gEAAgE;QAChE;;WAEG;QACH,gEAAgE;QACzD,qBAAgB,GAA+B,IAAI,CAAC;QAE3D,YAAY;QACZ;;WAEG;QACI,uBAAkB,GAA2B,IAAI,CAAC;QACzD;;WAEG;QACI,8BAAyB,GAA2B,IAAI,CAAC;QAChE;;WAEG;QACI,6BAAwB,GAAG,KAAK,CAAC;QACxC;;WAEG;QACI,gBAAW,GAAG,CAAC,CAAC;QAKnB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC5B,CAAC;IAEkB,yBAAyB;QACxC,IAAI,GAAG,GAAkC,IAAI,CAAC;QAE9C,IAAI,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC,yBAAyB,EAAE,CAAC;YAC5D,GAAG,GAAI,IAAI,CAAC,OAAkB,CAAC,kCAAkC,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAC3F,GAAG,CAAC,OAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;QAChC,CAAC;aAA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C,CAAC;YAChD,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QACpC,CAAC;QAED,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACxB,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YAC5C,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QACjC,CAAC;QAED,KAAK,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;CACJ","sourcesContent":["import type { InternalTexture } from \"../../Materials/Textures/internalTexture\";\r\nimport type { TextureSize } from \"../../Materials/Textures/textureCreationOptions\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Constants } from \"../constants\";\r\nimport type { Engine } from \"../engine\";\r\nimport { RenderTargetWrapper } from \"../renderTargetWrapper\";\r\nimport type { ThinEngine } from \"../thinEngine\";\r\n\r\n/** @internal */\r\nexport class WebGLRenderTargetWrapper extends RenderTargetWrapper {\r\n private _context: WebGLRenderingContext;\r\n\r\n /**\r\n * @internal\r\n */\r\n public _framebuffer: Nullable<WebGLFramebuffer> = null;\r\n /**\r\n * @internal\r\n */\r\n public _depthStencilBuffer: Nullable<WebGLRenderbuffer> = null;\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n /**\r\n * @internal\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public _MSAAFramebuffer: Nullable<WebGLFramebuffer> = null;\r\n\r\n // Multiview\r\n /**\r\n * @internal\r\n */\r\n public _colorTextureArray: Nullable<WebGLTexture> = null;\r\n /**\r\n * @internal\r\n */\r\n public _depthStencilTextureArray: Nullable<WebGLTexture> = null;\r\n /**\r\n * @internal\r\n */\r\n public _disposeOnlyFramebuffers = false;\r\n /**\r\n * @internal\r\n */\r\n public _currentLOD = 0;\r\n\r\n constructor(isMulti: boolean, isCube: boolean, size: TextureSize, engine: ThinEngine, context: WebGLRenderingContext) {\r\n super(isMulti, isCube, size, engine);\r\n\r\n this._context = context;\r\n }\r\n\r\n protected override _cloneRenderTargetWrapper(): Nullable<RenderTargetWrapper> {\r\n let rtw: Nullable<RenderTargetWrapper> = null;\r\n\r\n if (this._colorTextureArray && this._depthStencilTextureArray) {\r\n rtw = (this._engine as Engine).createMultiviewRenderTargetTexture(this.width, this.height);\r\n rtw.texture!.isReady = true;\r\n } else {\r\n rtw = super._cloneRenderTargetWrapper();\r\n }\r\n\r\n return rtw;\r\n }\r\n\r\n protected override _swapRenderTargetWrapper(target: WebGLRenderTargetWrapper): void {\r\n super._swapRenderTargetWrapper(target);\r\n\r\n target._framebuffer = this._framebuffer;\r\n target._depthStencilBuffer = this._depthStencilBuffer;\r\n target._MSAAFramebuffer = this._MSAAFramebuffer;\r\n target._colorTextureArray = this._colorTextureArray;\r\n target._depthStencilTextureArray = this._depthStencilTextureArray;\r\n\r\n this._framebuffer = this._depthStencilBuffer = this._MSAAFramebuffer = this._colorTextureArray = this._depthStencilTextureArray = null;\r\n }\r\n\r\n /**\r\n * Creates the depth/stencil texture\r\n * @param comparisonFunction Comparison function to use for the texture\r\n * @param bilinearFiltering true if bilinear filtering should be used when sampling the texture\r\n * @param generateStencil true if the stencil aspect should also be created\r\n * @param samples sample count to use when creating the texture\r\n * @param format format of the depth texture\r\n * @param label defines the label to use for the texture (for debugging purpose only)\r\n * @returns the depth/stencil created texture\r\n */\r\n public override createDepthStencilTexture(\r\n comparisonFunction: number = 0,\r\n bilinearFiltering: boolean = true,\r\n generateStencil: boolean = false,\r\n samples: number = 1,\r\n format: number = Constants.TEXTUREFORMAT_DEPTH32_FLOAT,\r\n label?: string\r\n ): InternalTexture {\r\n if (this._depthStencilBuffer) {\r\n const engine = this._engine as ThinEngine;\r\n // Dispose previous depth/stencil render buffers and clear the corresponding attachment.\r\n // Next time this framebuffer is bound, the new depth/stencil texture will be attached.\r\n const currentFrameBuffer = engine._currentFramebuffer;\r\n const gl = this._context;\r\n\r\n engine._bindUnboundFramebuffer(this._framebuffer);\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, null);\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, null);\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.RENDERBUFFER, null);\r\n engine._bindUnboundFramebuffer(currentFrameBuffer);\r\n gl.deleteRenderbuffer(this._depthStencilBuffer);\r\n\r\n this._depthStencilBuffer = null;\r\n }\r\n\r\n return super.createDepthStencilTexture(comparisonFunction, bilinearFiltering, generateStencil, samples, format, label);\r\n }\r\n\r\n /**\r\n * Shares the depth buffer of this render target with another render target.\r\n * @param renderTarget Destination renderTarget\r\n */\r\n public override shareDepth(renderTarget: WebGLRenderTargetWrapper): void {\r\n super.shareDepth(renderTarget);\r\n\r\n const gl = this._context;\r\n const depthbuffer = this._depthStencilBuffer;\r\n const framebuffer = renderTarget._MSAAFramebuffer || renderTarget._framebuffer;\r\n const engine = this._engine as ThinEngine;\r\n\r\n if (renderTarget._depthStencilBuffer && renderTarget._depthStencilBuffer !== depthbuffer) {\r\n gl.deleteRenderbuffer(renderTarget._depthStencilBuffer);\r\n }\r\n renderTarget._depthStencilBuffer = depthbuffer;\r\n const attachment = renderTarget._generateStencilBuffer ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT;\r\n engine._bindUnboundFramebuffer(framebuffer);\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, depthbuffer);\r\n engine._bindUnboundFramebuffer(null);\r\n }\r\n\r\n /**\r\n * Binds a texture to this render target on a specific attachment\r\n * @param texture The texture to bind to the framebuffer\r\n * @param attachmentIndex Index of the attachment\r\n * @param faceIndexOrLayer The face or layer of the texture to render to in case of cube texture or array texture\r\n * @param lodLevel defines the lod level to bind to the frame buffer\r\n */\r\n private _bindTextureRenderTarget(texture: InternalTexture, attachmentIndex: number = 0, faceIndexOrLayer?: number, lodLevel: number = 0) {\r\n if (!texture._hardwareTexture) {\r\n return;\r\n }\r\n\r\n const framebuffer = this._framebuffer;\r\n const engine = this._engine as ThinEngine;\r\n const currentFB = engine._currentFramebuffer;\r\n engine._bindUnboundFramebuffer(framebuffer);\r\n\r\n if (engine.webGLVersion > 1) {\r\n const gl = this._context as WebGL2RenderingContext;\r\n\r\n const attachment = (<any>gl)[\"COLOR_ATTACHMENT\" + attachmentIndex];\r\n if (texture.is2DArray || texture.is3D) {\r\n faceIndexOrLayer = faceIndexOrLayer ?? this.layerIndices?.[attachmentIndex] ?? 0;\r\n gl.framebufferTextureLayer(gl.FRAMEBUFFER, attachment, texture._hardwareTexture.underlyingResource, lodLevel, faceIndexOrLayer);\r\n } else if (texture.isCube) {\r\n // if face index is not specified, try to query it from faceIndices\r\n // default is face 0\r\n faceIndexOrLayer = faceIndexOrLayer ?? this.faceIndices?.[attachmentIndex] ?? 0;\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndexOrLayer, texture._hardwareTexture.underlyingResource, lodLevel);\r\n } else {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, gl.TEXTURE_2D, texture._hardwareTexture.underlyingResource, lodLevel);\r\n }\r\n } else {\r\n // Default behavior (WebGL)\r\n const gl = this._context;\r\n\r\n const attachment = (<any>gl)[\"COLOR_ATTACHMENT\" + attachmentIndex + \"_WEBGL\"];\r\n const target = faceIndexOrLayer !== undefined ? gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndexOrLayer : gl.TEXTURE_2D;\r\n\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, target, texture._hardwareTexture.underlyingResource, lodLevel);\r\n }\r\n\r\n engine._bindUnboundFramebuffer(currentFB);\r\n }\r\n\r\n /**\r\n * Set a texture in the textures array\r\n * @param texture the texture to set\r\n * @param index the index in the textures array to set\r\n * @param disposePrevious If this function should dispose the previous texture\r\n */\r\n public override setTexture(texture: InternalTexture, index: number = 0, disposePrevious: boolean = true) {\r\n super.setTexture(texture, index, disposePrevious);\r\n this._bindTextureRenderTarget(texture, index);\r\n }\r\n\r\n /**\r\n * Sets the layer and face indices of every render target texture\r\n * @param layers The layer of the texture to be set (make negative to not modify)\r\n * @param faces The face of the texture to be set (make negative to not modify)\r\n */\r\n public override setLayerAndFaceIndices(layers: number[], faces: number[]) {\r\n super.setLayerAndFaceIndices(layers, faces);\r\n\r\n if (!this.textures || !this.layerIndices || !this.faceIndices) {\r\n return;\r\n }\r\n\r\n // the length of this._attachments is the right one as it does not count the depth texture, in case we generated it\r\n const textureCount = this._attachments?.length ?? this.textures.length;\r\n for (let index = 0; index < textureCount; index++) {\r\n const texture = this.textures[index];\r\n if (!texture) {\r\n // The target type was probably -1 at creation time and setTexture has not been called yet for this index\r\n continue;\r\n }\r\n if (texture.is2DArray || texture.is3D) {\r\n this._bindTextureRenderTarget(texture, index, this.layerIndices[index]);\r\n } else if (texture.isCube) {\r\n this._bindTextureRenderTarget(texture, index, this.faceIndices[index]);\r\n } else {\r\n this._bindTextureRenderTarget(texture, index);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Set the face and layer indices of a texture in the textures array\r\n * @param index The index of the texture in the textures array to modify\r\n * @param layer The layer of the texture to be set\r\n * @param face The face of the texture to be set\r\n */\r\n public override setLayerAndFaceIndex(index: number = 0, layer?: number, face?: number): void {\r\n super.setLayerAndFaceIndex(index, layer, face);\r\n\r\n if (!this.textures || !this.layerIndices || !this.faceIndices) {\r\n return;\r\n }\r\n\r\n const texture = this.textures[index];\r\n if (texture.is2DArray || texture.is3D) {\r\n this._bindTextureRenderTarget(this.textures[index], index, this.layerIndices[index]);\r\n } else if (texture.isCube) {\r\n this._bindTextureRenderTarget(this.textures[index], index, this.faceIndices[index]);\r\n }\r\n }\r\n\r\n public override dispose(disposeOnlyFramebuffers = this._disposeOnlyFramebuffers): void {\r\n const gl = this._context;\r\n\r\n if (!disposeOnlyFramebuffers) {\r\n if (this._colorTextureArray) {\r\n this._context.deleteTexture(this._colorTextureArray);\r\n this._colorTextureArray = null;\r\n }\r\n if (this._depthStencilTextureArray) {\r\n this._context.deleteTexture(this._depthStencilTextureArray);\r\n this._depthStencilTextureArray = null;\r\n }\r\n }\r\n\r\n if (this._framebuffer) {\r\n gl.deleteFramebuffer(this._framebuffer);\r\n this._framebuffer = null;\r\n }\r\n\r\n if (this._depthStencilBuffer) {\r\n gl.deleteRenderbuffer(this._depthStencilBuffer);\r\n this._depthStencilBuffer = null;\r\n }\r\n\r\n if (this._MSAAFramebuffer) {\r\n gl.deleteFramebuffer(this._MSAAFramebuffer);\r\n this._MSAAFramebuffer = null;\r\n }\r\n\r\n super.dispose(disposeOnlyFramebuffers);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"webGLRenderTargetWrapper.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/WebGL/webGLRenderTargetWrapper.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAE5E,gBAAgB;AAChB,MAAM,OAAO,wBAAyB,SAAQ,mBAAmB;IAoC7C,sBAAsB,CAAC,OAAkC,EAAE,eAAe,GAAG,IAAI;QAC7F,KAAK,CAAC,sBAAsB,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;QAEvD,IAAI,CAAC,OAAO,EAAE,CAAC;YACX,OAAO;QACX,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,OAAqB,CAAC;QAC1C,MAAM,EAAE,GAAG,IAAI,CAAC,QAAkC,CAAC;QACnD,MAAM,eAAe,GAAG,OAAO,CAAC,gBAAkD,CAAC;QAEnF,IAAI,eAAe,IAAI,OAAO,CAAC,mBAAmB,IAAI,IAAI,CAAC,gBAAgB,E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AAC,QAAQ,CAAC;QAEzB,IAAI,CAAC,uBAAuB,EAAE,CAAC;YAC3B,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;gBAC1B,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;gBACrD,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;YACnC,CAAC;YACD,IAAI,IAAI,CAAC,yBAAyB,EAAE,CAAC;gBACjC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;gBAC5D,IAAI,CAAC,yBAAyB,GAAG,IAAI,CAAC;YAC1C,CAAC;QACL,CAAC;QAED,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACpB,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACxC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QAC7B,CAAC;QAED,IAAI,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC3B,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;YAChD,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QACpC,CAAC;QAED,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACxB,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YAC5C,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QACjC,CAAC;QAED,KAAK,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;CACJ","sourcesContent":["import type { InternalTexture } from \"../../Materials/Textures/internalTexture\";\r\nimport type { TextureSize } from \"../../Materials/Textures/textureCreationOptions\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Constants } from \"../constants\";\r\nimport type { Engine } from \"../engine\";\r\nimport { RenderTargetWrapper } from \"../renderTargetWrapper\";\r\nimport type { ThinEngine } from \"../thinEngine\";\r\nimport type { WebGLHardwareTexture } from \"./webGLHardwareTexture\";\r\nimport { HasStencilAspect } from \"../../Materials/Textures/internalTexture\";\r\n\r\n/** @internal */\r\nexport class WebGLRenderTargetWrapper extends RenderTargetWrapper {\r\n private _context: WebGLRenderingContext;\r\n\r\n /**\r\n * @internal\r\n */\r\n public _framebuffer: Nullable<WebGLFramebuffer> = null;\r\n /**\r\n * @internal\r\n */\r\n public _depthStencilBuffer: Nullable<WebGLRenderbuffer> = null;\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n /**\r\n * @internal\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public _MSAAFramebuffer: Nullable<WebGLFramebuffer> = null;\r\n\r\n // Multiview\r\n /**\r\n * @internal\r\n */\r\n public _colorTextureArray: Nullable<WebGLTexture> = null;\r\n /**\r\n * @internal\r\n */\r\n public _depthStencilTextureArray: Nullable<WebGLTexture> = null;\r\n /**\r\n * @internal\r\n */\r\n public _disposeOnlyFramebuffers = false;\r\n /**\r\n * @internal\r\n */\r\n public _currentLOD = 0;\r\n\r\n public override setDepthStencilTexture(texture: Nullable<InternalTexture>, disposeExisting = true) {\r\n super.setDepthStencilTexture(texture, disposeExisting);\r\n\r\n if (!texture) {\r\n return;\r\n }\r\n\r\n const engine = this._engine as ThinEngine;\r\n const gl = this._context as WebGL2RenderingContext;\r\n const hardwareTexture = texture._hardwareTexture as Nullable<WebGLHardwareTexture>;\r\n\r\n if (hardwareTexture && texture._autoMSAAManagement && this._MSAAFramebuffer) {\r\n const currentFB = engine._currentFramebuffer;\r\n engine._bindUnboundFramebuffer(this._MSAAFramebuffer);\r\n gl.framebufferRenderbuffer(\r\n gl.FRAMEBUFFER,\r\n HasStencilAspect(texture.format) ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT,\r\n gl.RENDERBUFFER,\r\n hardwareTexture.getMSAARenderBuffer()\r\n );\r\n engine._bindUnboundFramebuffer(currentFB);\r\n }\r\n }\r\n\r\n constructor(isMulti: boolean, isCube: boolean, size: TextureSize, engine: ThinEngine, context: WebGLRenderingContext) {\r\n super(isMulti, isCube, size, engine);\r\n\r\n this._context = context;\r\n }\r\n\r\n protected override _cloneRenderTargetWrapper(): Nullable<RenderTargetWrapper> {\r\n let rtw: Nullable<RenderTargetWrapper> = null;\r\n\r\n if (this._colorTextureArray && this._depthStencilTextureArray) {\r\n rtw = (this._engine as Engine).createMultiviewRenderTargetTexture(this.width, this.height);\r\n rtw.texture!.isReady = true;\r\n } else {\r\n rtw = super._cloneRenderTargetWrapper();\r\n }\r\n\r\n return rtw;\r\n }\r\n\r\n protected override _swapRenderTargetWrapper(target: WebGLRenderTargetWrapper): void {\r\n super._swapRenderTargetWrapper(target);\r\n\r\n target._framebuffer = this._framebuffer;\r\n target._depthStencilBuffer = this._depthStencilBuffer;\r\n target._MSAAFramebuffer = this._MSAAFramebuffer;\r\n target._colorTextureArray = this._colorTextureArray;\r\n target._depthStencilTextureArray = this._depthStencilTextureArray;\r\n\r\n this._framebuffer = this._depthStencilBuffer = this._MSAAFramebuffer = this._colorTextureArray = this._depthStencilTextureArray = null;\r\n }\r\n\r\n /**\r\n * Creates the depth/stencil texture\r\n * @param comparisonFunction Comparison function to use for the texture\r\n * @param bilinearFiltering true if bilinear filtering should be used when sampling the texture\r\n * @param generateStencil true if the stencil aspect should also be created\r\n * @param samples sample count to use when creating the texture\r\n * @param format format of the depth texture\r\n * @param label defines the label to use for the texture (for debugging purpose only)\r\n * @returns the depth/stencil created texture\r\n */\r\n public override createDepthStencilTexture(\r\n comparisonFunction: number = 0,\r\n bilinearFiltering: boolean = true,\r\n generateStencil: boolean = false,\r\n samples: number = 1,\r\n format: number = Constants.TEXTUREFORMAT_DEPTH32_FLOAT,\r\n label?: string\r\n ): InternalTexture {\r\n if (this._depthStencilBuffer) {\r\n const engine = this._engine as ThinEngine;\r\n // Dispose previous depth/stencil render buffers and clear the corresponding attachment.\r\n // Next time this framebuffer is bound, the new depth/stencil texture will be attached.\r\n const currentFrameBuffer = engine._currentFramebuffer;\r\n const gl = this._context;\r\n\r\n engine._bindUnboundFramebuffer(this._framebuffer);\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, null);\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, null);\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.RENDERBUFFER, null);\r\n engine._bindUnboundFramebuffer(currentFrameBuffer);\r\n gl.deleteRenderbuffer(this._depthStencilBuffer);\r\n\r\n this._depthStencilBuffer = null;\r\n }\r\n\r\n return super.createDepthStencilTexture(comparisonFunction, bilinearFiltering, generateStencil, samples, format, label);\r\n }\r\n\r\n /**\r\n * Shares the depth buffer of this render target with another render target.\r\n * @param renderTarget Destination renderTarget\r\n */\r\n public override shareDepth(renderTarget: WebGLRenderTargetWrapper): void {\r\n super.shareDepth(renderTarget);\r\n\r\n const gl = this._context;\r\n const depthbuffer = this._depthStencilBuffer;\r\n const framebuffer = renderTarget._MSAAFramebuffer || renderTarget._framebuffer;\r\n const engine = this._engine as ThinEngine;\r\n\r\n if (renderTarget._depthStencilBuffer && renderTarget._depthStencilBuffer !== depthbuffer) {\r\n gl.deleteRenderbuffer(renderTarget._depthStencilBuffer);\r\n }\r\n renderTarget._depthStencilBuffer = depthbuffer;\r\n const attachment = renderTarget._generateStencilBuffer ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT;\r\n engine._bindUnboundFramebuffer(framebuffer);\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, depthbuffer);\r\n engine._bindUnboundFramebuffer(null);\r\n }\r\n\r\n /**\r\n * Binds a texture to this render target on a specific attachment\r\n * @param texture The texture to bind to the framebuffer\r\n * @param attachmentIndex Index of the attachment\r\n * @param faceIndexOrLayer The face or layer of the texture to render to in case of cube texture or array texture\r\n * @param lodLevel defines the lod level to bind to the frame buffer\r\n */\r\n private _bindTextureRenderTarget(texture: InternalTexture, attachmentIndex: number = 0, faceIndexOrLayer?: number, lodLevel: number = 0) {\r\n const hardwareTexture = texture._hardwareTexture as WebGLHardwareTexture;\r\n if (!hardwareTexture) {\r\n return;\r\n }\r\n\r\n const framebuffer = this._framebuffer;\r\n const engine = this._engine as ThinEngine;\r\n const currentFB = engine._currentFramebuffer;\r\n engine._bindUnboundFramebuffer(framebuffer);\r\n\r\n let attachment: any;\r\n if (engine.webGLVersion > 1) {\r\n const gl = this._context as WebGL2RenderingContext;\r\n\r\n attachment = (<any>gl)[\"COLOR_ATTACHMENT\" + attachmentIndex];\r\n if (texture.is2DArray || texture.is3D) {\r\n faceIndexOrLayer = faceIndexOrLayer ?? this.layerIndices?.[attachmentIndex] ?? 0;\r\n gl.framebufferTextureLayer(gl.FRAMEBUFFER, attachment, hardwareTexture.underlyingResource, lodLevel, faceIndexOrLayer);\r\n } else if (texture.isCube) {\r\n // if face index is not specified, try to query it from faceIndices\r\n // default is face 0\r\n faceIndexOrLayer = faceIndexOrLayer ?? this.faceIndices?.[attachmentIndex] ?? 0;\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndexOrLayer, hardwareTexture.underlyingResource, lodLevel);\r\n } else {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, gl.TEXTURE_2D, hardwareTexture.underlyingResource, lodLevel);\r\n }\r\n } else {\r\n // Default behavior (WebGL)\r\n const gl = this._context;\r\n\r\n attachment = (<any>gl)[\"COLOR_ATTACHMENT\" + attachmentIndex + \"_WEBGL\"];\r\n const target = faceIndexOrLayer !== undefined ? gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndexOrLayer : gl.TEXTURE_2D;\r\n\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, target, hardwareTexture.underlyingResource, lodLevel);\r\n }\r\n\r\n if (texture._autoMSAAManagement && this._MSAAFramebuffer) {\r\n const gl = this._context;\r\n engine._bindUnboundFramebuffer(this._MSAAFramebuffer);\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, hardwareTexture.getMSAARenderBuffer());\r\n }\r\n\r\n engine._bindUnboundFramebuffer(currentFB);\r\n }\r\n\r\n /**\r\n * Set a texture in the textures array\r\n * @param texture the texture to set\r\n * @param index the index in the textures array to set\r\n * @param disposePrevious If this function should dispose the previous texture\r\n */\r\n public override setTexture(texture: InternalTexture, index: number = 0, disposePrevious: boolean = true) {\r\n super.setTexture(texture, index, disposePrevious);\r\n this._bindTextureRenderTarget(texture, index);\r\n }\r\n\r\n /**\r\n * Sets the layer and face indices of every render target texture\r\n * @param layers The layer of the texture to be set (make negative to not modify)\r\n * @param faces The face of the texture to be set (make negative to not modify)\r\n */\r\n public override setLayerAndFaceIndices(layers: number[], faces: number[]) {\r\n super.setLayerAndFaceIndices(layers, faces);\r\n\r\n if (!this.textures || !this.layerIndices || !this.faceIndices) {\r\n return;\r\n }\r\n\r\n // the length of this._attachments is the right one as it does not count the depth texture, in case we generated it\r\n const textureCount = this._attachments?.length ?? this.textures.length;\r\n for (let index = 0; index < textureCount; index++) {\r\n const texture = this.textures[index];\r\n if (!texture) {\r\n // The target type was probably -1 at creation time and setTexture has not been called yet for this index\r\n continue;\r\n }\r\n if (texture.is2DArray || texture.is3D) {\r\n this._bindTextureRenderTarget(texture, index, this.layerIndices[index]);\r\n } else if (texture.isCube) {\r\n this._bindTextureRenderTarget(texture, index, this.faceIndices[index]);\r\n } else {\r\n this._bindTextureRenderTarget(texture, index);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Set the face and layer indices of a texture in the textures array\r\n * @param index The index of the texture in the textures array to modify\r\n * @param layer The layer of the texture to be set\r\n * @param face The face of the texture to be set\r\n */\r\n public override setLayerAndFaceIndex(index: number = 0, layer?: number, face?: number): void {\r\n super.setLayerAndFaceIndex(index, layer, face);\r\n\r\n if (!this.textures || !this.layerIndices || !this.faceIndices) {\r\n return;\r\n }\r\n\r\n const texture = this.textures[index];\r\n if (texture.is2DArray || texture.is3D) {\r\n this._bindTextureRenderTarget(this.textures[index], index, this.layerIndices[index]);\r\n } else if (texture.isCube) {\r\n this._bindTextureRenderTarget(this.textures[index], index, this.faceIndices[index]);\r\n }\r\n }\r\n\r\n public override resolveMSAATextures(): void {\r\n const engine = this._engine as ThinEngine;\r\n const currentFramebuffer = engine._currentFramebuffer;\r\n\r\n engine._bindUnboundFramebuffer(this._MSAAFramebuffer);\r\n\r\n super.resolveMSAATextures();\r\n\r\n engine._bindUnboundFramebuffer(currentFramebuffer);\r\n }\r\n\r\n public override dispose(disposeOnlyFramebuffers = this._disposeOnlyFramebuffers): void {\r\n const gl = this._context;\r\n\r\n if (!disposeOnlyFramebuffers) {\r\n if (this._colorTextureArray) {\r\n this._context.deleteTexture(this._colorTextureArray);\r\n this._colorTextureArray = null;\r\n }\r\n if (this._depthStencilTextureArray) {\r\n this._context.deleteTexture(this._depthStencilTextureArray);\r\n this._depthStencilTextureArray = null;\r\n }\r\n }\r\n\r\n if (this._framebuffer) {\r\n gl.deleteFramebuffer(this._framebuffer);\r\n this._framebuffer = null;\r\n }\r\n\r\n if (this._depthStencilBuffer) {\r\n gl.deleteRenderbuffer(this._depthStencilBuffer);\r\n this._depthStencilBuffer = null;\r\n }\r\n\r\n if (this._MSAAFramebuffer) {\r\n gl.deleteFramebuffer(this._MSAAFramebuffer);\r\n this._MSAAFramebuffer = null;\r\n }\r\n\r\n super.dispose(disposeOnlyFramebuffers);\r\n }\r\n}\r\n"]}
|
|
@@ -30,6 +30,17 @@ declare module "../../abstractEngine" {
|
|
|
30
30
|
* @returns the effective sample count (could be 0 if multisample render targets are not supported)
|
|
31
31
|
*/
|
|
32
32
|
updateMultipleRenderTargetTextureSampleCount(rtWrapper: Nullable<RenderTargetWrapper>, samples: number, initializeBuffers?: boolean): number;
|
|
33
|
+
/**
|
|
34
|
+
* Generates mipmaps for the texture of the (multi) render target
|
|
35
|
+
* @param texture The render target containing the textures to generate the mipmaps for
|
|
36
|
+
*/
|
|
37
|
+
generateMipMapsMultiFramebuffer(texture: RenderTargetWrapper): void;
|
|
38
|
+
/**
|
|
39
|
+
* Resolves the MSAA textures of the (multi) render target into their non-MSAA version.
|
|
40
|
+
* Note that if "texture" is not a MSAA render target, no resolve is performed.
|
|
41
|
+
* @param texture The render target texture containing the MSAA textures to resolve
|
|
42
|
+
*/
|
|
43
|
+
resolveMultiFramebuffer(texture: RenderTargetWrapper): void;
|
|
33
44
|
/**
|
|
34
45
|
* Select a subsets of attachments to draw to.
|
|
35
46
|
* @param attachments gl attachments
|
|
@@ -6,14 +6,9 @@ WebGPUEngine.prototype.unBindMultiColorAttachmentFramebuffer = function (rtWrapp
|
|
|
6
6
|
if (onBeforeUnbind) {
|
|
7
7
|
onBeforeUnbind();
|
|
8
8
|
}
|
|
9
|
-
const attachments = rtWrapper._attachments;
|
|
10
|
-
const count = attachments.length;
|
|
11
9
|
this._endCurrentRenderPass();
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (texture.generateMipMaps && !disableGenerateMipMaps && !texture.isCube && !texture.is3D) {
|
|
15
|
-
this._generateMipmaps(texture);
|
|
16
|
-
}
|
|
10
|
+
if (!disableGenerateMipMaps) {
|
|
11
|
+
this.generateMipMapsMultiFramebuffer(rtWrapper);
|
|
17
12
|
}
|
|
18
13
|
this._currentRenderTarget = null;
|
|
19
14
|
this._mrtAttachments = [];
|
|
@@ -43,6 +38,7 @@ WebGPUEngine.prototype.createMultipleRenderTarget = function (size, options, ini
|
|
|
43
38
|
let layers = [];
|
|
44
39
|
let labels = [];
|
|
45
40
|
let creationFlags = [];
|
|
41
|
+
let dontCreateTextures = false;
|
|
46
42
|
const rtWrapper = this._createHardwareRenderTargetWrapper(true, false, size);
|
|
47
43
|
if (options !== undefined) {
|
|
48
44
|
generateMipMaps = options.generateMipMaps ?? false;
|
|
@@ -62,6 +58,7 @@ WebGPUEngine.prototype.createMultipleRenderTarget = function (size, options, ini
|
|
|
62
58
|
labels = options.labels || labels;
|
|
63
59
|
creationFlags = options.creationFlags || creationFlags;
|
|
64
60
|
samples = options.samples ?? samples;
|
|
61
|
+
dontCreateTextures = options.dontCreateTextures ?? false;
|
|
65
62
|
}
|
|
66
63
|
const width = size.width ?? size;
|
|
67
64
|
const height = size.height ?? size;
|
|
@@ -74,7 +71,7 @@ WebGPUEngine.prototype.createMultipleRenderTarget = function (size, options, ini
|
|
|
74
71
|
rtWrapper._attachments = attachments;
|
|
75
72
|
rtWrapper._defaultAttachments = defaultAttachments;
|
|
76
73
|
let depthStencilTexture = null;
|
|
77
|
-
if (generateDepthBuffer || generateStencilBuffer || generateDepthTexture) {
|
|
74
|
+
if ((generateDepthBuffer || generateStencilBuffer || generateDepthTexture) && !dontCreateTextures) {
|
|
78
75
|
if (!generateDepthTexture) {
|
|
79
76
|
// The caller doesn't want a depth texture, so we are free to use the depth texture format we want.
|
|
80
77
|
// So, we will align with what the WebGL engine does
|
|
@@ -113,7 +110,7 @@ WebGPUEngine.prototype.createMultipleRenderTarget = function (size, options, ini
|
|
|
113
110
|
}
|
|
114
111
|
attachments.push(i + 1);
|
|
115
112
|
defaultAttachments.push(initializeBuffers ? i + 1 : i === 0 ? 1 : 0);
|
|
116
|
-
if (target === -1) {
|
|
113
|
+
if (target === -1 || dontCreateTextures) {
|
|
117
114
|
continue;
|
|
118
115
|
}
|
|
119
116
|
const texture = new InternalTexture(this, 6 /* InternalTextureSource.MultiRenderTarget */);
|
|
@@ -162,11 +159,16 @@ WebGPUEngine.prototype.createMultipleRenderTarget = function (size, options, ini
|
|
|
162
159
|
}
|
|
163
160
|
rtWrapper.setTextures(textures);
|
|
164
161
|
rtWrapper.setLayerAndFaceIndices(layerIndex, faceIndex);
|
|
165
|
-
|
|
162
|
+
if (!dontCreateTextures) {
|
|
163
|
+
this.updateMultipleRenderTargetTextureSampleCount(rtWrapper, samples);
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
rtWrapper._samples = samples;
|
|
167
|
+
}
|
|
166
168
|
return rtWrapper;
|
|
167
169
|
};
|
|
168
170
|
WebGPUEngine.prototype.updateMultipleRenderTargetTextureSampleCount = function (rtWrapper, samples) {
|
|
169
|
-
if (!rtWrapper || !rtWrapper.textures || rtWrapper.textures[0].samples === samples) {
|
|
171
|
+
if (!rtWrapper || !rtWrapper.textures || rtWrapper.textures.length === 0 || rtWrapper.textures[0].samples === samples) {
|
|
170
172
|
return samples;
|
|
171
173
|
}
|
|
172
174
|
const count = rtWrapper.textures.length;
|
|
@@ -196,6 +198,23 @@ WebGPUEngine.prototype.updateMultipleRenderTargetTextureSampleCount = function (
|
|
|
196
198
|
rtWrapper._samples = samples;
|
|
197
199
|
return samples;
|
|
198
200
|
};
|
|
201
|
+
WebGPUEngine.prototype.generateMipMapsMultiFramebuffer = function (texture) {
|
|
202
|
+
const rtWrapper = texture;
|
|
203
|
+
if (!rtWrapper.isMulti) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
const attachments = rtWrapper._attachments;
|
|
207
|
+
const count = attachments.length;
|
|
208
|
+
for (let i = 0; i < count; i++) {
|
|
209
|
+
const texture = rtWrapper.textures[i];
|
|
210
|
+
if (texture.generateMipMaps && !texture.isCube && !texture.is3D) {
|
|
211
|
+
this._generateMipmaps(texture);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
WebGPUEngine.prototype.resolveMultiFramebuffer = function (_texture) {
|
|
216
|
+
throw new Error("resolveMultiFramebuffer is not yet implemented in WebGPU!");
|
|
217
|
+
};
|
|
199
218
|
WebGPUEngine.prototype.bindAttachments = function (attachments) {
|
|
200
219
|
if (attachments.length === 0 || !this._currentRenderTarget) {
|
|
201
220
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.multiRender.js","sourceRoot":"","sources":["../../../../../../d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,EAAE,CAAC;QAC1B,qHAAqH;QACrH,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC7D,CAAC;SAAM,CAAC;QACJ,uLAAuL;IAC3L,CAAC;AACL,CAAC,CAAC;AAEF,YAAY,CAAC,SAAS,CAAC,kBAAkB,GAAG,UAAU,aAAwB;IAC1E,MAAM,MAAM,GAAG,EAAE,CAAC;IAElB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5C,IAAI,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;YACnB,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACvB,CAAC;aAAM,CAAC;YACJ,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACnB,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,YAAY,CAAC,SAAS,CAAC,uBAAuB,GAAG;IAC7C,mKAAmK;AACvK,CAAC,CAAC;AAEF,YAAY,CAAC,SAAS,CAAC,sCAAsC,GAAG;IAC5D,oJAAoJ;AACxJ,CAAC,CAAC","sourcesContent":["import { InternalTexture, InternalTextureSource } from \"../../../Materials/Textures/internalTexture\";\r\nimport type { IMultiRenderTargetOptions } from \"../../../Materials/Textures/multiRenderTarget\";\r\nimport { Logger } from \"../../../Misc/logger\";\r\nimport type { Nullable } from \"../../../types\";\r\nimport { Constants } from \"../../constants\";\r\nimport type { TextureSize } from \"../../../Materials/Textures/textureCreationOptions\";\r\nimport type { RenderTargetWrapper } from \"../../renderTargetWrapper\";\r\nimport { WebGPUEngine } from \"../../webgpuEngine\";\r\nimport type { WebGPURenderTargetWrapper } from \"../webgpuRenderTargetWrapper\";\r\nimport type { WebGPUHardwareTexture } from \"../webgpuHardwareTexture\";\r\ndeclare module \"../../abstractEngine\" {\r\n export interface AbstractEngine {\r\n /**\r\n * Unbind a list of render target textures from the webGL context\r\n * This is used only when drawBuffer extension or webGL2 are active\r\n * @param rtWrapper defines the render target wrapper to unbind\r\n * @param disableGenerateMipMaps defines a boolean indicating that mipmaps must not be generated\r\n * @param onBeforeUnbind defines a function which will be called before the effective unbind\r\n */\r\n unBindMultiColorAttachmentFramebuffer(rtWrapper: RenderTargetWrapper, disableGenerateMipMaps: boolean, onBeforeUnbind?: () => void): void;\r\n\r\n /**\r\n * Create a multi render target texture\r\n * @see https://doc.babylonjs.com/setup/support/webGL2#multiple-render-target\r\n * @param size defines the size of the texture\r\n * @param options defines the creation options\r\n * @param initializeBuffers if set to true, the engine will make an initializing call of drawBuffers\r\n * @returns a new render target wrapper ready to render textures\r\n */\r\n createMultipleRenderTarget(size: TextureSize, options: IMultiRenderTargetOptions, initializeBuffers?: boolean): RenderTargetWrapper;\r\n\r\n /**\r\n * Update the sample count for a given multiple render target texture\r\n * @see https://doc.babylonjs.com/setup/support/webGL2#multisample-render-targets\r\n * @param rtWrapper defines the render target wrapper to update\r\n * @param samples defines the sample count to set\r\n * @param initializeBuffers if set to true, the engine will make an initializing call of drawBuffers\r\n * @returns the effective sample count (could be 0 if multisample render targets are not supported)\r\n */\r\n updateMultipleRenderTargetTextureSampleCount(rtWrapper: Nullable<RenderTargetWrapper>, samples: number, initializeBuffers?: boolean): number;\r\n\r\n /**\r\n * Select a subsets of attachments to draw to.\r\n * @param attachments gl attachments\r\n */\r\n bindAttachments(attachments: number[]): void;\r\n\r\n /**\r\n * Creates a layout object to draw/clear on specific textures in a MRT\r\n * @param textureStatus textureStatus[i] indicates if the i-th is active\r\n * @returns A layout to be fed to the engine, calling `bindAttachments`.\r\n */\r\n buildTextureLayout(textureStatus: boolean[]): number[];\r\n\r\n /**\r\n * Restores the webgl state to only draw on the main color attachment\r\n * when the frame buffer associated is the canvas frame buffer\r\n */\r\n restoreSingleAttachment(): void;\r\n\r\n /**\r\n * Restores the webgl state to only draw on the main color attachment\r\n * when the frame buffer associated is not the canvas frame buffer\r\n */\r\n restoreSingleAttachmentForRenderTarget(): void;\r\n }\r\n}\r\n\r\nWebGPUEngine.prototype.unBindMultiColorAttachmentFramebuffer = function (\r\n rtWrapper: RenderTargetWrapper,\r\n disableGenerateMipMaps: boolean = false,\r\n onBeforeUnbind?: () => void\r\n): void {\r\n if (onBeforeUnbind) {\r\n onBeforeUnbind();\r\n }\r\n\r\n const attachments = rtWrapper._attachments!;\r\n const count = attachments.length;\r\n\r\n this._endCurrentRenderPass();\r\n\r\n for (let i = 0; i < count; i++) {\r\n const texture = rtWrapper.textures![i];\r\n if (texture.generateMipMaps && !disableGenerateMipMaps && !texture.isCube && !texture.is3D) {\r\n this._generateMipmaps(texture);\r\n }\r\n }\r\n\r\n this._currentRenderTarget = null;\r\n\r\n this._mrtAttachments = [];\r\n this._cacheRenderPipeline.setMRT([]);\r\n this._cacheRenderPipeline.setMRTAttachments(this._mrtAttachments);\r\n};\r\n\r\nWebGPUEngine.prototype.createMultipleRenderTarget = function (size: TextureSize, options: IMultiRenderTargetOptions, initializeBuffers?: boolean): RenderTargetWrapper {\r\n let generateMipMaps = false;\r\n let generateDepthBuffer = true;\r\n let generateStencilBuffer = false;\r\n let generateDepthTexture = false;\r\n let depthTextureFormat = Constants.TEXTUREFORMAT_DEPTH16;\r\n let textureCount = 1;\r\n let samples = 1;\r\n\r\n const defaultType = Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n const defaultSamplingMode = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE;\r\n const defaultUseSRGBBuffer = false;\r\n const defaultFormat = Constants.TEXTUREFORMAT_RGBA;\r\n const defaultTarget = Constants.TEXTURE_2D;\r\n\r\n let types: number[] = [];\r\n let samplingModes: number[] = [];\r\n let useSRGBBuffers: boolean[] = [];\r\n let formats: number[] = [];\r\n let targets: number[] = [];\r\n let faceIndex: number[] = [];\r\n let layerIndex: number[] = [];\r\n let layers: number[] = [];\r\n let labels: string[] = [];\r\n let creationFlags: number[] = [];\r\n\r\n const rtWrapper = this._createHardwareRenderTargetWrapper(true, false, size) as WebGPURenderTargetWrapper;\r\n\r\n if (options !== undefined) {\r\n generateMipMaps = options.generateMipMaps ?? false;\r\n generateDepthBuffer = options.generateDepthBuffer ?? true;\r\n generateStencilBuffer = options.generateStencilBuffer ?? false;\r\n generateDepthTexture = options.generateDepthTexture ?? false;\r\n textureCount = options.textureCount ?? 1;\r\n depthTextureFormat = options.depthTextureFormat ?? Constants.TEXTUREFORMAT_DEPTH16;\r\n types = options.types || types;\r\n samplingModes = options.samplingModes || samplingModes;\r\n useSRGBBuffers = options.useSRGBBuffers || useSRGBBuffers;\r\n formats = options.formats || formats;\r\n targets = options.targetTypes || targets;\r\n faceIndex = options.faceIndex || faceIndex;\r\n layerIndex = options.layerIndex || layerIndex;\r\n layers = options.layerCounts || layers;\r\n labels = options.labels || labels;\r\n creationFlags = options.creationFlags || creationFlags;\r\n samples = options.samples ?? samples;\r\n }\r\n\r\n const width = (<{ width: number; height: number }>size).width ?? <number>size;\r\n const height = (<{ width: number; height: number }>size).height ?? <number>size;\r\n\r\n const textures: InternalTexture[] = [];\r\n const attachments: number[] = [];\r\n const defaultAttachments: number[] = [];\r\n\r\n rtWrapper.label = options?.label ?? \"MultiRenderTargetWrapper\";\r\n rtWrapper._generateDepthBuffer = generateDepthBuffer;\r\n rtWrapper._generateStencilBuffer = generateStencilBuffer;\r\n rtWrapper._attachments = attachments;\r\n rtWrapper._defaultAttachments = defaultAttachments;\r\n\r\n let depthStencilTexture: Nullable<InternalTexture> = null;\r\n if (generateDepthBuffer || generateStencilBuffer || generateDepthTexture) {\r\n if (!generateDepthTexture) {\r\n // The caller doesn't want a depth texture, so we are free to use the depth texture format we want.\r\n // So, we will align with what the WebGL engine does\r\n if (generateDepthBuffer && generateStencilBuffer) {\r\n depthTextureFormat = Constants.TEXTUREFORMAT_DEPTH24_STENCIL8;\r\n } else if (generateDepthBuffer) {\r\n depthTextureFormat = Constants.TEXTUREFORMAT_DEPTH32_FLOAT;\r\n } else {\r\n depthTextureFormat = Constants.TEXTUREFORMAT_STENCIL8;\r\n }\r\n }\r\n depthStencilTexture = rtWrapper.createDepthStencilTexture(0, false, generateStencilBuffer, 1, depthTextureFormat, rtWrapper.label + \"-DepthStencil\");\r\n }\r\n\r\n const mipmapsCreationOnly = options !== undefined && typeof options === \"object\" && options.createMipMaps && !generateMipMaps;\r\n\r\n for (let i = 0; i < textureCount; i++) {\r\n let samplingMode = samplingModes[i] || defaultSamplingMode;\r\n let type = types[i] || defaultType;\r\n\r\n const format = formats[i] || defaultFormat;\r\n const useSRGBBuffer = (useSRGBBuffers[i] || defaultUseSRGBBuffer) && this._caps.supportSRGBBuffers;\r\n\r\n const target = targets[i] || defaultTarget;\r\n const layerCount = layers[i] ?? 1;\r\n const creationFlag = creationFlags[i];\r\n\r\n if (type === Constants.TEXTURETYPE_FLOAT && !this._caps.textureFloatLinearFiltering) {\r\n // if floating point linear (FLOAT) then force to NEAREST_SAMPLINGMODE\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n } else if (type === Constants.TEXTURETYPE_HALF_FLOAT && !this._caps.textureHalfFloatLinearFiltering) {\r\n // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n }\r\n\r\n if (type === Constants.TEXTURETYPE_FLOAT && !this._caps.textureFloat) {\r\n type = Constants.TEXTURETYPE_UNSIGNED_INT;\r\n Logger.Warn(\"Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type\");\r\n }\r\n\r\n attachments.push(i + 1);\r\n defaultAttachments.push(initializeBuffers ? i + 1 : i === 0 ? 1 : 0);\r\n\r\n if (target === -1) {\r\n continue;\r\n }\r\n\r\n const texture = new InternalTexture(this, InternalTextureSource.MultiRenderTarget);\r\n textures[i] = texture;\r\n\r\n switch (target) {\r\n case Constants.TEXTURE_CUBE_MAP:\r\n texture.isCube = true;\r\n break;\r\n case Constants.TEXTURE_3D:\r\n texture.is3D = true;\r\n texture.baseDepth = texture.depth = layerCount;\r\n break;\r\n case Constants.TEXTURE_2D_ARRAY:\r\n texture.is2DArray = true;\r\n texture.baseDepth = texture.depth = layerCount;\r\n break;\r\n }\r\n\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.isReady = true;\r\n texture.samples = 1;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n texture.type = type;\r\n texture._cachedWrapU = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n texture._cachedWrapV = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n texture._useSRGBBuffer = useSRGBBuffer;\r\n texture.format = format;\r\n texture.label = labels[i] ?? rtWrapper.label + \"-Texture\" + i;\r\n\r\n this._internalTexturesCache.push(texture);\r\n\r\n if (mipmapsCreationOnly) {\r\n // createGPUTextureForInternalTexture will only create a texture with mipmaps if generateMipMaps is true, as InternalTexture has no createMipMaps property, separate from generateMipMaps.\r\n texture.generateMipMaps = true;\r\n }\r\n\r\n this._textureHelper.createGPUTextureForInternalTexture(texture, undefined, undefined, undefined, creationFlag, true);\r\n\r\n if (mipmapsCreationOnly) {\r\n texture.generateMipMaps = false;\r\n }\r\n }\r\n\r\n if (depthStencilTexture) {\r\n depthStencilTexture.incrementReferences();\r\n textures[textureCount] = depthStencilTexture;\r\n this._internalTexturesCache.push(depthStencilTexture);\r\n }\r\n\r\n rtWrapper.setTextures(textures);\r\n rtWrapper.setLayerAndFaceIndices(layerIndex, faceIndex);\r\n\r\n this.updateMultipleRenderTargetTextureSampleCount(rtWrapper, samples);\r\n\r\n return rtWrapper;\r\n};\r\n\r\nWebGPUEngine.prototype.updateMultipleRenderTargetTextureSampleCount = function (rtWrapper: Nullable<RenderTargetWrapper>, samples: number): number {\r\n if (!rtWrapper || !rtWrapper.textures || rtWrapper.textures[0].samples === samples) {\r\n return samples;\r\n }\r\n\r\n const count = rtWrapper.textures.length;\r\n\r\n if (count === 0) {\r\n return 1;\r\n }\r\n\r\n samples = Math.min(samples, this.getCaps().maxMSAASamples);\r\n\r\n for (let i = 0; i < count; ++i) {\r\n const texture = rtWrapper.textures[i];\r\n const gpuTextureWrapper = texture._hardwareTexture as Nullable<WebGPUHardwareTexture>;\r\n\r\n gpuTextureWrapper?.releaseMSAATexture(rtWrapper.getBaseArrayLayer(i));\r\n }\r\n\r\n // Note that rtWrapper.textures can't have null textures, lastTextureIsDepthTexture can't be true if rtWrapper._depthStencilTexture is null\r\n const lastTextureIsDepthTexture = rtWrapper._depthStencilTexture === rtWrapper.textures[count - 1];\r\n\r\n for (let i = 0; i < count; ++i) {\r\n const texture = rtWrapper.textures[i];\r\n this._textureHelper.createMSAATexture(texture, samples, false, rtWrapper.getBaseArrayLayer(i));\r\n texture.samples = samples;\r\n }\r\n\r\n // Note that the last texture of textures is the depth texture if the depth texture has been generated by the MRT class and so the MSAA texture\r\n // will be recreated for this texture by the loop above: in that case, there's no need to create the MSAA texture for rtWrapper._depthStencilTexture\r\n // because rtWrapper._depthStencilTexture is the same texture than the depth texture\r\n if (rtWrapper._depthStencilTexture && !lastTextureIsDepthTexture) {\r\n this._textureHelper.createMSAATexture(rtWrapper._depthStencilTexture, samples);\r\n rtWrapper._depthStencilTexture.samples = samples;\r\n }\r\n\r\n rtWrapper._samples = samples;\r\n\r\n return samples;\r\n};\r\n\r\nWebGPUEngine.prototype.bindAttachments = function (attachments: number[]): void {\r\n if (attachments.length === 0 || !this._currentRenderTarget) {\r\n return;\r\n }\r\n\r\n this._mrtAttachments = attachments;\r\n if (this._currentRenderPass) {\r\n // the render pass has already been created, we need to call setMRTAttachments to update the state of the attachments\r\n this._cacheRenderPipeline.setMRTAttachments(attachments);\r\n } else {\r\n // the render pass is not created yet so we don't need to call setMRTAttachments: it will be called as part of the render pass creation (see WebGPUEngine._startRenderTargetRenderPass)\r\n }\r\n};\r\n\r\nWebGPUEngine.prototype.buildTextureLayout = function (textureStatus: boolean[]): number[] {\r\n const result = [];\r\n\r\n for (let i = 0; i < textureStatus.length; i++) {\r\n if (textureStatus[i]) {\r\n result.push(i + 1);\r\n } else {\r\n result.push(0);\r\n }\r\n }\r\n\r\n return result;\r\n};\r\n\r\nWebGPUEngine.prototype.restoreSingleAttachment = function (): void {\r\n // not sure what to do, probably nothing... This function and restoreSingleAttachmentForRenderTarget are not called in Babylon.js so it's hard to know the use case\r\n};\r\n\r\nWebGPUEngine.prototype.restoreSingleAttachmentForRenderTarget = function (): void {\r\n // not sure what to do, probably nothing... This function and restoreSingleAttachment are not called in Babylon.js so it's hard to know the use case\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"engine.multiRender.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Engines/WebGPU/Extensions/engine.multiRender.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAyB,MAAM,6CAA6C,CAAC;AAErG,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AA0ElD,YAAY,CAAC,SAAS,CAAC,qCAAqC,GAAG,UAC3D,SAA8B,EAC9B,yBAAkC,KAAK,EACvC,cAA2B;IAE3B,IAAI,cAAc,EAAE,CAAC;QACjB,cAAc,EAAE,CAAC;IACrB,CAAC;IAED,IAAI,CAAC,qBAAqB,EAAE,CAAC;IAE7B,IAAI,CAAC,sBAAsB,EAAE,CAAC;QAC1B,IAAI,CAAC,+BAA+B,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;IAED,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAEjC,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;IAC1B,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACrC,IAAI,CAAC,oBAAoB,CAAC,iBAAi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oBAAoB,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC7D,CAAC;SAAM,CAAC;QACJ,uLAAuL;IAC3L,CAAC;AACL,CAAC,CAAC;AAEF,YAAY,CAAC,SAAS,CAAC,kBAAkB,GAAG,UAAU,aAAwB;IAC1E,MAAM,MAAM,GAAG,EAAE,CAAC;IAElB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5C,IAAI,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;YACnB,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACvB,CAAC;aAAM,CAAC;YACJ,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACnB,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,YAAY,CAAC,SAAS,CAAC,uBAAuB,GAAG;IAC7C,mKAAmK;AACvK,CAAC,CAAC;AAEF,YAAY,CAAC,SAAS,CAAC,sCAAsC,GAAG;IAC5D,oJAAoJ;AACxJ,CAAC,CAAC","sourcesContent":["import { InternalTexture, InternalTextureSource } from \"../../../Materials/Textures/internalTexture\";\r\nimport type { IMultiRenderTargetOptions } from \"../../../Materials/Textures/multiRenderTarget\";\r\nimport { Logger } from \"../../../Misc/logger\";\r\nimport type { Nullable } from \"../../../types\";\r\nimport { Constants } from \"../../constants\";\r\nimport type { TextureSize } from \"../../../Materials/Textures/textureCreationOptions\";\r\nimport type { RenderTargetWrapper } from \"../../renderTargetWrapper\";\r\nimport { WebGPUEngine } from \"../../webgpuEngine\";\r\nimport type { WebGPURenderTargetWrapper } from \"../webgpuRenderTargetWrapper\";\r\nimport type { WebGPUHardwareTexture } from \"../webgpuHardwareTexture\";\r\ndeclare module \"../../abstractEngine\" {\r\n export interface AbstractEngine {\r\n /**\r\n * Unbind a list of render target textures from the webGL context\r\n * This is used only when drawBuffer extension or webGL2 are active\r\n * @param rtWrapper defines the render target wrapper to unbind\r\n * @param disableGenerateMipMaps defines a boolean indicating that mipmaps must not be generated\r\n * @param onBeforeUnbind defines a function which will be called before the effective unbind\r\n */\r\n unBindMultiColorAttachmentFramebuffer(rtWrapper: RenderTargetWrapper, disableGenerateMipMaps: boolean, onBeforeUnbind?: () => void): void;\r\n\r\n /**\r\n * Create a multi render target texture\r\n * @see https://doc.babylonjs.com/setup/support/webGL2#multiple-render-target\r\n * @param size defines the size of the texture\r\n * @param options defines the creation options\r\n * @param initializeBuffers if set to true, the engine will make an initializing call of drawBuffers\r\n * @returns a new render target wrapper ready to render textures\r\n */\r\n createMultipleRenderTarget(size: TextureSize, options: IMultiRenderTargetOptions, initializeBuffers?: boolean): RenderTargetWrapper;\r\n\r\n /**\r\n * Update the sample count for a given multiple render target texture\r\n * @see https://doc.babylonjs.com/setup/support/webGL2#multisample-render-targets\r\n * @param rtWrapper defines the render target wrapper to update\r\n * @param samples defines the sample count to set\r\n * @param initializeBuffers if set to true, the engine will make an initializing call of drawBuffers\r\n * @returns the effective sample count (could be 0 if multisample render targets are not supported)\r\n */\r\n updateMultipleRenderTargetTextureSampleCount(rtWrapper: Nullable<RenderTargetWrapper>, samples: number, initializeBuffers?: boolean): number;\r\n\r\n /**\r\n * Generates mipmaps for the texture of the (multi) render target\r\n * @param texture The render target containing the textures to generate the mipmaps for\r\n */\r\n generateMipMapsMultiFramebuffer(texture: RenderTargetWrapper): void;\r\n\r\n /**\r\n * Resolves the MSAA textures of the (multi) render target into their non-MSAA version.\r\n * Note that if \"texture\" is not a MSAA render target, no resolve is performed.\r\n * @param texture The render target texture containing the MSAA textures to resolve\r\n */\r\n resolveMultiFramebuffer(texture: RenderTargetWrapper): void;\r\n\r\n /**\r\n * Select a subsets of attachments to draw to.\r\n * @param attachments gl attachments\r\n */\r\n bindAttachments(attachments: number[]): void;\r\n\r\n /**\r\n * Creates a layout object to draw/clear on specific textures in a MRT\r\n * @param textureStatus textureStatus[i] indicates if the i-th is active\r\n * @returns A layout to be fed to the engine, calling `bindAttachments`.\r\n */\r\n buildTextureLayout(textureStatus: boolean[]): number[];\r\n\r\n /**\r\n * Restores the webgl state to only draw on the main color attachment\r\n * when the frame buffer associated is the canvas frame buffer\r\n */\r\n restoreSingleAttachment(): void;\r\n\r\n /**\r\n * Restores the webgl state to only draw on the main color attachment\r\n * when the frame buffer associated is not the canvas frame buffer\r\n */\r\n restoreSingleAttachmentForRenderTarget(): void;\r\n }\r\n}\r\n\r\nWebGPUEngine.prototype.unBindMultiColorAttachmentFramebuffer = function (\r\n rtWrapper: RenderTargetWrapper,\r\n disableGenerateMipMaps: boolean = false,\r\n onBeforeUnbind?: () => void\r\n): void {\r\n if (onBeforeUnbind) {\r\n onBeforeUnbind();\r\n }\r\n\r\n this._endCurrentRenderPass();\r\n\r\n if (!disableGenerateMipMaps) {\r\n this.generateMipMapsMultiFramebuffer(rtWrapper);\r\n }\r\n\r\n this._currentRenderTarget = null;\r\n\r\n this._mrtAttachments = [];\r\n this._cacheRenderPipeline.setMRT([]);\r\n this._cacheRenderPipeline.setMRTAttachments(this._mrtAttachments);\r\n};\r\n\r\nWebGPUEngine.prototype.createMultipleRenderTarget = function (size: TextureSize, options: IMultiRenderTargetOptions, initializeBuffers?: boolean): RenderTargetWrapper {\r\n let generateMipMaps = false;\r\n let generateDepthBuffer = true;\r\n let generateStencilBuffer = false;\r\n let generateDepthTexture = false;\r\n let depthTextureFormat = Constants.TEXTUREFORMAT_DEPTH16;\r\n let textureCount = 1;\r\n let samples = 1;\r\n\r\n const defaultType = Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n const defaultSamplingMode = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE;\r\n const defaultUseSRGBBuffer = false;\r\n const defaultFormat = Constants.TEXTUREFORMAT_RGBA;\r\n const defaultTarget = Constants.TEXTURE_2D;\r\n\r\n let types: number[] = [];\r\n let samplingModes: number[] = [];\r\n let useSRGBBuffers: boolean[] = [];\r\n let formats: number[] = [];\r\n let targets: number[] = [];\r\n let faceIndex: number[] = [];\r\n let layerIndex: number[] = [];\r\n let layers: number[] = [];\r\n let labels: string[] = [];\r\n let creationFlags: number[] = [];\r\n let dontCreateTextures = false;\r\n\r\n const rtWrapper = this._createHardwareRenderTargetWrapper(true, false, size) as WebGPURenderTargetWrapper;\r\n\r\n if (options !== undefined) {\r\n generateMipMaps = options.generateMipMaps ?? false;\r\n generateDepthBuffer = options.generateDepthBuffer ?? true;\r\n generateStencilBuffer = options.generateStencilBuffer ?? false;\r\n generateDepthTexture = options.generateDepthTexture ?? false;\r\n textureCount = options.textureCount ?? 1;\r\n depthTextureFormat = options.depthTextureFormat ?? Constants.TEXTUREFORMAT_DEPTH16;\r\n types = options.types || types;\r\n samplingModes = options.samplingModes || samplingModes;\r\n useSRGBBuffers = options.useSRGBBuffers || useSRGBBuffers;\r\n formats = options.formats || formats;\r\n targets = options.targetTypes || targets;\r\n faceIndex = options.faceIndex || faceIndex;\r\n layerIndex = options.layerIndex || layerIndex;\r\n layers = options.layerCounts || layers;\r\n labels = options.labels || labels;\r\n creationFlags = options.creationFlags || creationFlags;\r\n samples = options.samples ?? samples;\r\n dontCreateTextures = options.dontCreateTextures ?? false;\r\n }\r\n\r\n const width = (<{ width: number; height: number }>size).width ?? <number>size;\r\n const height = (<{ width: number; height: number }>size).height ?? <number>size;\r\n\r\n const textures: InternalTexture[] = [];\r\n const attachments: number[] = [];\r\n const defaultAttachments: number[] = [];\r\n\r\n rtWrapper.label = options?.label ?? \"MultiRenderTargetWrapper\";\r\n rtWrapper._generateDepthBuffer = generateDepthBuffer;\r\n rtWrapper._generateStencilBuffer = generateStencilBuffer;\r\n rtWrapper._attachments = attachments;\r\n rtWrapper._defaultAttachments = defaultAttachments;\r\n\r\n let depthStencilTexture: Nullable<InternalTexture> = null;\r\n if ((generateDepthBuffer || generateStencilBuffer || generateDepthTexture) && !dontCreateTextures) {\r\n if (!generateDepthTexture) {\r\n // The caller doesn't want a depth texture, so we are free to use the depth texture format we want.\r\n // So, we will align with what the WebGL engine does\r\n if (generateDepthBuffer && generateStencilBuffer) {\r\n depthTextureFormat = Constants.TEXTUREFORMAT_DEPTH24_STENCIL8;\r\n } else if (generateDepthBuffer) {\r\n depthTextureFormat = Constants.TEXTUREFORMAT_DEPTH32_FLOAT;\r\n } else {\r\n depthTextureFormat = Constants.TEXTUREFORMAT_STENCIL8;\r\n }\r\n }\r\n depthStencilTexture = rtWrapper.createDepthStencilTexture(0, false, generateStencilBuffer, 1, depthTextureFormat, rtWrapper.label + \"-DepthStencil\");\r\n }\r\n\r\n const mipmapsCreationOnly = options !== undefined && typeof options === \"object\" && options.createMipMaps && !generateMipMaps;\r\n\r\n for (let i = 0; i < textureCount; i++) {\r\n let samplingMode = samplingModes[i] || defaultSamplingMode;\r\n let type = types[i] || defaultType;\r\n\r\n const format = formats[i] || defaultFormat;\r\n const useSRGBBuffer = (useSRGBBuffers[i] || defaultUseSRGBBuffer) && this._caps.supportSRGBBuffers;\r\n\r\n const target = targets[i] || defaultTarget;\r\n const layerCount = layers[i] ?? 1;\r\n const creationFlag = creationFlags[i];\r\n\r\n if (type === Constants.TEXTURETYPE_FLOAT && !this._caps.textureFloatLinearFiltering) {\r\n // if floating point linear (FLOAT) then force to NEAREST_SAMPLINGMODE\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n } else if (type === Constants.TEXTURETYPE_HALF_FLOAT && !this._caps.textureHalfFloatLinearFiltering) {\r\n // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n }\r\n\r\n if (type === Constants.TEXTURETYPE_FLOAT && !this._caps.textureFloat) {\r\n type = Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n Logger.Warn(\"Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type\");\r\n }\r\n\r\n attachments.push(i + 1);\r\n defaultAttachments.push(initializeBuffers ? i + 1 : i === 0 ? 1 : 0);\r\n\r\n if (target === -1 || dontCreateTextures) {\r\n continue;\r\n }\r\n\r\n const texture = new InternalTexture(this, InternalTextureSource.MultiRenderTarget);\r\n textures[i] = texture;\r\n\r\n switch (target) {\r\n case Constants.TEXTURE_CUBE_MAP:\r\n texture.isCube = true;\r\n break;\r\n case Constants.TEXTURE_3D:\r\n texture.is3D = true;\r\n texture.baseDepth = texture.depth = layerCount;\r\n break;\r\n case Constants.TEXTURE_2D_ARRAY:\r\n texture.is2DArray = true;\r\n texture.baseDepth = texture.depth = layerCount;\r\n break;\r\n }\r\n\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.isReady = true;\r\n texture.samples = 1;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n texture.type = type;\r\n texture._cachedWrapU = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n texture._cachedWrapV = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n texture._useSRGBBuffer = useSRGBBuffer;\r\n texture.format = format;\r\n texture.label = labels[i] ?? rtWrapper.label + \"-Texture\" + i;\r\n\r\n this._internalTexturesCache.push(texture);\r\n\r\n if (mipmapsCreationOnly) {\r\n // createGPUTextureForInternalTexture will only create a texture with mipmaps if generateMipMaps is true, as InternalTexture has no createMipMaps property, separate from generateMipMaps.\r\n texture.generateMipMaps = true;\r\n }\r\n\r\n this._textureHelper.createGPUTextureForInternalTexture(texture, undefined, undefined, undefined, creationFlag, true);\r\n\r\n if (mipmapsCreationOnly) {\r\n texture.generateMipMaps = false;\r\n }\r\n }\r\n\r\n if (depthStencilTexture) {\r\n depthStencilTexture.incrementReferences();\r\n textures[textureCount] = depthStencilTexture;\r\n this._internalTexturesCache.push(depthStencilTexture);\r\n }\r\n\r\n rtWrapper.setTextures(textures);\r\n rtWrapper.setLayerAndFaceIndices(layerIndex, faceIndex);\r\n\r\n if (!dontCreateTextures) {\r\n this.updateMultipleRenderTargetTextureSampleCount(rtWrapper, samples);\r\n } else {\r\n rtWrapper._samples = samples;\r\n }\r\n\r\n return rtWrapper;\r\n};\r\n\r\nWebGPUEngine.prototype.updateMultipleRenderTargetTextureSampleCount = function (rtWrapper: Nullable<RenderTargetWrapper>, samples: number): number {\r\n if (!rtWrapper || !rtWrapper.textures || rtWrapper.textures.length === 0 || rtWrapper.textures[0].samples === samples) {\r\n return samples;\r\n }\r\n\r\n const count = rtWrapper.textures.length;\r\n\r\n if (count === 0) {\r\n return 1;\r\n }\r\n\r\n samples = Math.min(samples, this.getCaps().maxMSAASamples);\r\n\r\n for (let i = 0; i < count; ++i) {\r\n const texture = rtWrapper.textures[i];\r\n const gpuTextureWrapper = texture._hardwareTexture as Nullable<WebGPUHardwareTexture>;\r\n\r\n gpuTextureWrapper?.releaseMSAATexture(rtWrapper.getBaseArrayLayer(i));\r\n }\r\n\r\n // Note that rtWrapper.textures can't have null textures, lastTextureIsDepthTexture can't be true if rtWrapper._depthStencilTexture is null\r\n const lastTextureIsDepthTexture = rtWrapper._depthStencilTexture === rtWrapper.textures[count - 1];\r\n\r\n for (let i = 0; i < count; ++i) {\r\n const texture = rtWrapper.textures[i];\r\n this._textureHelper.createMSAATexture(texture, samples, false, rtWrapper.getBaseArrayLayer(i));\r\n texture.samples = samples;\r\n }\r\n\r\n // Note that the last texture of textures is the depth texture if the depth texture has been generated by the MRT class and so the MSAA texture\r\n // will be recreated for this texture by the loop above: in that case, there's no need to create the MSAA texture for rtWrapper._depthStencilTexture\r\n // because rtWrapper._depthStencilTexture is the same texture than the depth texture\r\n if (rtWrapper._depthStencilTexture && !lastTextureIsDepthTexture) {\r\n this._textureHelper.createMSAATexture(rtWrapper._depthStencilTexture, samples);\r\n rtWrapper._depthStencilTexture.samples = samples;\r\n }\r\n\r\n rtWrapper._samples = samples;\r\n\r\n return samples;\r\n};\r\n\r\nWebGPUEngine.prototype.generateMipMapsMultiFramebuffer = function (texture: RenderTargetWrapper): void {\r\n const rtWrapper = texture as WebGPURenderTargetWrapper;\r\n\r\n if (!rtWrapper.isMulti) {\r\n return;\r\n }\r\n\r\n const attachments = rtWrapper._attachments!;\r\n const count = attachments.length;\r\n\r\n for (let i = 0; i < count; i++) {\r\n const texture = rtWrapper.textures![i];\r\n if (texture.generateMipMaps && !texture.isCube && !texture.is3D) {\r\n this._generateMipmaps(texture);\r\n }\r\n }\r\n};\r\n\r\nWebGPUEngine.prototype.resolveMultiFramebuffer = function (_texture: RenderTargetWrapper): void {\r\n throw new Error(\"resolveMultiFramebuffer is not yet implemented in WebGPU!\");\r\n};\r\n\r\nWebGPUEngine.prototype.bindAttachments = function (attachments: number[]): void {\r\n if (attachments.length === 0 || !this._currentRenderTarget) {\r\n return;\r\n }\r\n\r\n this._mrtAttachments = attachments;\r\n if (this._currentRenderPass) {\r\n // the render pass has already been created, we need to call setMRTAttachments to update the state of the attachments\r\n this._cacheRenderPipeline.setMRTAttachments(attachments);\r\n } else {\r\n // the render pass is not created yet so we don't need to call setMRTAttachments: it will be called as part of the render pass creation (see WebGPUEngine._startRenderTargetRenderPass)\r\n }\r\n};\r\n\r\nWebGPUEngine.prototype.buildTextureLayout = function (textureStatus: boolean[]): number[] {\r\n const result = [];\r\n\r\n for (let i = 0; i < textureStatus.length; i++) {\r\n if (textureStatus[i]) {\r\n result.push(i + 1);\r\n } else {\r\n result.push(0);\r\n }\r\n }\r\n\r\n return result;\r\n};\r\n\r\nWebGPUEngine.prototype.restoreSingleAttachment = function (): void {\r\n // not sure what to do, probably nothing... This function and restoreSingleAttachmentForRenderTarget are not called in Babylon.js so it's hard to know the use case\r\n};\r\n\r\nWebGPUEngine.prototype.restoreSingleAttachmentForRenderTarget = function (): void {\r\n // not sure what to do, probably nothing... This function and restoreSingleAttachment are not called in Babylon.js so it's hard to know the use case\r\n};\r\n"]}
|
|
@@ -18,7 +18,7 @@ declare module "../../abstractEngine" {
|
|
|
18
18
|
* @param format defines the format of the data
|
|
19
19
|
* @param invertY defines if data must be stored with Y axis inverted
|
|
20
20
|
* @param compression defines the compression used (null by default)
|
|
21
|
-
* @param type defines the type fo the data (Engine.
|
|
21
|
+
* @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_BYTE by default)
|
|
22
22
|
* @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).
|
|
23
23
|
*/
|
|
24
24
|
updateRawTexture(texture: Nullable<InternalTexture>, data: Nullable<ArrayBufferView>, format: number, invertY: boolean, compression: Nullable<string>, type: number, useSRGBBuffer: boolean): void;
|
|
@@ -27,7 +27,7 @@ declare module "../../abstractEngine" {
|
|
|
27
27
|
* @param data defines the array of data to use to create each face
|
|
28
28
|
* @param size defines the size of the textures
|
|
29
29
|
* @param format defines the format of the data
|
|
30
|
-
* @param type defines the type of the data (like Engine.
|
|
30
|
+
* @param type defines the type of the data (like Engine.TEXTURETYPE_UNSIGNED_BYTE)
|
|
31
31
|
* @param generateMipMaps defines if the engine should generate the mip levels
|
|
32
32
|
* @param invertY defines if data must be stored with Y axis inverted
|
|
33
33
|
* @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)
|
|
@@ -40,7 +40,7 @@ declare module "../../abstractEngine" {
|
|
|
40
40
|
* @param texture defines the texture to update
|
|
41
41
|
* @param data defines the data to store
|
|
42
42
|
* @param format defines the data format
|
|
43
|
-
* @param type defines the type fo the data (Engine.
|
|
43
|
+
* @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_BYTE by default)
|
|
44
44
|
* @param invertY defines if data must be stored with Y axis inverted
|
|
45
45
|
*/
|
|
46
46
|
updateRawCubeTexture(texture: InternalTexture, data: ArrayBufferView[], format: number, type: number, invertY: boolean): void;
|
|
@@ -49,7 +49,7 @@ declare module "../../abstractEngine" {
|
|
|
49
49
|
* @param texture defines the texture to update
|
|
50
50
|
* @param data defines the data to store
|
|
51
51
|
* @param format defines the data format
|
|
52
|
-
* @param type defines the type fo the data (Engine.
|
|
52
|
+
* @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_BYTE by default)
|
|
53
53
|
* @param invertY defines if data must be stored with Y axis inverted
|
|
54
54
|
* @param compression defines the compression used (null by default)
|
|
55
55
|
*/
|
|
@@ -59,7 +59,7 @@ declare module "../../abstractEngine" {
|
|
|
59
59
|
* @param texture defines the texture to update
|
|
60
60
|
* @param data defines the data to store
|
|
61
61
|
* @param format defines the data format
|
|
62
|
-
* @param type defines the type fo the data (Engine.
|
|
62
|
+
* @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_BYTE by default)
|
|
63
63
|
* @param invertY defines if data must be stored with Y axis inverted
|
|
64
64
|
* @param compression defines the compression used (null by default)
|
|
65
65
|
* @param level defines which level of the texture to update
|
|
@@ -71,7 +71,7 @@ declare module "../../abstractEngine" {
|
|
|
71
71
|
* @param scene defines the current scene
|
|
72
72
|
* @param size defines the size of the textures
|
|
73
73
|
* @param format defines the format of the data
|
|
74
|
-
* @param type defines the type fo the data (like Engine.
|
|
74
|
+
* @param type defines the type fo the data (like Engine.TEXTURETYPE_UNSIGNED_BYTE)
|
|
75
75
|
* @param noMipmap defines if the engine should avoid generating the mip levels
|
|
76
76
|
* @param callback defines a callback used to extract texture data from loaded data
|
|
77
77
|
* @param mipmapGenerator defines to provide an optional tool to generate mip levels
|
|
@@ -86,7 +86,7 @@ declare module "../../abstractEngine" {
|
|
|
86
86
|
* @param scene defines the current scene
|
|
87
87
|
* @param size defines the size of the textures
|
|
88
88
|
* @param format defines the format of the data
|
|
89
|
-
* @param type defines the type fo the data (like Engine.
|
|
89
|
+
* @param type defines the type fo the data (like Engine.TEXTURETYPE_UNSIGNED_BYTE)
|
|
90
90
|
* @param noMipmap defines if the engine should avoid generating the mip levels
|
|
91
91
|
* @param callback defines a callback used to extract texture data from loaded data
|
|
92
92
|
* @param mipmapGenerator defines to provide an optional tool to generate mip levels
|
|
@@ -112,7 +112,7 @@ declare module "../../abstractEngine" {
|
|
|
112
112
|
* @param format defines the data format
|
|
113
113
|
* @param invertY defines if data must be stored with Y axis inverted
|
|
114
114
|
* @param compression defines the used compression (can be null)
|
|
115
|
-
* @param textureType defines the texture Type (Engine.
|
|
115
|
+
* @param textureType defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_BYTE, Engine.TEXTURETYPE_FLOAT...)
|
|
116
116
|
*/
|
|
117
117
|
updateRawTexture3D(texture: InternalTexture, data: Nullable<ArrayBufferView>, format: number, invertY: boolean, compression: Nullable<string>, textureType: number): void;
|
|
118
118
|
/**
|
|
@@ -130,7 +130,7 @@ declare module "../../abstractEngine" {
|
|
|
130
130
|
* @param format defines the data format
|
|
131
131
|
* @param invertY defines if data must be stored with Y axis inverted
|
|
132
132
|
* @param compression defines the used compression (can be null)
|
|
133
|
-
* @param textureType defines the texture Type (Engine.
|
|
133
|
+
* @param textureType defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_BYTE, Engine.TEXTURETYPE_FLOAT...)
|
|
134
134
|
*/
|
|
135
135
|
updateRawTexture2DArray(texture: InternalTexture, data: Nullable<ArrayBufferView>, format: number, invertY: boolean, compression: Nullable<string>, textureType: number): void;
|
|
136
136
|
}
|