@babylonjs/core 7.35.1 → 7.36.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/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.prefilteredCubeTexture.js +3 -2
- package/Engines/Extensions/engine.prefilteredCubeTexture.js.map +1 -1
- package/Engines/Extensions/engine.renderTarget.js +1 -13
- package/Engines/Extensions/engine.renderTarget.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.renderTarget.js +2 -5
- package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +3 -2
- package/Engines/WebGPU/webgpuCacheRenderPipeline.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/webgpuTextureManager.js +2 -2
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/abstractEngine.d.ts +11 -0
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.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.js +115 -24
- 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 +39 -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/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +3 -2
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.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/nodeMaterialBlock.js +4 -1
- package/Materials/Node/nodeMaterialBlock.js.map +1 -1
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js +12 -4
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
- package/Materials/Textures/equiRectangularCubeTexture.js +14 -4
- package/Materials/Textures/equiRectangularCubeTexture.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/multiRenderTarget.d.ts +5 -0
- package/Materials/Textures/multiRenderTarget.js.map +1 -1
- package/Materials/Textures/textureCreationOptions.d.ts +6 -6
- package/Materials/Textures/textureCreationOptions.js.map +1 -1
- package/Materials/drawWrapper.js +4 -0
- package/Materials/drawWrapper.js.map +1 -1
- package/Materials/effect.js +2 -2
- package/Materials/effect.js.map +1 -1
- package/Materials/material.d.ts +2 -2
- package/Materials/material.js +5 -5
- package/Materials/material.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/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.js +1 -1
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/lattice.material.d.ts +1 -1
- package/Meshes/lattice.material.js +3 -3
- package/Meshes/lattice.material.js.map +1 -1
- package/Misc/observable.d.ts +3 -1
- package/Misc/observable.js +7 -2
- package/Misc/observable.js.map +1 -1
- package/ShadersWGSL/glowMapGeneration.fragment.js +4 -3
- package/ShadersWGSL/glowMapGeneration.fragment.js.map +1 -1
- package/ShadersWGSL/pbr.fragment.js +4 -3
- package/ShadersWGSL/pbr.fragment.js.map +1 -1
- package/package.json +1 -1
- package/scene.js +6 -6
- package/scene.js.map +1 -1
|
@@ -42,6 +42,8 @@ export declare abstract class ThinWebGPUEngine extends AbstractEngine {
|
|
|
42
42
|
_timestampQuery: WebGPUTimestampQuery;
|
|
43
43
|
/** @internal */
|
|
44
44
|
_timestampIndex: number;
|
|
45
|
+
/** @internal */
|
|
46
|
+
_debugStackRenderPass: string[];
|
|
45
47
|
/**
|
|
46
48
|
* Gets the GPU time spent in the main render pass for the last frame rendered (in nanoseconds).
|
|
47
49
|
* You have to enable the "timestamp-query" extension in the engine constructor options and set engine.enableGPUTimingMeasurements = true.
|
|
@@ -27,6 +27,8 @@ export class ThinWebGPUEngine extends AbstractEngine {
|
|
|
27
27
|
this._snapshotRenderingMode = 0;
|
|
28
28
|
/** @internal */
|
|
29
29
|
this._timestampIndex = 0;
|
|
30
|
+
/** @internal */
|
|
31
|
+
this._debugStackRenderPass = [];
|
|
30
32
|
}
|
|
31
33
|
/**
|
|
32
34
|
* Enables or disables GPU timing measurements.
|
|
@@ -50,6 +52,11 @@ export class ThinWebGPUEngine extends AbstractEngine {
|
|
|
50
52
|
if (!this._currentRenderPass) {
|
|
51
53
|
return 0;
|
|
52
54
|
}
|
|
55
|
+
if (this._debugStackRenderPass.length !== 0) {
|
|
56
|
+
for (let i = 0; i < this._debugStackRenderPass.length; ++i) {
|
|
57
|
+
this._currentRenderPass.popDebugGroup();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
53
60
|
const currentPassIndex = this._currentPassIsMainPass() ? 2 : 1;
|
|
54
61
|
if (!this._snapshotRendering.endRenderPass(this._currentRenderPass) && !this.compatibilityMode) {
|
|
55
62
|
this._bundleList.run(this._currentRenderPass);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thinWebGPUEngine.js","sourceRoot":"","sources":["../../../../dev/core/src/Engines/thinWebGPUEngine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKlD,OAAO,EAAE,MAAM,EAAE,0BAAyB;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAKxC;;GAEG;AACH,MAAM,OAAgB,gBAAiB,SAAQ,cAAc;IAA7D;;QACI,0DAA0D;QAC1D,gBAAgB;QACT,sBAAiB,GAAG,KAAK,CAAC;QACjC,gBAAgB;QACT,oBAAe,GAAG,IAAI,CAAC;QAC9B,gBAAgB;QACT,4BAAuB,GAAG,EAAE,CAAC;QACpC,gBAAgB;QACT,2BAAsB,GAAG,IAAI,CAAC;QACrC,gBAAgB;QACT,kCAA6B,GAAG,IAAI,CAAC;QAC5C,gBAAgB;QACT,iCAA4B,GAAG,KAAK,CAAC;QAe5C,gBAAgB;QACT,uBAAkB,GAAmC,IAAI,CAAC;QAGvD,2BAAsB,GAAG,SAAS,CAAC,0BAA0B,CAAC;QAIxE,gBAAgB;QACT,oBAAe,GAAG,CAAC,CAAC;IA4H/B,CAAC;IA7GG;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AsB,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QAE9F,IAAI,IAAI,CAAC,4BAA4B,EAAE,CAAC;YACpC,IAAK,IAAY,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;gBACpC,IAAY,CAAC,MAAM,GAAG,CAAC,CAAC;YAC7B,CAAC;YACD,IAAI,CAAE,IAAY,CAAC,MAAM,IAAK,IAAY,CAAC,MAAM,GAAG,IAAI,CAAC,uBAAuB,EAAE,CAAC;gBAC/E,MAAM,CAAC,GAAG,CACN,SAAS;oBACJ,IAAY,CAAC,MAAM;oBACpB,8BAA8B;oBAC9B,OAAO,CAAC,KAAK;oBACb,WAAW;oBACX,OAAO,CAAC,MAAM;oBACd,WAAW;oBACX,OAAO,CAAC,MAAM;oBACd,oBAAoB;oBACpB,CAAC,cAAc,KAAK,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CACnE,CAAC;YACN,CAAC;QACL,CAAC;QAED,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACjB,IAAI,CAAC,cAAc,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;QACrG,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,kBAAkB,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,EAAE,OAAO,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;QAClH,CAAC;IACL,CAAC;CACJ","sourcesContent":["import type { InternalTexture } from \"core/Materials/Textures/internalTexture\";\r\nimport { AbstractEngine } from \"./abstractEngine\";\r\nimport type { WebGPUCacheRenderPipeline } from \"./WebGPU/webgpuCacheRenderPipeline\";\r\nimport type { WebGPUTextureManager } from \"./WebGPU/webgpuTextureManager\";\r\nimport type { WebGPUHardwareTexture } from \"./WebGPU/webgpuHardwareTexture\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport { WebGPUTextureHelper } from \"./WebGPU/webgpuTextureHelper\";\r\nimport type { WebGPURenderTargetWrapper } from \"./WebGPU/webgpuRenderTargetWrapper\";\r\nimport { WebGPUPerfCounter } from \"./WebGPU/webgpuPerfCounter\";\r\nimport type { WebGPUSnapshotRendering } from \"./WebGPU/webgpuSnapshotRendering\";\r\nimport { Constants } from \"./constants\";\r\nimport type { WebGPUBundleList } from \"./WebGPU/webgpuBundleList\";\r\nimport type { WebGPUTimestampQuery } from \"./WebGPU/webgpuTimestampQuery\";\r\nimport type { WebGPUOcclusionQuery } from \"./WebGPU/webgpuOcclusionQuery\";\r\n\r\n/**\r\n * The base engine class for WebGPU\r\n */\r\nexport abstract class ThinWebGPUEngine extends AbstractEngine {\r\n // TODO WEBGPU remove those variables when code stabilized\r\n /** @internal */\r\n public dbgShowShaderCode = false;\r\n /** @internal */\r\n public dbgSanityChecks = true;\r\n /** @internal */\r\n public dbgVerboseLogsNumFrames = 10;\r\n /** @internal */\r\n public dbgLogIfNotDrawWrapper = true;\r\n /** @internal */\r\n public dbgShowEmptyEnableEffectCalls = true;\r\n /** @internal */\r\n public dbgVerboseLogsForFirstFrames = false;\r\n\r\n /** @internal */\r\n public _textureHelper: WebGPUTextureManager;\r\n /** @internal */\r\n public _cacheRenderPipeline: WebGPUCacheRenderPipeline;\r\n /** @internal */\r\n public _occlusionQuery: WebGPUOcclusionQuery;\r\n\r\n // Frame Life Cycle (recreated each frame)\r\n /** @internal */\r\n public _renderEncoder: GPUCommandEncoder;\r\n /** @internal */\r\n public _uploadEncoder: GPUCommandEncoder;\r\n\r\n /** @internal */\r\n public _currentRenderPass: Nullable<GPURenderPassEncoder> = null;\r\n\r\n protected _snapshotRendering: WebGPUSnapshotRendering;\r\n protected _snapshotRenderingMode = Constants.SNAPSHOTRENDERING_STANDARD;\r\n\r\n /** @internal */\r\n public _timestampQuery: WebGPUTimestampQuery;\r\n /** @internal */\r\n public _timestampIndex = 0;\r\n\r\n /**\r\n * Gets the GPU time spent in the main render pass for the last frame rendered (in nanoseconds).\r\n * You have to enable the \"timestamp-query\" extension in the engine constructor options and set engine.enableGPUTimingMeasurements = true.\r\n * It will only return time spent in the main pass, not additional render target / compute passes (if any)!\r\n */\r\n public readonly gpuTimeInFrameForMainPass?: WebGPUPerfCounter;\r\n\r\n /**\r\n * Used for both the compatibilityMode=false and the snapshot rendering modes (as both can't be enabled at the same time)\r\n * @internal\r\n */\r\n public _bundleList: WebGPUBundleList;\r\n\r\n /**\r\n * Enables or disables GPU timing measurements.\r\n * Note that this is only supported if the \"timestamp-query\" extension is enabled in the options.\r\n */\r\n public get enableGPUTimingMeasurements(): boolean {\r\n return this._timestampQuery.enable;\r\n }\r\n\r\n public set enableGPUTimingMeasurements(enable: boolean) {\r\n if (this._timestampQuery.enable === enable) {\r\n return;\r\n }\r\n (this.gpuTimeInFrameForMainPass as any) = enable ? new WebGPUPerfCounter() : undefined;\r\n this._timestampQuery.enable = enable;\r\n }\r\n\r\n protected _currentPassIsMainPass() {\r\n return this._currentRenderTarget === null;\r\n }\r\n\r\n /** @internal */\r\n public _endCurrentRenderPass(): number {\r\n if (!this._currentRenderPass) {\r\n return 0;\r\n }\r\n\r\n const currentPassIndex = this._currentPassIsMainPass() ? 2 : 1;\r\n\r\n if (!this._snapshotRendering.endRenderPass(this._currentRenderPass) && !this.compatibilityMode) {\r\n this._bundleList.run(this._currentRenderPass);\r\n this._bundleList.reset();\r\n }\r\n this._currentRenderPass.end();\r\n\r\n this._timestampQuery.endPass(\r\n this._timestampIndex,\r\n (this._currentRenderTarget && (this._currentRenderTarget as WebGPURenderTargetWrapper).gpuTimeInFrame\r\n ? (this._currentRenderTarget as WebGPURenderTargetWrapper).gpuTimeInFrame\r\n : this.gpuTimeInFrameForMainPass) as WebGPUPerfCounter\r\n );\r\n this._timestampIndex += 2;\r\n\r\n if (this.dbgVerboseLogsForFirstFrames) {\r\n if ((this as any)._count === undefined) {\r\n (this as any)._count = 0;\r\n }\r\n if (!(this as any)._count || (this as any)._count < this.dbgVerboseLogsNumFrames) {\r\n Logger.Log(\r\n \"frame #\" +\r\n (this as any)._count +\r\n \" - \" +\r\n (currentPassIndex === 2 ? \"main\" : \"render target\") +\r\n \" end pass\" +\r\n (currentPassIndex === 1 ? \" - internalTexture.uniqueId=\" + this._currentRenderTarget?.texture?.uniqueId : \"\")\r\n );\r\n }\r\n }\r\n this._debugPopGroup?.(0);\r\n this._currentRenderPass = null;\r\n\r\n return currentPassIndex;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _generateMipmaps(texture: InternalTexture, commandEncoder?: GPUCommandEncoder) {\r\n commandEncoder = commandEncoder ?? this._renderEncoder;\r\n\r\n const gpuHardwareTexture = texture._hardwareTexture as Nullable<WebGPUHardwareTexture>;\r\n\r\n if (!gpuHardwareTexture) {\r\n return;\r\n }\r\n\r\n if (commandEncoder === this._renderEncoder) {\r\n // We must close the current pass (if any) because we are going to use the render encoder to generate the mipmaps (so, we are going to create a new render pass)\r\n this._endCurrentRenderPass();\r\n }\r\n\r\n const format = (texture._hardwareTexture as WebGPUHardwareTexture).format;\r\n const mipmapCount = WebGPUTextureHelper.ComputeNumMipmapLevels(texture.width, texture.height);\r\n\r\n if (this.dbgVerboseLogsForFirstFrames) {\r\n if ((this as any)._count === undefined) {\r\n (this as any)._count = 0;\r\n }\r\n if (!(this as any)._count || (this as any)._count < this.dbgVerboseLogsNumFrames) {\r\n Logger.Log(\r\n \"frame #\" +\r\n (this as any)._count +\r\n \" - generate mipmaps - width=\" +\r\n texture.width +\r\n \", height=\" +\r\n texture.height +\r\n \", isCube=\" +\r\n texture.isCube +\r\n \", command encoder=\" +\r\n (commandEncoder === this._renderEncoder ? \"render\" : \"copy\")\r\n );\r\n }\r\n }\r\n\r\n if (texture.isCube) {\r\n this._textureHelper.generateCubeMipmaps(gpuHardwareTexture, format, mipmapCount, commandEncoder);\r\n } else {\r\n this._textureHelper.generateMipmaps(gpuHardwareTexture, format, mipmapCount, 0, texture.is3D, commandEncoder);\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"thinWebGPUEngine.js","sourceRoot":"","sources":["../../../../dev/core/src/Engines/thinWebGPUEngine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKlD,OAAO,EAAE,MAAM,EAAE,0BAAyB;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAKxC;;GAEG;AACH,MAAM,OAAgB,gBAAiB,SAAQ,cAAc;IAA7D;;QACI,0DAA0D;QAC1D,gBAAgB;QACT,sBAAiB,GAAG,KAAK,CAAC;QACjC,gBAAgB;QACT,oBAAe,GAAG,IAAI,CAAC;QAC9B,gBAAgB;QACT,4BAAuB,GAAG,EAAE,CAAC;QACpC,gBAAgB;QACT,2BAAsB,GAAG,IAAI,CAAC;QACrC,gBAAgB;QACT,kCAA6B,GAAG,IAAI,CAAC;QAC5C,gBAAgB;QACT,iCAA4B,GAAG,KAAK,CAAC;QAe5C,gBAAgB;QACT,uBAAkB,GAAmC,IAAI,CAAC;QAGvD,2BAAsB,GAAG,SAAS,CAAC,0BAA0B,CAAC;QAIxE,gBAAgB;QACT,oBAAe,GAAG,CAAC,CAAC;QAE3B,gBAAgB;QACT,0BAAqB,GAAa,EAAE,CAAC;IAkIhD,CAAC;IAnHG;;;OAGG;IACH,IAAW,2BAA2B;QAClC,OAAO,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC;IACvC,CAAC;IAED,IAAW,2BAA2B,CAAC,MAAe;QAClD,IAAI,IAAI,CAAC,eAAe,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;YACzC,OAAO;QACX,CAAC;QACA,IAAI,CAAC,yBAAiC,GAAG,MAAM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BAAmB,CAAC,sBAAsB,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QAE9F,IAAI,IAAI,CAAC,4BAA4B,EAAE,CAAC;YACpC,IAAK,IAAY,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;gBACpC,IAAY,CAAC,MAAM,GAAG,CAAC,CAAC;YAC7B,CAAC;YACD,IAAI,CAAE,IAAY,CAAC,MAAM,IAAK,IAAY,CAAC,MAAM,GAAG,IAAI,CAAC,uBAAuB,EAAE,CAAC;gBAC/E,MAAM,CAAC,GAAG,CACN,SAAS;oBACJ,IAAY,CAAC,MAAM;oBACpB,8BAA8B;oBAC9B,OAAO,CAAC,KAAK;oBACb,WAAW;oBACX,OAAO,CAAC,MAAM;oBACd,WAAW;oBACX,OAAO,CAAC,MAAM;oBACd,oBAAoB;oBACpB,CAAC,cAAc,KAAK,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CACnE,CAAC;YACN,CAAC;QACL,CAAC;QAED,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACjB,IAAI,CAAC,cAAc,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;QACrG,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,kBAAkB,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,EAAE,OAAO,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;QAClH,CAAC;IACL,CAAC;CACJ","sourcesContent":["import type { InternalTexture } from \"core/Materials/Textures/internalTexture\";\r\nimport { AbstractEngine } from \"./abstractEngine\";\r\nimport type { WebGPUCacheRenderPipeline } from \"./WebGPU/webgpuCacheRenderPipeline\";\r\nimport type { WebGPUTextureManager } from \"./WebGPU/webgpuTextureManager\";\r\nimport type { WebGPUHardwareTexture } from \"./WebGPU/webgpuHardwareTexture\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport { WebGPUTextureHelper } from \"./WebGPU/webgpuTextureHelper\";\r\nimport type { WebGPURenderTargetWrapper } from \"./WebGPU/webgpuRenderTargetWrapper\";\r\nimport { WebGPUPerfCounter } from \"./WebGPU/webgpuPerfCounter\";\r\nimport type { WebGPUSnapshotRendering } from \"./WebGPU/webgpuSnapshotRendering\";\r\nimport { Constants } from \"./constants\";\r\nimport type { WebGPUBundleList } from \"./WebGPU/webgpuBundleList\";\r\nimport type { WebGPUTimestampQuery } from \"./WebGPU/webgpuTimestampQuery\";\r\nimport type { WebGPUOcclusionQuery } from \"./WebGPU/webgpuOcclusionQuery\";\r\n\r\n/**\r\n * The base engine class for WebGPU\r\n */\r\nexport abstract class ThinWebGPUEngine extends AbstractEngine {\r\n // TODO WEBGPU remove those variables when code stabilized\r\n /** @internal */\r\n public dbgShowShaderCode = false;\r\n /** @internal */\r\n public dbgSanityChecks = true;\r\n /** @internal */\r\n public dbgVerboseLogsNumFrames = 10;\r\n /** @internal */\r\n public dbgLogIfNotDrawWrapper = true;\r\n /** @internal */\r\n public dbgShowEmptyEnableEffectCalls = true;\r\n /** @internal */\r\n public dbgVerboseLogsForFirstFrames = false;\r\n\r\n /** @internal */\r\n public _textureHelper: WebGPUTextureManager;\r\n /** @internal */\r\n public _cacheRenderPipeline: WebGPUCacheRenderPipeline;\r\n /** @internal */\r\n public _occlusionQuery: WebGPUOcclusionQuery;\r\n\r\n // Frame Life Cycle (recreated each frame)\r\n /** @internal */\r\n public _renderEncoder: GPUCommandEncoder;\r\n /** @internal */\r\n public _uploadEncoder: GPUCommandEncoder;\r\n\r\n /** @internal */\r\n public _currentRenderPass: Nullable<GPURenderPassEncoder> = null;\r\n\r\n protected _snapshotRendering: WebGPUSnapshotRendering;\r\n protected _snapshotRenderingMode = Constants.SNAPSHOTRENDERING_STANDARD;\r\n\r\n /** @internal */\r\n public _timestampQuery: WebGPUTimestampQuery;\r\n /** @internal */\r\n public _timestampIndex = 0;\r\n\r\n /** @internal */\r\n public _debugStackRenderPass: string[] = [];\r\n\r\n /**\r\n * Gets the GPU time spent in the main render pass for the last frame rendered (in nanoseconds).\r\n * You have to enable the \"timestamp-query\" extension in the engine constructor options and set engine.enableGPUTimingMeasurements = true.\r\n * It will only return time spent in the main pass, not additional render target / compute passes (if any)!\r\n */\r\n public readonly gpuTimeInFrameForMainPass?: WebGPUPerfCounter;\r\n\r\n /**\r\n * Used for both the compatibilityMode=false and the snapshot rendering modes (as both can't be enabled at the same time)\r\n * @internal\r\n */\r\n public _bundleList: WebGPUBundleList;\r\n\r\n /**\r\n * Enables or disables GPU timing measurements.\r\n * Note that this is only supported if the \"timestamp-query\" extension is enabled in the options.\r\n */\r\n public get enableGPUTimingMeasurements(): boolean {\r\n return this._timestampQuery.enable;\r\n }\r\n\r\n public set enableGPUTimingMeasurements(enable: boolean) {\r\n if (this._timestampQuery.enable === enable) {\r\n return;\r\n }\r\n (this.gpuTimeInFrameForMainPass as any) = enable ? new WebGPUPerfCounter() : undefined;\r\n this._timestampQuery.enable = enable;\r\n }\r\n\r\n protected _currentPassIsMainPass() {\r\n return this._currentRenderTarget === null;\r\n }\r\n\r\n /** @internal */\r\n public _endCurrentRenderPass(): number {\r\n if (!this._currentRenderPass) {\r\n return 0;\r\n }\r\n\r\n if (this._debugStackRenderPass.length !== 0) {\r\n for (let i = 0; i < this._debugStackRenderPass.length; ++i) {\r\n this._currentRenderPass.popDebugGroup();\r\n }\r\n }\r\n\r\n const currentPassIndex = this._currentPassIsMainPass() ? 2 : 1;\r\n\r\n if (!this._snapshotRendering.endRenderPass(this._currentRenderPass) && !this.compatibilityMode) {\r\n this._bundleList.run(this._currentRenderPass);\r\n this._bundleList.reset();\r\n }\r\n this._currentRenderPass.end();\r\n\r\n this._timestampQuery.endPass(\r\n this._timestampIndex,\r\n (this._currentRenderTarget && (this._currentRenderTarget as WebGPURenderTargetWrapper).gpuTimeInFrame\r\n ? (this._currentRenderTarget as WebGPURenderTargetWrapper).gpuTimeInFrame\r\n : this.gpuTimeInFrameForMainPass) as WebGPUPerfCounter\r\n );\r\n this._timestampIndex += 2;\r\n\r\n if (this.dbgVerboseLogsForFirstFrames) {\r\n if ((this as any)._count === undefined) {\r\n (this as any)._count = 0;\r\n }\r\n if (!(this as any)._count || (this as any)._count < this.dbgVerboseLogsNumFrames) {\r\n Logger.Log(\r\n \"frame #\" +\r\n (this as any)._count +\r\n \" - \" +\r\n (currentPassIndex === 2 ? \"main\" : \"render target\") +\r\n \" end pass\" +\r\n (currentPassIndex === 1 ? \" - internalTexture.uniqueId=\" + this._currentRenderTarget?.texture?.uniqueId : \"\")\r\n );\r\n }\r\n }\r\n this._debugPopGroup?.(0);\r\n this._currentRenderPass = null;\r\n\r\n return currentPassIndex;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _generateMipmaps(texture: InternalTexture, commandEncoder?: GPUCommandEncoder) {\r\n commandEncoder = commandEncoder ?? this._renderEncoder;\r\n\r\n const gpuHardwareTexture = texture._hardwareTexture as Nullable<WebGPUHardwareTexture>;\r\n\r\n if (!gpuHardwareTexture) {\r\n return;\r\n }\r\n\r\n if (commandEncoder === this._renderEncoder) {\r\n // We must close the current pass (if any) because we are going to use the render encoder to generate the mipmaps (so, we are going to create a new render pass)\r\n this._endCurrentRenderPass();\r\n }\r\n\r\n const format = (texture._hardwareTexture as WebGPUHardwareTexture).format;\r\n const mipmapCount = WebGPUTextureHelper.ComputeNumMipmapLevels(texture.width, texture.height);\r\n\r\n if (this.dbgVerboseLogsForFirstFrames) {\r\n if ((this as any)._count === undefined) {\r\n (this as any)._count = 0;\r\n }\r\n if (!(this as any)._count || (this as any)._count < this.dbgVerboseLogsNumFrames) {\r\n Logger.Log(\r\n \"frame #\" +\r\n (this as any)._count +\r\n \" - generate mipmaps - width=\" +\r\n texture.width +\r\n \", height=\" +\r\n texture.height +\r\n \", isCube=\" +\r\n texture.isCube +\r\n \", command encoder=\" +\r\n (commandEncoder === this._renderEncoder ? \"render\" : \"copy\")\r\n );\r\n }\r\n }\r\n\r\n if (texture.isCube) {\r\n this._textureHelper.generateCubeMipmaps(gpuHardwareTexture, format, mipmapCount, commandEncoder);\r\n } else {\r\n this._textureHelper.generateMipmaps(gpuHardwareTexture, format, mipmapCount, 0, texture.is3D, commandEncoder);\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -209,8 +209,6 @@ export declare class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
209
209
|
private _rttRenderPassWrapper;
|
|
210
210
|
/** @internal */
|
|
211
211
|
_pendingDebugCommands: Array<[string, Nullable<string>, number?]>;
|
|
212
|
-
/** @internal */
|
|
213
|
-
_debugStackRenderPass: string[];
|
|
214
212
|
private _defaultDrawContext;
|
|
215
213
|
private _defaultMaterialContext;
|
|
216
214
|
/** @internal */
|
|
@@ -718,7 +716,7 @@ export declare class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
718
716
|
/**
|
|
719
717
|
* @internal
|
|
720
718
|
*/
|
|
721
|
-
_getUseSRGBBuffer(useSRGBBuffer: boolean,
|
|
719
|
+
_getUseSRGBBuffer(useSRGBBuffer: boolean, _noMipmap: boolean): boolean;
|
|
722
720
|
/**
|
|
723
721
|
* @internal
|
|
724
722
|
*/
|
|
@@ -880,6 +878,17 @@ export declare class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
880
878
|
* @param onBeforeUnbind defines a function which will be called before the effective unbind
|
|
881
879
|
*/
|
|
882
880
|
unBindFramebuffer(texture: RenderTargetWrapper, disableGenerateMipMaps?: boolean, onBeforeUnbind?: () => void): void;
|
|
881
|
+
/**
|
|
882
|
+
* Generates mipmaps for the texture of the (single) render target
|
|
883
|
+
* @param texture The render target containing the texture to generate the mipmaps for
|
|
884
|
+
*/
|
|
885
|
+
generateMipMapsFramebuffer(texture: RenderTargetWrapper): void;
|
|
886
|
+
/**
|
|
887
|
+
* Resolves the MSAA texture of the (single) render target into its non-MSAA version.
|
|
888
|
+
* Note that if "texture" is not a MSAA render target, no resolve is performed.
|
|
889
|
+
* @param _texture The render target texture containing the MSAA texture to resolve
|
|
890
|
+
*/
|
|
891
|
+
resolveFramebuffer(_texture: RenderTargetWrapper): void;
|
|
883
892
|
/**
|
|
884
893
|
* Unbind the current render target and bind the default framebuffer
|
|
885
894
|
*/
|
package/Engines/webgpuEngine.js
CHANGED
|
@@ -313,8 +313,6 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
313
313
|
};
|
|
314
314
|
/** @internal */
|
|
315
315
|
this._pendingDebugCommands = [];
|
|
316
|
-
/** @internal */
|
|
317
|
-
this._debugStackRenderPass = [];
|
|
318
316
|
this._currentOverrideVertexBuffers = null;
|
|
319
317
|
this._currentIndexBuffer = null;
|
|
320
318
|
this._colorWriteLocal = true;
|
|
@@ -635,7 +633,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
635
633
|
this._context = this._renderingCanvas.getContext("webgpu");
|
|
636
634
|
this._configureContext();
|
|
637
635
|
this._colorFormat = this._options.swapChainFormat;
|
|
638
|
-
this._mainRenderPassWrapper.colorAttachmentGPUTextures = [new WebGPUHardwareTexture()];
|
|
636
|
+
this._mainRenderPassWrapper.colorAttachmentGPUTextures = [new WebGPUHardwareTexture(this)];
|
|
639
637
|
this._mainRenderPassWrapper.colorAttachmentGPUTextures[0].format = this._colorFormat;
|
|
640
638
|
this._setColorFormat(this._mainRenderPassWrapper);
|
|
641
639
|
}
|
|
@@ -1717,7 +1715,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
1717
1715
|
}
|
|
1718
1716
|
/** @internal */
|
|
1719
1717
|
_createHardwareTexture() {
|
|
1720
|
-
return new WebGPUHardwareTexture();
|
|
1718
|
+
return new WebGPUHardwareTexture(this);
|
|
1721
1719
|
}
|
|
1722
1720
|
/**
|
|
1723
1721
|
* @internal
|
|
@@ -1751,6 +1749,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
1751
1749
|
const fullOptions = {};
|
|
1752
1750
|
if (options !== undefined && typeof options === "object") {
|
|
1753
1751
|
fullOptions.generateMipMaps = options.generateMipMaps;
|
|
1752
|
+
fullOptions.createMipMaps = options.createMipMaps;
|
|
1754
1753
|
fullOptions.type = options.type === undefined ? 0 : options.type;
|
|
1755
1754
|
fullOptions.samplingMode = options.samplingMode === undefined ? 3 : options.samplingMode;
|
|
1756
1755
|
fullOptions.format = options.format === undefined ? 5 : options.format;
|
|
@@ -1790,7 +1789,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
1790
1789
|
texture.depth = depth || layers;
|
|
1791
1790
|
texture.isReady = true;
|
|
1792
1791
|
texture.samples = fullOptions.samples;
|
|
1793
|
-
texture.generateMipMaps = fullOptions.generateMipMaps
|
|
1792
|
+
texture.generateMipMaps = !!fullOptions.generateMipMaps;
|
|
1794
1793
|
texture.samplingMode = fullOptions.samplingMode;
|
|
1795
1794
|
texture.type = fullOptions.type;
|
|
1796
1795
|
texture.format = fullOptions.format;
|
|
@@ -1802,7 +1801,16 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
1802
1801
|
texture.label = fullOptions.label;
|
|
1803
1802
|
this._internalTexturesCache.push(texture);
|
|
1804
1803
|
if (!delayGPUTextureCreation) {
|
|
1804
|
+
const createMipMapsOnly = !fullOptions.generateMipMaps && fullOptions.createMipMaps;
|
|
1805
|
+
if (createMipMapsOnly) {
|
|
1806
|
+
// So that the call to createGPUTextureForInternalTexture creates the mipmaps
|
|
1807
|
+
texture.generateMipMaps = true;
|
|
1808
|
+
}
|
|
1805
1809
|
this._textureHelper.createGPUTextureForInternalTexture(texture, width, height, layers || 1, fullOptions.creationFlags);
|
|
1810
|
+
if (createMipMapsOnly) {
|
|
1811
|
+
// So that we don't automatically generate mipmaps when the render target is unbound
|
|
1812
|
+
texture.generateMipMaps = false;
|
|
1813
|
+
}
|
|
1806
1814
|
}
|
|
1807
1815
|
return texture;
|
|
1808
1816
|
}
|
|
@@ -1867,7 +1875,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
1867
1875
|
* @returns the babylon internal texture
|
|
1868
1876
|
*/
|
|
1869
1877
|
wrapWebGPUTexture(texture) {
|
|
1870
|
-
const hardwareTexture = new WebGPUHardwareTexture(texture);
|
|
1878
|
+
const hardwareTexture = new WebGPUHardwareTexture(this, texture);
|
|
1871
1879
|
const internalTexture = new InternalTexture(this, 0 /* InternalTextureSource.Unknown */, true);
|
|
1872
1880
|
internalTexture._hardwareTexture = hardwareTexture;
|
|
1873
1881
|
internalTexture.isReady = true;
|
|
@@ -1884,7 +1892,7 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
1884
1892
|
/**
|
|
1885
1893
|
* @internal
|
|
1886
1894
|
*/
|
|
1887
|
-
_getUseSRGBBuffer(useSRGBBuffer,
|
|
1895
|
+
_getUseSRGBBuffer(useSRGBBuffer, _noMipmap) {
|
|
1888
1896
|
return useSRGBBuffer && this._caps.supportSRGBBuffers;
|
|
1889
1897
|
}
|
|
1890
1898
|
/**
|
|
@@ -2621,8 +2629,13 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
2621
2629
|
}
|
|
2622
2630
|
this._currentRenderTarget = saveCRT;
|
|
2623
2631
|
this._endCurrentRenderPass();
|
|
2624
|
-
if (
|
|
2625
|
-
|
|
2632
|
+
if (!disableGenerateMipMaps) {
|
|
2633
|
+
if (texture.isMulti) {
|
|
2634
|
+
this.generateMipMapsMultiFramebuffer(texture);
|
|
2635
|
+
}
|
|
2636
|
+
else {
|
|
2637
|
+
this.generateMipMapsFramebuffer(texture);
|
|
2638
|
+
}
|
|
2626
2639
|
}
|
|
2627
2640
|
this._currentRenderTarget = null;
|
|
2628
2641
|
if (this.dbgVerboseLogsForFirstFrames) {
|
|
@@ -2637,6 +2650,23 @@ export class WebGPUEngine extends ThinWebGPUEngine {
|
|
|
2637
2650
|
this._cacheRenderPipeline.setMRT([]);
|
|
2638
2651
|
this._cacheRenderPipeline.setMRTAttachments(this._mrtAttachments);
|
|
2639
2652
|
}
|
|
2653
|
+
/**
|
|
2654
|
+
* Generates mipmaps for the texture of the (single) render target
|
|
2655
|
+
* @param texture The render target containing the texture to generate the mipmaps for
|
|
2656
|
+
*/
|
|
2657
|
+
generateMipMapsFramebuffer(texture) {
|
|
2658
|
+
if (!texture.isMulti && texture.texture?.generateMipMaps && !texture.isCube) {
|
|
2659
|
+
this._generateMipmaps(texture.texture);
|
|
2660
|
+
}
|
|
2661
|
+
}
|
|
2662
|
+
/**
|
|
2663
|
+
* Resolves the MSAA texture of the (single) render target into its non-MSAA version.
|
|
2664
|
+
* Note that if "texture" is not a MSAA render target, no resolve is performed.
|
|
2665
|
+
* @param _texture The render target texture containing the MSAA texture to resolve
|
|
2666
|
+
*/
|
|
2667
|
+
resolveFramebuffer(_texture) {
|
|
2668
|
+
throw new Error("resolveFramebuffer is not yet implemented in WebGPU!");
|
|
2669
|
+
}
|
|
2640
2670
|
/**
|
|
2641
2671
|
* Unbind the current render target and bind the default framebuffer
|
|
2642
2672
|
*/
|