@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
|
@@ -40,9 +40,15 @@ export declare class RenderTargetWrapper {
|
|
|
40
40
|
*/
|
|
41
41
|
label?: string;
|
|
42
42
|
/**
|
|
43
|
-
* Gets the depth/stencil texture
|
|
43
|
+
* Gets the depth/stencil texture
|
|
44
44
|
*/
|
|
45
45
|
get depthStencilTexture(): Nullable<InternalTexture>;
|
|
46
|
+
/**
|
|
47
|
+
* Sets the depth/stencil texture
|
|
48
|
+
* @param texture The depth/stencil texture to set
|
|
49
|
+
* @param disposeExisting True to dispose the existing depth/stencil texture (if any) before replacing it (default: true)
|
|
50
|
+
*/
|
|
51
|
+
setDepthStencilTexture(texture: Nullable<InternalTexture>, disposeExisting?: boolean): void;
|
|
46
52
|
/**
|
|
47
53
|
* Indicates if the depth/stencil texture has a stencil aspect
|
|
48
54
|
*/
|
|
@@ -99,6 +105,23 @@ export declare class RenderTargetWrapper {
|
|
|
99
105
|
* Gets the layer indices that correspond to the list of render textures. If we are not in a multi render target, the list will be null
|
|
100
106
|
*/
|
|
101
107
|
get layerIndices(): Nullable<number[]>;
|
|
108
|
+
/**
|
|
109
|
+
* Sets this property to true to disable the automatic MSAA resolve that happens when the render target wrapper is unbound (default is false)
|
|
110
|
+
*/
|
|
111
|
+
disableAutomaticMSAAResolve: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Indicates if MSAA color texture(s) should be resolved when a resolve occur (either automatically by the engine or manually by the user) (default is true)
|
|
114
|
+
* Note that you can trigger a MSAA resolve at any time by calling resolveMSAATextures()
|
|
115
|
+
*/
|
|
116
|
+
resolveMSAAColors: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Indicates if MSAA depth texture should be resolved when a resolve occur (either automatically by the engine or manually by the user) (default is false)
|
|
119
|
+
*/
|
|
120
|
+
resolveMSAADepth: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Indicates if MSAA stencil texture should be resolved when a resolve occur (either automatically by the engine or manually by the user) (default is false)
|
|
123
|
+
*/
|
|
124
|
+
resolveMSAAStencil: boolean;
|
|
102
125
|
/**
|
|
103
126
|
* Gets the base array layer of a texture in the textures array
|
|
104
127
|
* This is an number that is calculated based on the layer and face indices set for this texture at that index
|
|
@@ -118,6 +141,15 @@ export declare class RenderTargetWrapper {
|
|
|
118
141
|
* @returns the sample count that has been set
|
|
119
142
|
*/
|
|
120
143
|
setSamples(value: number, initializeBuffers?: boolean, force?: boolean): number;
|
|
144
|
+
/**
|
|
145
|
+
* Resolves the MSAA textures into their non-MSAA version.
|
|
146
|
+
* Note that if samples equals 1 (no MSAA), no resolve is performed.
|
|
147
|
+
*/
|
|
148
|
+
resolveMSAATextures(): void;
|
|
149
|
+
/**
|
|
150
|
+
* Generates mipmaps for each texture of the render target
|
|
151
|
+
*/
|
|
152
|
+
generateMipMaps(): void;
|
|
121
153
|
/**
|
|
122
154
|
* Initializes the render target wrapper
|
|
123
155
|
* @param isMulti true if the wrapper is a multi render target
|
|
@@ -1,14 +1,31 @@
|
|
|
1
|
+
import { HasStencilAspect } from "../Materials/Textures/internalTexture.js";
|
|
1
2
|
|
|
2
3
|
/**
|
|
3
4
|
* Wrapper around a render target (either single or multi textures)
|
|
4
5
|
*/
|
|
5
6
|
export class RenderTargetWrapper {
|
|
6
7
|
/**
|
|
7
|
-
* Gets the depth/stencil texture
|
|
8
|
+
* Gets the depth/stencil texture
|
|
8
9
|
*/
|
|
9
10
|
get depthStencilTexture() {
|
|
10
11
|
return this._depthStencilTexture;
|
|
11
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Sets the depth/stencil texture
|
|
15
|
+
* @param texture The depth/stencil texture to set
|
|
16
|
+
* @param disposeExisting True to dispose the existing depth/stencil texture (if any) before replacing it (default: true)
|
|
17
|
+
*/
|
|
18
|
+
setDepthStencilTexture(texture, disposeExisting = true) {
|
|
19
|
+
if (disposeExisting && this._depthStencilTexture) {
|
|
20
|
+
this._depthStencilTexture.dispose();
|
|
21
|
+
}
|
|
22
|
+
this._depthStencilTexture = texture;
|
|
23
|
+
this._generateDepthBuffer = this._generateStencilBuffer = false;
|
|
24
|
+
if (texture) {
|
|
25
|
+
this._generateDepthBuffer = true;
|
|
26
|
+
this._generateStencilBuffer = HasStencilAspect(texture.format);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
12
29
|
/**
|
|
13
30
|
* Indicates if the depth/stencil texture has a stencil aspect
|
|
14
31
|
*/
|
|
@@ -49,13 +66,13 @@ export class RenderTargetWrapper {
|
|
|
49
66
|
* Gets the width of the render target wrapper
|
|
50
67
|
*/
|
|
51
68
|
get width() {
|
|
52
|
-
return this._size.width
|
|
69
|
+
return this._size.width ?? this._size;
|
|
53
70
|
}
|
|
54
71
|
/**
|
|
55
72
|
* Gets the height of the render target wrapper
|
|
56
73
|
*/
|
|
57
74
|
get height() {
|
|
58
|
-
return this._size.height
|
|
75
|
+
return this._size.height ?? this._size;
|
|
59
76
|
}
|
|
60
77
|
/**
|
|
61
78
|
* Gets the number of layers of the render target wrapper (only used if is2DArray is true and wrapper is not a multi render target)
|
|
@@ -131,6 +148,32 @@ export class RenderTargetWrapper {
|
|
|
131
148
|
this._samples = value;
|
|
132
149
|
return result;
|
|
133
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* Resolves the MSAA textures into their non-MSAA version.
|
|
153
|
+
* Note that if samples equals 1 (no MSAA), no resolve is performed.
|
|
154
|
+
*/
|
|
155
|
+
resolveMSAATextures() {
|
|
156
|
+
if (this.isMulti) {
|
|
157
|
+
this._engine.resolveMultiFramebuffer(this);
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
this._engine.resolveFramebuffer(this);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Generates mipmaps for each texture of the render target
|
|
165
|
+
*/
|
|
166
|
+
generateMipMaps() {
|
|
167
|
+
if (this._engine._currentRenderTarget === this) {
|
|
168
|
+
this._engine.unBindFramebuffer(this, true);
|
|
169
|
+
}
|
|
170
|
+
if (this.isMulti) {
|
|
171
|
+
this._engine.generateMipMapsMultiFramebuffer(this);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
this._engine.generateMipMapsFramebuffer(this);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
134
177
|
/**
|
|
135
178
|
* Initializes the render target wrapper
|
|
136
179
|
* @param isMulti true if the wrapper is a multi render target
|
|
@@ -153,6 +196,23 @@ export class RenderTargetWrapper {
|
|
|
153
196
|
this._generateDepthBuffer = false;
|
|
154
197
|
/** @internal */
|
|
155
198
|
this._depthStencilTextureWithStencil = false;
|
|
199
|
+
/**
|
|
200
|
+
* Sets this property to true to disable the automatic MSAA resolve that happens when the render target wrapper is unbound (default is false)
|
|
201
|
+
*/
|
|
202
|
+
this.disableAutomaticMSAAResolve = false;
|
|
203
|
+
/**
|
|
204
|
+
* Indicates if MSAA color texture(s) should be resolved when a resolve occur (either automatically by the engine or manually by the user) (default is true)
|
|
205
|
+
* Note that you can trigger a MSAA resolve at any time by calling resolveMSAATextures()
|
|
206
|
+
*/
|
|
207
|
+
this.resolveMSAAColors = true;
|
|
208
|
+
/**
|
|
209
|
+
* Indicates if MSAA depth texture should be resolved when a resolve occur (either automatically by the engine or manually by the user) (default is false)
|
|
210
|
+
*/
|
|
211
|
+
this.resolveMSAADepth = false;
|
|
212
|
+
/**
|
|
213
|
+
* Indicates if MSAA stencil texture should be resolved when a resolve occur (either automatically by the engine or manually by the user) (default is false)
|
|
214
|
+
*/
|
|
215
|
+
this.resolveMSAAStencil = false;
|
|
156
216
|
this._isMulti = isMulti;
|
|
157
217
|
this._isCube = isCube;
|
|
158
218
|
this._size = size;
|
|
@@ -436,7 +496,7 @@ export class RenderTargetWrapper {
|
|
|
436
496
|
*/
|
|
437
497
|
releaseTextures() {
|
|
438
498
|
if (this._textures) {
|
|
439
|
-
for (let i = 0; i < this._textures
|
|
499
|
+
for (let i = 0; i < this._textures.length; ++i) {
|
|
440
500
|
this._textures[i].dispose();
|
|
441
501
|
}
|
|
442
502
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderTargetWrapper.js","sourceRoot":"","sources":["../../../../dev/core/src/Engines/renderTargetWrapper.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAcxC;;GAEG;AACH,MAAM,OAAO,mBAAmB;IA6B5B;;OAEG;IACH,IAAW,mBAAmB;QAC1B,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,IAAW,8BAA8B;QACrC,OAAO,IAAI,CAAC,+BAA+B,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,KAAK,GAAG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D,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACI,OAAO,CAAC,uBAAuB,GAAG,KAAK;QAC1C,IAAI,CAAC,uBAAuB,EAAE,CAAC;YAC3B,IAAI,CAAC,oBAAoB,EAAE,OAAO,EAAE,CAAC;YACrC,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;YACjC,IAAI,CAAC,eAAe,EAAE,CAAC;QAC3B,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,IAAI,CAAC,CAAC;IACnD,CAAC;CACJ","sourcesContent":["import type { InternalTexture } from \"../Materials/Textures/internalTexture\";\r\nimport { InternalTextureSource } from \"../Materials/Textures/internalTexture\";\r\nimport type { RenderTargetCreationOptions, TextureSize } from \"../Materials/Textures/textureCreationOptions\";\r\nimport type { Nullable } from \"../types\";\r\nimport { Constants } from \"./constants\";\r\nimport type { AbstractEngine } from \"./abstractEngine\";\r\nimport type { IMultiRenderTargetOptions } from \"../Materials/Textures/multiRenderTarget\";\r\n\r\n/**\r\n * An interface enforcing the renderTarget accessor to used by render target textures.\r\n */\r\nexport interface IRenderTargetTexture {\r\n /**\r\n * Entry point to access the wrapper on a texture.\r\n */\r\n renderTarget: Nullable<RenderTargetWrapper>;\r\n}\r\n\r\n/**\r\n * Wrapper around a render target (either single or multi textures)\r\n */\r\nexport class RenderTargetWrapper {\r\n protected _engine: AbstractEngine;\r\n private _size: TextureSize;\r\n private _isCube: boolean;\r\n private _isMulti: boolean;\r\n private _textures: Nullable<InternalTexture[]> = null;\r\n private _faceIndices: Nullable<number[]> = null;\r\n private _layerIndices: Nullable<number[]> = null;\r\n private _depthStencilTextureLabel?: string;\r\n /** @internal */\r\n public _samples = 1;\r\n\r\n /** @internal */\r\n public _attachments: Nullable<number[]> = null;\r\n /** @internal */\r\n public _generateStencilBuffer: boolean = false;\r\n /** @internal */\r\n public _generateDepthBuffer: boolean = false;\r\n\r\n /** @internal */\r\n public _depthStencilTexture: Nullable<InternalTexture>;\r\n /** @internal */\r\n public _depthStencilTextureWithStencil: boolean = false;\r\n\r\n /**\r\n * Gets or sets the label of the render target wrapper (optional, for debugging purpose)\r\n */\r\n public label?: string;\r\n\r\n /**\r\n * Gets the depth/stencil texture (if created by a createDepthStencilTexture() call)\r\n */\r\n public get depthStencilTexture() {\r\n return this._depthStencilTexture;\r\n }\r\n\r\n /**\r\n * Indicates if the depth/stencil texture has a stencil aspect\r\n */\r\n public get depthStencilTextureWithStencil() {\r\n return this._depthStencilTextureWithStencil;\r\n }\r\n\r\n /**\r\n * Defines if the render target wrapper is for a cube texture or if false a 2d texture\r\n */\r\n public get isCube(): boolean {\r\n return this._isCube;\r\n }\r\n\r\n /**\r\n * Defines if the render target wrapper is for a single or multi target render wrapper\r\n */\r\n public get isMulti(): boolean {\r\n return this._isMulti;\r\n }\r\n\r\n /**\r\n * Defines if the render target wrapper is for a single or an array of textures\r\n */\r\n public get is2DArray(): boolean {\r\n return this.layers > 0;\r\n }\r\n\r\n /**\r\n * Defines if the render target wrapper is for a 3D texture\r\n */\r\n public get is3D(): boolean {\r\n return this.depth > 0;\r\n }\r\n\r\n /**\r\n * Gets the size of the render target wrapper (used for cubes, as width=height in this case)\r\n */\r\n public get size(): number {\r\n return this.width;\r\n }\r\n\r\n /**\r\n * Gets the width of the render target wrapper\r\n */\r\n public get width(): number {\r\n return (<{ width: number; height: number }>this._size).width || <number>this._size;\r\n }\r\n\r\n /**\r\n * Gets the height of the render target wrapper\r\n */\r\n public get height(): number {\r\n return (<{ width: number; height: number }>this._size).height || <number>this._size;\r\n }\r\n\r\n /**\r\n * Gets the number of layers of the render target wrapper (only used if is2DArray is true and wrapper is not a multi render target)\r\n */\r\n public get layers(): number {\r\n return (<{ width: number; height: number; depth?: number; layers?: number }>this._size).layers || 0;\r\n }\r\n\r\n /**\r\n * Gets the depth of the render target wrapper (only used if is3D is true and wrapper is not a multi render target)\r\n */\r\n public get depth(): number {\r\n return (<{ width: number; height: number; depth?: number; layers?: number }>this._size).depth || 0;\r\n }\r\n\r\n /**\r\n * Gets the render texture. If this is a multi render target, gets the first texture\r\n */\r\n public get texture(): Nullable<InternalTexture> {\r\n return this._textures?.[0] ?? null;\r\n }\r\n\r\n /**\r\n * Gets the list of render textures. If we are not in a multi render target, the list will be null (use the texture getter instead)\r\n */\r\n public get textures(): Nullable<InternalTexture[]> {\r\n return this._textures;\r\n }\r\n\r\n /**\r\n * Gets the face indices that correspond to the list of render textures. If we are not in a multi render target, the list will be null\r\n */\r\n public get faceIndices(): Nullable<number[]> {\r\n return this._faceIndices;\r\n }\r\n\r\n /**\r\n * Gets the layer indices that correspond to the list of render textures. If we are not in a multi render target, the list will be null\r\n */\r\n public get layerIndices(): Nullable<number[]> {\r\n return this._layerIndices;\r\n }\r\n\r\n /**\r\n * Gets the base array layer of a texture in the textures array\r\n * This is an number that is calculated based on the layer and face indices set for this texture at that index\r\n * @param index The index of the texture in the textures array to get the base array layer for\r\n * @returns the base array layer of the texture at the given index\r\n */\r\n public getBaseArrayLayer(index: number): number {\r\n if (!this._textures) {\r\n return -1;\r\n }\r\n\r\n const texture = this._textures[index];\r\n const layerIndex = this._layerIndices?.[index] ?? 0;\r\n const faceIndex = this._faceIndices?.[index] ?? 0;\r\n\r\n return texture.isCube ? layerIndex * 6 + faceIndex : texture.is3D ? 0 : layerIndex;\r\n }\r\n\r\n /**\r\n * Gets the sample count of the render target\r\n */\r\n public get samples(): number {\r\n return this._samples;\r\n }\r\n\r\n /**\r\n * Sets the sample count of the render target\r\n * @param value sample count\r\n * @param initializeBuffers If set to true, the engine will make an initializing call to drawBuffers (only used when isMulti=true).\r\n * @param force true to force calling the update sample count engine function even if the current sample count is equal to value\r\n * @returns the sample count that has been set\r\n */\r\n public setSamples(value: number, initializeBuffers = true, force = false): number {\r\n if (this.samples === value && !force) {\r\n return value;\r\n }\r\n\r\n const result = this._isMulti\r\n ? this._engine.updateMultipleRenderTargetTextureSampleCount(this, value, initializeBuffers)\r\n : this._engine.updateRenderTargetTextureSampleCount(this, value);\r\n this._samples = value;\r\n return result;\r\n }\r\n\r\n /**\r\n * Initializes the render target wrapper\r\n * @param isMulti true if the wrapper is a multi render target\r\n * @param isCube true if the wrapper should render to a cube texture\r\n * @param size size of the render target (width/height/layers)\r\n * @param engine engine used to create the render target\r\n * @param label defines the label to use for the wrapper (for debugging purpose only)\r\n */\r\n constructor(isMulti: boolean, isCube: boolean, size: TextureSize, engine: AbstractEngine, label?: string) {\r\n this._isMulti = isMulti;\r\n this._isCube = isCube;\r\n this._size = size;\r\n this._engine = engine;\r\n this._depthStencilTexture = null;\r\n this.label = label;\r\n }\r\n\r\n /**\r\n * Sets the render target texture(s)\r\n * @param textures texture(s) to set\r\n */\r\n public setTextures(textures: Nullable<InternalTexture> | Nullable<InternalTexture[]>): void {\r\n if (Array.isArray(textures)) {\r\n this._textures = textures;\r\n } else if (textures) {\r\n this._textures = [textures];\r\n } else {\r\n this._textures = null;\r\n }\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 setTexture(texture: InternalTexture, index: number = 0, disposePrevious: boolean = true): void {\r\n if (!this._textures) {\r\n this._textures = [];\r\n }\r\n if (this._textures[index] === texture) {\r\n return;\r\n }\r\n\r\n if (this._textures[index] && disposePrevious) {\r\n this._textures[index].dispose();\r\n }\r\n\r\n this._textures[index] = texture;\r\n }\r\n\r\n /**\r\n * Sets the layer and face indices of every render target texture bound to each color attachment\r\n * @param layers The layers of each texture to be set\r\n * @param faces The faces of each texture to be set\r\n */\r\n public setLayerAndFaceIndices(layers: number[], faces: number[]) {\r\n this._layerIndices = layers;\r\n this._faceIndices = faces;\r\n }\r\n\r\n /**\r\n * Sets the layer and face indices of a texture in the textures array that should be bound to each color attachment\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 setLayerAndFaceIndex(index: number = 0, layer?: number, face?: number): void {\r\n if (!this._layerIndices) {\r\n this._layerIndices = [];\r\n }\r\n if (!this._faceIndices) {\r\n this._faceIndices = [];\r\n }\r\n\r\n if (layer !== undefined && layer >= 0) {\r\n this._layerIndices[index] = layer;\r\n }\r\n if (face !== undefined && face >= 0) {\r\n this._faceIndices[index] = face;\r\n }\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 Not used anymore. \"format\" will be used to determine if stencil should be created\r\n * @param samples sample count to use when creating the texture (default: 1)\r\n * @param format format of the depth texture (default: Constants.TEXTUREFORMAT_DEPTH32_FLOAT)\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 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 this._depthStencilTexture?.dispose();\r\n\r\n this._depthStencilTextureWithStencil = generateStencil;\r\n this._depthStencilTextureLabel = label;\r\n this._depthStencilTexture = this._engine.createDepthStencilTexture(\r\n this._size,\r\n {\r\n bilinearFiltering,\r\n comparisonFunction,\r\n generateStencil,\r\n isCube: this._isCube,\r\n samples,\r\n depthTextureFormat: format,\r\n label,\r\n },\r\n this\r\n );\r\n\r\n return this._depthStencilTexture;\r\n }\r\n\r\n /**\r\n * @deprecated Use shareDepth instead\r\n * @param renderTarget Destination renderTarget\r\n */\r\n public _shareDepth(renderTarget: RenderTargetWrapper): void {\r\n this.shareDepth(renderTarget);\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 shareDepth(renderTarget: RenderTargetWrapper): void {\r\n if (this._depthStencilTexture) {\r\n if (renderTarget._depthStencilTexture) {\r\n renderTarget._depthStencilTexture.dispose();\r\n }\r\n\r\n renderTarget._depthStencilTexture = this._depthStencilTexture;\r\n renderTarget._depthStencilTextureWithStencil = this._depthStencilTextureWithStencil;\r\n this._depthStencilTexture.incrementReferences();\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _swapAndDie(target: InternalTexture): void {\r\n if (this.texture) {\r\n this.texture._swapAndDie(target);\r\n }\r\n this._textures = null;\r\n this.dispose(true);\r\n }\r\n\r\n protected _cloneRenderTargetWrapper(): Nullable<RenderTargetWrapper> {\r\n let rtw: Nullable<RenderTargetWrapper> = null;\r\n\r\n if (this._isMulti) {\r\n const textureArray = this.textures;\r\n if (textureArray && textureArray.length > 0) {\r\n let generateDepthTexture = false;\r\n let textureCount = textureArray.length;\r\n let depthTextureFormat = -1;\r\n\r\n const lastTextureSource = textureArray[textureArray.length - 1]._source;\r\n if (lastTextureSource === InternalTextureSource.Depth || lastTextureSource === InternalTextureSource.DepthStencil) {\r\n generateDepthTexture = true;\r\n depthTextureFormat = textureArray[textureArray.length - 1].format;\r\n textureCount--;\r\n }\r\n\r\n const samplingModes: number[] = [];\r\n const types: number[] = [];\r\n const formats: number[] = [];\r\n const targetTypes: number[] = [];\r\n const faceIndex: number[] = [];\r\n const layerIndex: number[] = [];\r\n const layerCounts: number[] = [];\r\n const internalTexture2Index: { [id: number]: number } = {};\r\n\r\n for (let i = 0; i < textureCount; ++i) {\r\n const texture = textureArray[i];\r\n\r\n samplingModes.push(texture.samplingMode);\r\n types.push(texture.type);\r\n formats.push(texture.format);\r\n\r\n const index = internalTexture2Index[texture.uniqueId];\r\n if (index !== undefined) {\r\n targetTypes.push(-1);\r\n layerCounts.push(0);\r\n } else {\r\n internalTexture2Index[texture.uniqueId] = i;\r\n if (texture.is2DArray) {\r\n targetTypes.push(Constants.TEXTURE_2D_ARRAY);\r\n layerCounts.push(texture.depth);\r\n } else if (texture.isCube) {\r\n targetTypes.push(Constants.TEXTURE_CUBE_MAP);\r\n layerCounts.push(0);\r\n } /*else if (texture.isCubeArray) {\r\n targetTypes.push(Constants.TEXTURE_CUBE_MAP_ARRAY);\r\n layerCounts.push(texture.depth);\r\n }*/ else if (texture.is3D) {\r\n targetTypes.push(Constants.TEXTURE_3D);\r\n layerCounts.push(texture.depth);\r\n } else {\r\n targetTypes.push(Constants.TEXTURE_2D);\r\n layerCounts.push(0);\r\n }\r\n }\r\n\r\n if (this._faceIndices) {\r\n faceIndex.push(this._faceIndices[i] ?? 0);\r\n }\r\n if (this._layerIndices) {\r\n layerIndex.push(this._layerIndices[i] ?? 0);\r\n }\r\n }\r\n\r\n const optionsMRT: IMultiRenderTargetOptions = {\r\n samplingModes,\r\n generateMipMaps: textureArray[0].generateMipMaps,\r\n generateDepthBuffer: this._generateDepthBuffer,\r\n generateStencilBuffer: this._generateStencilBuffer,\r\n generateDepthTexture,\r\n depthTextureFormat,\r\n types,\r\n formats,\r\n textureCount,\r\n targetTypes,\r\n faceIndex,\r\n layerIndex,\r\n layerCounts,\r\n label: this.label,\r\n };\r\n const size = {\r\n width: this.width,\r\n height: this.height,\r\n depth: this.depth,\r\n };\r\n\r\n rtw = this._engine.createMultipleRenderTarget(size, optionsMRT);\r\n\r\n for (let i = 0; i < textureCount; ++i) {\r\n if (targetTypes[i] !== -1) {\r\n continue;\r\n }\r\n const index = internalTexture2Index[textureArray[i].uniqueId];\r\n rtw.setTexture(rtw.textures![index], i);\r\n }\r\n }\r\n } else {\r\n const options: RenderTargetCreationOptions = {};\r\n\r\n options.generateDepthBuffer = this._generateDepthBuffer;\r\n options.generateMipMaps = this.texture?.generateMipMaps ?? false;\r\n options.generateStencilBuffer = this._generateStencilBuffer;\r\n options.samplingMode = this.texture?.samplingMode;\r\n options.type = this.texture?.type;\r\n options.format = this.texture?.format;\r\n options.noColorAttachment = !this._textures;\r\n options.label = this.label;\r\n\r\n if (this.isCube) {\r\n rtw = this._engine.createRenderTargetCubeTexture(this.width, options);\r\n } else {\r\n const size = {\r\n width: this.width,\r\n height: this.height,\r\n layers: this.is2DArray || this.is3D ? this.texture?.depth : undefined,\r\n };\r\n\r\n rtw = this._engine.createRenderTargetTexture(size, options);\r\n }\r\n if (rtw.texture) {\r\n rtw.texture!.isReady = true;\r\n }\r\n }\r\n\r\n return rtw;\r\n }\r\n\r\n protected _swapRenderTargetWrapper(target: RenderTargetWrapper): void {\r\n if (this._textures && target._textures) {\r\n for (let i = 0; i < this._textures.length; ++i) {\r\n this._textures[i]._swapAndDie(target._textures[i], false);\r\n target._textures[i].isReady = true;\r\n }\r\n }\r\n if (this._depthStencilTexture && target._depthStencilTexture) {\r\n this._depthStencilTexture._swapAndDie(target._depthStencilTexture);\r\n target._depthStencilTexture.isReady = true;\r\n }\r\n\r\n this._textures = null;\r\n this._depthStencilTexture = null;\r\n }\r\n\r\n /** @internal */\r\n public _rebuild(): void {\r\n const rtw = this._cloneRenderTargetWrapper();\r\n if (!rtw) {\r\n return;\r\n }\r\n\r\n if (this._depthStencilTexture) {\r\n const samplingMode = this._depthStencilTexture.samplingMode;\r\n const format = this._depthStencilTexture.format;\r\n const bilinear =\r\n samplingMode === Constants.TEXTURE_BILINEAR_SAMPLINGMODE ||\r\n samplingMode === Constants.TEXTURE_TRILINEAR_SAMPLINGMODE ||\r\n samplingMode === Constants.TEXTURE_LINEAR_LINEAR_MIPNEAREST;\r\n\r\n rtw.createDepthStencilTexture(\r\n this._depthStencilTexture._comparisonFunction,\r\n bilinear,\r\n this._depthStencilTextureWithStencil,\r\n this._depthStencilTexture.samples,\r\n format,\r\n this._depthStencilTextureLabel\r\n );\r\n }\r\n\r\n if (this.samples > 1) {\r\n rtw.setSamples(this.samples);\r\n }\r\n\r\n rtw._swapRenderTargetWrapper(this);\r\n rtw.dispose();\r\n }\r\n\r\n /**\r\n * Releases the internal render textures\r\n */\r\n public releaseTextures(): void {\r\n if (this._textures) {\r\n for (let i = 0; i < this._textures?.length ?? 0; ++i) {\r\n this._textures[i].dispose();\r\n }\r\n }\r\n this._textures = null;\r\n }\r\n\r\n /**\r\n * Disposes the whole render target wrapper\r\n * @param disposeOnlyFramebuffers true if only the frame buffers should be released (used for the WebGL engine). If false, all the textures will also be released\r\n */\r\n public dispose(disposeOnlyFramebuffers = false): void {\r\n if (!disposeOnlyFramebuffers) {\r\n this._depthStencilTexture?.dispose();\r\n this._depthStencilTexture = null;\r\n this.releaseTextures();\r\n }\r\n\r\n this._engine._releaseRenderTargetWrapper(this);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"renderTargetWrapper.js","sourceRoot":"","sources":["../../../../dev/core/src/Engines/renderTargetWrapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAyB,MAAM,uCAAuC,CAAC;AAGhG,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAcxC;;GAEG;AACH,MAAM,OAAO,mBAAmB;IA6B5B;;OAEG;IACH,IAAW,mBAAmB;QAC1B,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACI,sBAAsB,CAAC,OAAkC,EAAE,eAAe,GAAG,IAAI;QACpF,IAAI,eAAe,IAAI,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC/C,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,CAAC;QACxC,CAAC;QAED,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC;QAEpC,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,sBAAsB,GAAG,KAAK,CAAC;QAEhE,IAAI,OAAO,EAAE,CAAC;YACV,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;YACjC,IAAI,CAAC,sBAAsB,GAAG,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACnE,CAAC;IACL,CAAC;IAED;;OAEG;IACH,IAAW,8BAA8B;QACrC,OAAO,IAAI,CAAC,+BAA+B,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,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AAE,CAAC;YAC3B,IAAI,CAAC,oBAAoB,EAAE,OAAO,EAAE,CAAC;YACrC,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;YACjC,IAAI,CAAC,eAAe,EAAE,CAAC;QAC3B,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,IAAI,CAAC,CAAC;IACnD,CAAC;CACJ","sourcesContent":["import type { InternalTexture } from \"../Materials/Textures/internalTexture\";\r\nimport { HasStencilAspect, InternalTextureSource } from \"../Materials/Textures/internalTexture\";\r\nimport type { RenderTargetCreationOptions, TextureSize } from \"../Materials/Textures/textureCreationOptions\";\r\nimport type { Nullable } from \"../types\";\r\nimport { Constants } from \"./constants\";\r\nimport type { AbstractEngine } from \"./abstractEngine\";\r\nimport type { IMultiRenderTargetOptions } from \"../Materials/Textures/multiRenderTarget\";\r\n\r\n/**\r\n * An interface enforcing the renderTarget accessor to used by render target textures.\r\n */\r\nexport interface IRenderTargetTexture {\r\n /**\r\n * Entry point to access the wrapper on a texture.\r\n */\r\n renderTarget: Nullable<RenderTargetWrapper>;\r\n}\r\n\r\n/**\r\n * Wrapper around a render target (either single or multi textures)\r\n */\r\nexport class RenderTargetWrapper {\r\n protected _engine: AbstractEngine;\r\n private _size: TextureSize;\r\n private _isCube: boolean;\r\n private _isMulti: boolean;\r\n private _textures: Nullable<InternalTexture[]> = null;\r\n private _faceIndices: Nullable<number[]> = null;\r\n private _layerIndices: Nullable<number[]> = null;\r\n private _depthStencilTextureLabel?: string;\r\n /** @internal */\r\n public _samples = 1;\r\n\r\n /** @internal */\r\n public _attachments: Nullable<number[]> = null;\r\n /** @internal */\r\n public _generateStencilBuffer: boolean = false;\r\n /** @internal */\r\n public _generateDepthBuffer: boolean = false;\r\n\r\n /** @internal */\r\n public _depthStencilTexture: Nullable<InternalTexture>;\r\n /** @internal */\r\n public _depthStencilTextureWithStencil: boolean = false;\r\n\r\n /**\r\n * Gets or sets the label of the render target wrapper (optional, for debugging purpose)\r\n */\r\n public label?: string;\r\n\r\n /**\r\n * Gets the depth/stencil texture\r\n */\r\n public get depthStencilTexture() {\r\n return this._depthStencilTexture;\r\n }\r\n\r\n /**\r\n * Sets the depth/stencil texture\r\n * @param texture The depth/stencil texture to set\r\n * @param disposeExisting True to dispose the existing depth/stencil texture (if any) before replacing it (default: true)\r\n */\r\n public setDepthStencilTexture(texture: Nullable<InternalTexture>, disposeExisting = true) {\r\n if (disposeExisting && this._depthStencilTexture) {\r\n this._depthStencilTexture.dispose();\r\n }\r\n\r\n this._depthStencilTexture = texture;\r\n\r\n this._generateDepthBuffer = this._generateStencilBuffer = false;\r\n\r\n if (texture) {\r\n this._generateDepthBuffer = true;\r\n this._generateStencilBuffer = HasStencilAspect(texture.format);\r\n }\r\n }\r\n\r\n /**\r\n * Indicates if the depth/stencil texture has a stencil aspect\r\n */\r\n public get depthStencilTextureWithStencil() {\r\n return this._depthStencilTextureWithStencil;\r\n }\r\n\r\n /**\r\n * Defines if the render target wrapper is for a cube texture or if false a 2d texture\r\n */\r\n public get isCube(): boolean {\r\n return this._isCube;\r\n }\r\n\r\n /**\r\n * Defines if the render target wrapper is for a single or multi target render wrapper\r\n */\r\n public get isMulti(): boolean {\r\n return this._isMulti;\r\n }\r\n\r\n /**\r\n * Defines if the render target wrapper is for a single or an array of textures\r\n */\r\n public get is2DArray(): boolean {\r\n return this.layers > 0;\r\n }\r\n\r\n /**\r\n * Defines if the render target wrapper is for a 3D texture\r\n */\r\n public get is3D(): boolean {\r\n return this.depth > 0;\r\n }\r\n\r\n /**\r\n * Gets the size of the render target wrapper (used for cubes, as width=height in this case)\r\n */\r\n public get size(): number {\r\n return this.width;\r\n }\r\n\r\n /**\r\n * Gets the width of the render target wrapper\r\n */\r\n public get width(): number {\r\n return (<{ width: number; height: number }>this._size).width ?? <number>this._size;\r\n }\r\n\r\n /**\r\n * Gets the height of the render target wrapper\r\n */\r\n public get height(): number {\r\n return (<{ width: number; height: number }>this._size).height ?? <number>this._size;\r\n }\r\n\r\n /**\r\n * Gets the number of layers of the render target wrapper (only used if is2DArray is true and wrapper is not a multi render target)\r\n */\r\n public get layers(): number {\r\n return (<{ width: number; height: number; depth?: number; layers?: number }>this._size).layers || 0;\r\n }\r\n\r\n /**\r\n * Gets the depth of the render target wrapper (only used if is3D is true and wrapper is not a multi render target)\r\n */\r\n public get depth(): number {\r\n return (<{ width: number; height: number; depth?: number; layers?: number }>this._size).depth || 0;\r\n }\r\n\r\n /**\r\n * Gets the render texture. If this is a multi render target, gets the first texture\r\n */\r\n public get texture(): Nullable<InternalTexture> {\r\n return this._textures?.[0] ?? null;\r\n }\r\n\r\n /**\r\n * Gets the list of render textures. If we are not in a multi render target, the list will be null (use the texture getter instead)\r\n */\r\n public get textures(): Nullable<InternalTexture[]> {\r\n return this._textures;\r\n }\r\n\r\n /**\r\n * Gets the face indices that correspond to the list of render textures. If we are not in a multi render target, the list will be null\r\n */\r\n public get faceIndices(): Nullable<number[]> {\r\n return this._faceIndices;\r\n }\r\n\r\n /**\r\n * Gets the layer indices that correspond to the list of render textures. If we are not in a multi render target, the list will be null\r\n */\r\n public get layerIndices(): Nullable<number[]> {\r\n return this._layerIndices;\r\n }\r\n\r\n /**\r\n * Sets this property to true to disable the automatic MSAA resolve that happens when the render target wrapper is unbound (default is false)\r\n */\r\n public disableAutomaticMSAAResolve = false;\r\n\r\n /**\r\n * Indicates if MSAA color texture(s) should be resolved when a resolve occur (either automatically by the engine or manually by the user) (default is true)\r\n * Note that you can trigger a MSAA resolve at any time by calling resolveMSAATextures()\r\n */\r\n public resolveMSAAColors = true;\r\n\r\n /**\r\n * Indicates if MSAA depth texture should be resolved when a resolve occur (either automatically by the engine or manually by the user) (default is false)\r\n */\r\n public resolveMSAADepth = false;\r\n\r\n /**\r\n * Indicates if MSAA stencil texture should be resolved when a resolve occur (either automatically by the engine or manually by the user) (default is false)\r\n */\r\n public resolveMSAAStencil = false;\r\n\r\n /**\r\n * Gets the base array layer of a texture in the textures array\r\n * This is an number that is calculated based on the layer and face indices set for this texture at that index\r\n * @param index The index of the texture in the textures array to get the base array layer for\r\n * @returns the base array layer of the texture at the given index\r\n */\r\n public getBaseArrayLayer(index: number): number {\r\n if (!this._textures) {\r\n return -1;\r\n }\r\n\r\n const texture = this._textures[index];\r\n const layerIndex = this._layerIndices?.[index] ?? 0;\r\n const faceIndex = this._faceIndices?.[index] ?? 0;\r\n\r\n return texture.isCube ? layerIndex * 6 + faceIndex : texture.is3D ? 0 : layerIndex;\r\n }\r\n\r\n /**\r\n * Gets the sample count of the render target\r\n */\r\n public get samples(): number {\r\n return this._samples;\r\n }\r\n\r\n /**\r\n * Sets the sample count of the render target\r\n * @param value sample count\r\n * @param initializeBuffers If set to true, the engine will make an initializing call to drawBuffers (only used when isMulti=true).\r\n * @param force true to force calling the update sample count engine function even if the current sample count is equal to value\r\n * @returns the sample count that has been set\r\n */\r\n public setSamples(value: number, initializeBuffers = true, force = false): number {\r\n if (this.samples === value && !force) {\r\n return value;\r\n }\r\n\r\n const result = this._isMulti\r\n ? this._engine.updateMultipleRenderTargetTextureSampleCount(this, value, initializeBuffers)\r\n : this._engine.updateRenderTargetTextureSampleCount(this, value);\r\n this._samples = value;\r\n return result;\r\n }\r\n\r\n /**\r\n * Resolves the MSAA textures into their non-MSAA version.\r\n * Note that if samples equals 1 (no MSAA), no resolve is performed.\r\n */\r\n public resolveMSAATextures(): void {\r\n if (this.isMulti) {\r\n this._engine.resolveMultiFramebuffer(this);\r\n } else {\r\n this._engine.resolveFramebuffer(this);\r\n }\r\n }\r\n\r\n /**\r\n * Generates mipmaps for each texture of the render target\r\n */\r\n public generateMipMaps(): void {\r\n if (this._engine._currentRenderTarget === this) {\r\n this._engine.unBindFramebuffer(this, true);\r\n }\r\n if (this.isMulti) {\r\n this._engine.generateMipMapsMultiFramebuffer(this);\r\n } else {\r\n this._engine.generateMipMapsFramebuffer(this);\r\n }\r\n }\r\n\r\n /**\r\n * Initializes the render target wrapper\r\n * @param isMulti true if the wrapper is a multi render target\r\n * @param isCube true if the wrapper should render to a cube texture\r\n * @param size size of the render target (width/height/layers)\r\n * @param engine engine used to create the render target\r\n * @param label defines the label to use for the wrapper (for debugging purpose only)\r\n */\r\n constructor(isMulti: boolean, isCube: boolean, size: TextureSize, engine: AbstractEngine, label?: string) {\r\n this._isMulti = isMulti;\r\n this._isCube = isCube;\r\n this._size = size;\r\n this._engine = engine;\r\n this._depthStencilTexture = null;\r\n this.label = label;\r\n }\r\n\r\n /**\r\n * Sets the render target texture(s)\r\n * @param textures texture(s) to set\r\n */\r\n public setTextures(textures: Nullable<InternalTexture> | Nullable<InternalTexture[]>): void {\r\n if (Array.isArray(textures)) {\r\n this._textures = textures;\r\n } else if (textures) {\r\n this._textures = [textures];\r\n } else {\r\n this._textures = null;\r\n }\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 setTexture(texture: InternalTexture, index: number = 0, disposePrevious: boolean = true): void {\r\n if (!this._textures) {\r\n this._textures = [];\r\n }\r\n if (this._textures[index] === texture) {\r\n return;\r\n }\r\n\r\n if (this._textures[index] && disposePrevious) {\r\n this._textures[index].dispose();\r\n }\r\n\r\n this._textures[index] = texture;\r\n }\r\n\r\n /**\r\n * Sets the layer and face indices of every render target texture bound to each color attachment\r\n * @param layers The layers of each texture to be set\r\n * @param faces The faces of each texture to be set\r\n */\r\n public setLayerAndFaceIndices(layers: number[], faces: number[]) {\r\n this._layerIndices = layers;\r\n this._faceIndices = faces;\r\n }\r\n\r\n /**\r\n * Sets the layer and face indices of a texture in the textures array that should be bound to each color attachment\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 setLayerAndFaceIndex(index: number = 0, layer?: number, face?: number): void {\r\n if (!this._layerIndices) {\r\n this._layerIndices = [];\r\n }\r\n if (!this._faceIndices) {\r\n this._faceIndices = [];\r\n }\r\n\r\n if (layer !== undefined && layer >= 0) {\r\n this._layerIndices[index] = layer;\r\n }\r\n if (face !== undefined && face >= 0) {\r\n this._faceIndices[index] = face;\r\n }\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 Not used anymore. \"format\" will be used to determine if stencil should be created\r\n * @param samples sample count to use when creating the texture (default: 1)\r\n * @param format format of the depth texture (default: Constants.TEXTUREFORMAT_DEPTH32_FLOAT)\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 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 this._depthStencilTexture?.dispose();\r\n\r\n this._depthStencilTextureWithStencil = generateStencil;\r\n this._depthStencilTextureLabel = label;\r\n this._depthStencilTexture = this._engine.createDepthStencilTexture(\r\n this._size,\r\n {\r\n bilinearFiltering,\r\n comparisonFunction,\r\n generateStencil,\r\n isCube: this._isCube,\r\n samples,\r\n depthTextureFormat: format,\r\n label,\r\n },\r\n this\r\n );\r\n\r\n return this._depthStencilTexture;\r\n }\r\n\r\n /**\r\n * @deprecated Use shareDepth instead\r\n * @param renderTarget Destination renderTarget\r\n */\r\n public _shareDepth(renderTarget: RenderTargetWrapper): void {\r\n this.shareDepth(renderTarget);\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 shareDepth(renderTarget: RenderTargetWrapper): void {\r\n if (this._depthStencilTexture) {\r\n if (renderTarget._depthStencilTexture) {\r\n renderTarget._depthStencilTexture.dispose();\r\n }\r\n\r\n renderTarget._depthStencilTexture = this._depthStencilTexture;\r\n renderTarget._depthStencilTextureWithStencil = this._depthStencilTextureWithStencil;\r\n this._depthStencilTexture.incrementReferences();\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _swapAndDie(target: InternalTexture): void {\r\n if (this.texture) {\r\n this.texture._swapAndDie(target);\r\n }\r\n this._textures = null;\r\n this.dispose(true);\r\n }\r\n\r\n protected _cloneRenderTargetWrapper(): Nullable<RenderTargetWrapper> {\r\n let rtw: Nullable<RenderTargetWrapper> = null;\r\n\r\n if (this._isMulti) {\r\n const textureArray = this.textures;\r\n if (textureArray && textureArray.length > 0) {\r\n let generateDepthTexture = false;\r\n let textureCount = textureArray.length;\r\n let depthTextureFormat = -1;\r\n\r\n const lastTextureSource = textureArray[textureArray.length - 1]._source;\r\n if (lastTextureSource === InternalTextureSource.Depth || lastTextureSource === InternalTextureSource.DepthStencil) {\r\n generateDepthTexture = true;\r\n depthTextureFormat = textureArray[textureArray.length - 1].format;\r\n textureCount--;\r\n }\r\n\r\n const samplingModes: number[] = [];\r\n const types: number[] = [];\r\n const formats: number[] = [];\r\n const targetTypes: number[] = [];\r\n const faceIndex: number[] = [];\r\n const layerIndex: number[] = [];\r\n const layerCounts: number[] = [];\r\n const internalTexture2Index: { [id: number]: number } = {};\r\n\r\n for (let i = 0; i < textureCount; ++i) {\r\n const texture = textureArray[i];\r\n\r\n samplingModes.push(texture.samplingMode);\r\n types.push(texture.type);\r\n formats.push(texture.format);\r\n\r\n const index = internalTexture2Index[texture.uniqueId];\r\n if (index !== undefined) {\r\n targetTypes.push(-1);\r\n layerCounts.push(0);\r\n } else {\r\n internalTexture2Index[texture.uniqueId] = i;\r\n if (texture.is2DArray) {\r\n targetTypes.push(Constants.TEXTURE_2D_ARRAY);\r\n layerCounts.push(texture.depth);\r\n } else if (texture.isCube) {\r\n targetTypes.push(Constants.TEXTURE_CUBE_MAP);\r\n layerCounts.push(0);\r\n } /*else if (texture.isCubeArray) {\r\n targetTypes.push(Constants.TEXTURE_CUBE_MAP_ARRAY);\r\n layerCounts.push(texture.depth);\r\n }*/ else if (texture.is3D) {\r\n targetTypes.push(Constants.TEXTURE_3D);\r\n layerCounts.push(texture.depth);\r\n } else {\r\n targetTypes.push(Constants.TEXTURE_2D);\r\n layerCounts.push(0);\r\n }\r\n }\r\n\r\n if (this._faceIndices) {\r\n faceIndex.push(this._faceIndices[i] ?? 0);\r\n }\r\n if (this._layerIndices) {\r\n layerIndex.push(this._layerIndices[i] ?? 0);\r\n }\r\n }\r\n\r\n const optionsMRT: IMultiRenderTargetOptions = {\r\n samplingModes,\r\n generateMipMaps: textureArray[0].generateMipMaps,\r\n generateDepthBuffer: this._generateDepthBuffer,\r\n generateStencilBuffer: this._generateStencilBuffer,\r\n generateDepthTexture,\r\n depthTextureFormat,\r\n types,\r\n formats,\r\n textureCount,\r\n targetTypes,\r\n faceIndex,\r\n layerIndex,\r\n layerCounts,\r\n label: this.label,\r\n };\r\n const size = {\r\n width: this.width,\r\n height: this.height,\r\n depth: this.depth,\r\n };\r\n\r\n rtw = this._engine.createMultipleRenderTarget(size, optionsMRT);\r\n\r\n for (let i = 0; i < textureCount; ++i) {\r\n if (targetTypes[i] !== -1) {\r\n continue;\r\n }\r\n const index = internalTexture2Index[textureArray[i].uniqueId];\r\n rtw.setTexture(rtw.textures![index], i);\r\n }\r\n }\r\n } else {\r\n const options: RenderTargetCreationOptions = {};\r\n\r\n options.generateDepthBuffer = this._generateDepthBuffer;\r\n options.generateMipMaps = this.texture?.generateMipMaps ?? false;\r\n options.generateStencilBuffer = this._generateStencilBuffer;\r\n options.samplingMode = this.texture?.samplingMode;\r\n options.type = this.texture?.type;\r\n options.format = this.texture?.format;\r\n options.noColorAttachment = !this._textures;\r\n options.label = this.label;\r\n\r\n if (this.isCube) {\r\n rtw = this._engine.createRenderTargetCubeTexture(this.width, options);\r\n } else {\r\n const size = {\r\n width: this.width,\r\n height: this.height,\r\n layers: this.is2DArray || this.is3D ? this.texture?.depth : undefined,\r\n };\r\n\r\n rtw = this._engine.createRenderTargetTexture(size, options);\r\n }\r\n if (rtw.texture) {\r\n rtw.texture!.isReady = true;\r\n }\r\n }\r\n\r\n return rtw;\r\n }\r\n\r\n protected _swapRenderTargetWrapper(target: RenderTargetWrapper): void {\r\n if (this._textures && target._textures) {\r\n for (let i = 0; i < this._textures.length; ++i) {\r\n this._textures[i]._swapAndDie(target._textures[i], false);\r\n target._textures[i].isReady = true;\r\n }\r\n }\r\n if (this._depthStencilTexture && target._depthStencilTexture) {\r\n this._depthStencilTexture._swapAndDie(target._depthStencilTexture);\r\n target._depthStencilTexture.isReady = true;\r\n }\r\n\r\n this._textures = null;\r\n this._depthStencilTexture = null;\r\n }\r\n\r\n /** @internal */\r\n public _rebuild(): void {\r\n const rtw = this._cloneRenderTargetWrapper();\r\n if (!rtw) {\r\n return;\r\n }\r\n\r\n if (this._depthStencilTexture) {\r\n const samplingMode = this._depthStencilTexture.samplingMode;\r\n const format = this._depthStencilTexture.format;\r\n const bilinear =\r\n samplingMode === Constants.TEXTURE_BILINEAR_SAMPLINGMODE ||\r\n samplingMode === Constants.TEXTURE_TRILINEAR_SAMPLINGMODE ||\r\n samplingMode === Constants.TEXTURE_LINEAR_LINEAR_MIPNEAREST;\r\n\r\n rtw.createDepthStencilTexture(\r\n this._depthStencilTexture._comparisonFunction,\r\n bilinear,\r\n this._depthStencilTextureWithStencil,\r\n this._depthStencilTexture.samples,\r\n format,\r\n this._depthStencilTextureLabel\r\n );\r\n }\r\n\r\n if (this.samples > 1) {\r\n rtw.setSamples(this.samples);\r\n }\r\n\r\n rtw._swapRenderTargetWrapper(this);\r\n rtw.dispose();\r\n }\r\n\r\n /**\r\n * Releases the internal render textures\r\n */\r\n public releaseTextures(): void {\r\n if (this._textures) {\r\n for (let i = 0; i < this._textures.length; ++i) {\r\n this._textures[i].dispose();\r\n }\r\n }\r\n this._textures = null;\r\n }\r\n\r\n /**\r\n * Disposes the whole render target wrapper\r\n * @param disposeOnlyFramebuffers true if only the frame buffers should be released (used for the WebGL engine). If false, all the textures will also be released\r\n */\r\n public dispose(disposeOnlyFramebuffers = false): void {\r\n if (!disposeOnlyFramebuffers) {\r\n this._depthStencilTexture?.dispose();\r\n this._depthStencilTexture = null;\r\n this.releaseTextures();\r\n }\r\n\r\n this._engine._releaseRenderTargetWrapper(this);\r\n }\r\n}\r\n"]}
|
package/Engines/thinEngine.d.ts
CHANGED
|
@@ -291,6 +291,17 @@ export declare class ThinEngine extends AbstractEngine {
|
|
|
291
291
|
* @param onBeforeUnbind defines a function which will be called before the effective unbind
|
|
292
292
|
*/
|
|
293
293
|
unBindFramebuffer(texture: RenderTargetWrapper, disableGenerateMipMaps?: boolean, onBeforeUnbind?: () => void): void;
|
|
294
|
+
/**
|
|
295
|
+
* Generates mipmaps for the texture of the (single) render target
|
|
296
|
+
* @param texture The render target containing the texture to generate the mipmaps for
|
|
297
|
+
*/
|
|
298
|
+
generateMipMapsFramebuffer(texture: RenderTargetWrapper): void;
|
|
299
|
+
/**
|
|
300
|
+
* Resolves the MSAA texture of the (single) render target into its non-MSAA version.
|
|
301
|
+
* Note that if "texture" is not a MSAA render target, no resolve is performed.
|
|
302
|
+
* @param texture The render target texture containing the MSAA textures to resolve
|
|
303
|
+
*/
|
|
304
|
+
resolveFramebuffer(texture: RenderTargetWrapper): void;
|
|
294
305
|
/**
|
|
295
306
|
* Force a webGL flush (ie. a flush of all waiting webGL commands)
|
|
296
307
|
*/
|
|
@@ -932,10 +943,11 @@ export declare class ThinEngine extends AbstractEngine {
|
|
|
932
943
|
protected _prepareWebGLTextureContinuation(texture: InternalTexture, scene: Nullable<ISceneLike>, noMipmap: boolean, isCompressed: boolean, samplingMode: number): void;
|
|
933
944
|
private _prepareWebGLTexture;
|
|
934
945
|
_getInternalFormatFromDepthTextureFormat(textureFormat: number, hasDepth: boolean, hasStencil: boolean): number;
|
|
946
|
+
_getWebGLTextureTypeFromDepthTextureFormat(textureFormat: number): GLenum;
|
|
935
947
|
/**
|
|
936
948
|
* @internal
|
|
937
949
|
*/
|
|
938
|
-
_setupFramebufferDepthAttachments(generateStencilBuffer: boolean, generateDepthBuffer: boolean, width: number, height: number, samples?: number, depthTextureFormat?: number): Nullable<WebGLRenderbuffer>;
|
|
950
|
+
_setupFramebufferDepthAttachments(generateStencilBuffer: boolean, generateDepthBuffer: boolean, width: number, height: number, samples?: number, depthTextureFormat?: number, dontBindRenderBufferToFrameBuffer?: boolean): Nullable<WebGLRenderbuffer>;
|
|
939
951
|
/**
|
|
940
952
|
* @internal
|
|
941
953
|
*/
|
package/Engines/thinEngine.js
CHANGED
|
@@ -9,7 +9,7 @@ import { GetExponentOfTwo } from "../Misc/tools.functions.js";
|
|
|
9
9
|
import { AbstractEngine } from "./abstractEngine.js";
|
|
10
10
|
|
|
11
11
|
import { WebGLHardwareTexture } from "./WebGL/webGLHardwareTexture.js";
|
|
12
|
-
import { InternalTexture } from "../Materials/Textures/internalTexture.js";
|
|
12
|
+
import { InternalTexture, IsDepthTexture, HasStencilAspect } from "../Materials/Textures/internalTexture.js";
|
|
13
13
|
import { Effect } from "../Materials/effect.js";
|
|
14
14
|
import { _ConcatenateShader, _getGlobalDefines } from "./abstractEngine.functions.js";
|
|
15
15
|
import { resetCachedPipeline } from "../Materials/effect.functions.js";
|
|
@@ -885,20 +885,21 @@ export class ThinEngine extends AbstractEngine {
|
|
|
885
885
|
unBindFramebuffer(texture, disableGenerateMipMaps = false, onBeforeUnbind) {
|
|
886
886
|
const webglRTWrapper = texture;
|
|
887
887
|
this._currentRenderTarget = null;
|
|
888
|
-
|
|
889
|
-
const gl = this._gl;
|
|
890
|
-
if (webglRTWrapper._MSAAFramebuffer) {
|
|
888
|
+
if (!webglRTWrapper.disableAutomaticMSAAResolve) {
|
|
891
889
|
if (texture.isMulti) {
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
890
|
+
this.resolveMultiFramebuffer(texture);
|
|
891
|
+
}
|
|
892
|
+
else {
|
|
893
|
+
this.resolveFramebuffer(texture);
|
|
895
894
|
}
|
|
896
|
-
gl.bindFramebuffer(gl.READ_FRAMEBUFFER, webglRTWrapper._MSAAFramebuffer);
|
|
897
|
-
gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, webglRTWrapper._framebuffer);
|
|
898
|
-
gl.blitFramebuffer(0, 0, texture.width, texture.height, 0, 0, texture.width, texture.height, gl.COLOR_BUFFER_BIT, gl.NEAREST);
|
|
899
895
|
}
|
|
900
|
-
if (
|
|
901
|
-
|
|
896
|
+
if (!disableGenerateMipMaps) {
|
|
897
|
+
if (texture.isMulti) {
|
|
898
|
+
this.generateMipMapsMultiFramebuffer(texture);
|
|
899
|
+
}
|
|
900
|
+
else {
|
|
901
|
+
this.generateMipMapsFramebuffer(texture);
|
|
902
|
+
}
|
|
902
903
|
}
|
|
903
904
|
if (onBeforeUnbind) {
|
|
904
905
|
if (webglRTWrapper._MSAAFramebuffer) {
|
|
@@ -909,6 +910,33 @@ export class ThinEngine extends AbstractEngine {
|
|
|
909
910
|
}
|
|
910
911
|
this._bindUnboundFramebuffer(null);
|
|
911
912
|
}
|
|
913
|
+
/**
|
|
914
|
+
* Generates mipmaps for the texture of the (single) render target
|
|
915
|
+
* @param texture The render target containing the texture to generate the mipmaps for
|
|
916
|
+
*/
|
|
917
|
+
generateMipMapsFramebuffer(texture) {
|
|
918
|
+
if (!texture.isMulti && texture.texture?.generateMipMaps && !texture.isCube) {
|
|
919
|
+
this.generateMipmaps(texture.texture);
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
/**
|
|
923
|
+
* Resolves the MSAA texture of the (single) render target into its non-MSAA version.
|
|
924
|
+
* Note that if "texture" is not a MSAA render target, no resolve is performed.
|
|
925
|
+
* @param texture The render target texture containing the MSAA textures to resolve
|
|
926
|
+
*/
|
|
927
|
+
resolveFramebuffer(texture) {
|
|
928
|
+
const rtWrapper = texture;
|
|
929
|
+
const gl = this._gl;
|
|
930
|
+
if (!rtWrapper._MSAAFramebuffer || rtWrapper.isMulti) {
|
|
931
|
+
return;
|
|
932
|
+
}
|
|
933
|
+
let bufferBits = rtWrapper.resolveMSAAColors ? gl.COLOR_BUFFER_BIT : 0;
|
|
934
|
+
bufferBits |= rtWrapper._generateDepthBuffer && rtWrapper.resolveMSAADepth ? gl.DEPTH_BUFFER_BIT : 0;
|
|
935
|
+
bufferBits |= rtWrapper._generateStencilBuffer && rtWrapper.resolveMSAAStencil ? gl.STENCIL_BUFFER_BIT : 0;
|
|
936
|
+
gl.bindFramebuffer(gl.READ_FRAMEBUFFER, rtWrapper._MSAAFramebuffer);
|
|
937
|
+
gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, rtWrapper._framebuffer);
|
|
938
|
+
gl.blitFramebuffer(0, 0, texture.width, texture.height, 0, 0, texture.width, texture.height, bufferBits, gl.NEAREST);
|
|
939
|
+
}
|
|
912
940
|
/**
|
|
913
941
|
* Force a webGL flush (ie. a flush of all waiting webGL commands)
|
|
914
942
|
*/
|
|
@@ -1518,7 +1546,9 @@ export class ThinEngine extends AbstractEngine {
|
|
|
1518
1546
|
if (webGLPipelineContext && webGLPipelineContext.program) {
|
|
1519
1547
|
webGLPipelineContext.program.__SPECTOR_rebuildProgram = null;
|
|
1520
1548
|
resetCachedPipeline(webGLPipelineContext);
|
|
1521
|
-
this._gl
|
|
1549
|
+
if (this._gl) {
|
|
1550
|
+
this._gl.deleteProgram(webGLPipelineContext.program);
|
|
1551
|
+
}
|
|
1522
1552
|
}
|
|
1523
1553
|
}
|
|
1524
1554
|
/**
|
|
@@ -2284,20 +2314,26 @@ export class ThinEngine extends AbstractEngine {
|
|
|
2284
2314
|
*/
|
|
2285
2315
|
_createInternalTexture(size, options, delayGPUTextureCreation = true, source = 0 /* InternalTextureSource.Unknown */) {
|
|
2286
2316
|
let generateMipMaps = false;
|
|
2317
|
+
let createMipMaps = false;
|
|
2287
2318
|
let type = 0;
|
|
2288
2319
|
let samplingMode = 3;
|
|
2289
2320
|
let format = 5;
|
|
2290
2321
|
let useSRGBBuffer = false;
|
|
2291
2322
|
let samples = 1;
|
|
2292
2323
|
let label;
|
|
2324
|
+
let createMSAATexture = false;
|
|
2325
|
+
let comparisonFunction = 0;
|
|
2293
2326
|
if (options !== undefined && typeof options === "object") {
|
|
2294
2327
|
generateMipMaps = !!options.generateMipMaps;
|
|
2328
|
+
createMipMaps = !!options.createMipMaps;
|
|
2295
2329
|
type = options.type === undefined ? 0 : options.type;
|
|
2296
2330
|
samplingMode = options.samplingMode === undefined ? 3 : options.samplingMode;
|
|
2297
2331
|
format = options.format === undefined ? 5 : options.format;
|
|
2298
2332
|
useSRGBBuffer = options.useSRGBBuffer === undefined ? false : options.useSRGBBuffer;
|
|
2299
2333
|
samples = options.samples ?? 1;
|
|
2300
2334
|
label = options.label;
|
|
2335
|
+
createMSAATexture = !!options.createMSAATexture;
|
|
2336
|
+
comparisonFunction = options.comparisonFunction || 0;
|
|
2301
2337
|
}
|
|
2302
2338
|
else {
|
|
2303
2339
|
generateMipMaps = !!options;
|
|
@@ -2315,17 +2351,21 @@ export class ThinEngine extends AbstractEngine {
|
|
|
2315
2351
|
type = 0;
|
|
2316
2352
|
Logger.Warn("Float textures are not supported. Type forced to TEXTURETYPE_UNSIGNED_BYTE");
|
|
2317
2353
|
}
|
|
2354
|
+
const isDepthTexture = IsDepthTexture(format);
|
|
2355
|
+
const hasStencil = HasStencilAspect(format);
|
|
2318
2356
|
const gl = this._gl;
|
|
2319
2357
|
const texture = new InternalTexture(this, source);
|
|
2320
2358
|
const width = size.width || size;
|
|
2321
2359
|
const height = size.height || size;
|
|
2322
2360
|
const depth = size.depth || 0;
|
|
2323
2361
|
const layers = size.layers || 0;
|
|
2324
|
-
const filters = this._getSamplingParameters(samplingMode, generateMipMaps);
|
|
2362
|
+
const filters = this._getSamplingParameters(samplingMode, (generateMipMaps || createMipMaps) && !isDepthTexture);
|
|
2325
2363
|
const target = layers !== 0 ? gl.TEXTURE_2D_ARRAY : depth !== 0 ? gl.TEXTURE_3D : gl.TEXTURE_2D;
|
|
2326
|
-
const sizedFormat =
|
|
2327
|
-
|
|
2328
|
-
|
|
2364
|
+
const sizedFormat = isDepthTexture
|
|
2365
|
+
? this._getInternalFormatFromDepthTextureFormat(format, true, hasStencil)
|
|
2366
|
+
: this._getRGBABufferInternalSizedFormat(type, format, useSRGBBuffer);
|
|
2367
|
+
const internalFormat = isDepthTexture ? (hasStencil ? gl.DEPTH_STENCIL : gl.DEPTH_COMPONENT) : this._getInternalFormat(format);
|
|
2368
|
+
const textureType = isDepthTexture ? this._getWebGLTextureTypeFromDepthTextureFormat(format) : this._getWebGLTextureType(type);
|
|
2329
2369
|
// Bind
|
|
2330
2370
|
this._bindTextureDirectly(target, texture);
|
|
2331
2371
|
if (layers !== 0) {
|
|
@@ -2343,8 +2383,18 @@ export class ThinEngine extends AbstractEngine {
|
|
|
2343
2383
|
gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, filters.min);
|
|
2344
2384
|
gl.texParameteri(target, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
2345
2385
|
gl.texParameteri(target, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
2386
|
+
if (isDepthTexture && this.webGLVersion > 1) {
|
|
2387
|
+
if (comparisonFunction === 0) {
|
|
2388
|
+
gl.texParameteri(target, gl.TEXTURE_COMPARE_FUNC, 515);
|
|
2389
|
+
gl.texParameteri(target, gl.TEXTURE_COMPARE_MODE, gl.NONE);
|
|
2390
|
+
}
|
|
2391
|
+
else {
|
|
2392
|
+
gl.texParameteri(target, gl.TEXTURE_COMPARE_FUNC, comparisonFunction);
|
|
2393
|
+
gl.texParameteri(target, gl.TEXTURE_COMPARE_MODE, gl.COMPARE_REF_TO_TEXTURE);
|
|
2394
|
+
}
|
|
2395
|
+
}
|
|
2346
2396
|
// MipMaps
|
|
2347
|
-
if (generateMipMaps) {
|
|
2397
|
+
if (generateMipMaps || createMipMaps) {
|
|
2348
2398
|
this._gl.generateMipmap(target);
|
|
2349
2399
|
}
|
|
2350
2400
|
this._bindTextureDirectly(target, null);
|
|
@@ -2353,7 +2403,7 @@ export class ThinEngine extends AbstractEngine {
|
|
|
2353
2403
|
texture.baseHeight = height;
|
|
2354
2404
|
texture.width = width;
|
|
2355
2405
|
texture.height = height;
|
|
2356
|
-
texture.depth = layers;
|
|
2406
|
+
texture.depth = layers || depth;
|
|
2357
2407
|
texture.isReady = true;
|
|
2358
2408
|
texture.samples = samples;
|
|
2359
2409
|
texture.generateMipMaps = generateMipMaps;
|
|
@@ -2361,7 +2411,26 @@ export class ThinEngine extends AbstractEngine {
|
|
|
2361
2411
|
texture.type = type;
|
|
2362
2412
|
texture.format = format;
|
|
2363
2413
|
texture.label = label;
|
|
2414
|
+
texture.comparisonFunction = comparisonFunction;
|
|
2364
2415
|
this._internalTexturesCache.push(texture);
|
|
2416
|
+
if (createMSAATexture) {
|
|
2417
|
+
let renderBuffer = null;
|
|
2418
|
+
if (IsDepthTexture(texture.format)) {
|
|
2419
|
+
renderBuffer = this._setupFramebufferDepthAttachments(HasStencilAspect(texture.format), texture.format !== 19, texture.width, texture.height, samples, texture.format, true);
|
|
2420
|
+
}
|
|
2421
|
+
else {
|
|
2422
|
+
renderBuffer = this._createRenderBuffer(texture.width, texture.height, samples, -1 /* not used */, this._getRGBABufferInternalSizedFormat(texture.type, texture.format, texture._useSRGBBuffer), -1 /* attachment */);
|
|
2423
|
+
}
|
|
2424
|
+
if (!renderBuffer) {
|
|
2425
|
+
throw new Error("Unable to create render buffer");
|
|
2426
|
+
}
|
|
2427
|
+
texture._autoMSAAManagement = true;
|
|
2428
|
+
let hardwareTexture = texture._hardwareTexture;
|
|
2429
|
+
if (!hardwareTexture) {
|
|
2430
|
+
hardwareTexture = texture._hardwareTexture = this._createHardwareTexture();
|
|
2431
|
+
}
|
|
2432
|
+
hardwareTexture.addMSAARenderBuffer(renderBuffer);
|
|
2433
|
+
}
|
|
2365
2434
|
return texture;
|
|
2366
2435
|
}
|
|
2367
2436
|
/**
|
|
@@ -2757,22 +2826,42 @@ export class ThinEngine extends AbstractEngine {
|
|
|
2757
2826
|
}
|
|
2758
2827
|
return internalFormat;
|
|
2759
2828
|
}
|
|
2829
|
+
_getWebGLTextureTypeFromDepthTextureFormat(textureFormat) {
|
|
2830
|
+
const gl = this._gl;
|
|
2831
|
+
let type = gl.UNSIGNED_INT;
|
|
2832
|
+
if (textureFormat === 15) {
|
|
2833
|
+
type = gl.UNSIGNED_SHORT;
|
|
2834
|
+
}
|
|
2835
|
+
else if (textureFormat === 17 || textureFormat === 13) {
|
|
2836
|
+
type = gl.UNSIGNED_INT_24_8;
|
|
2837
|
+
}
|
|
2838
|
+
else if (textureFormat === 14) {
|
|
2839
|
+
type = gl.FLOAT;
|
|
2840
|
+
}
|
|
2841
|
+
else if (textureFormat === 18) {
|
|
2842
|
+
type = gl.FLOAT_32_UNSIGNED_INT_24_8_REV;
|
|
2843
|
+
}
|
|
2844
|
+
else if (textureFormat === 19) {
|
|
2845
|
+
type = gl.UNSIGNED_BYTE;
|
|
2846
|
+
}
|
|
2847
|
+
return type;
|
|
2848
|
+
}
|
|
2760
2849
|
/**
|
|
2761
2850
|
* @internal
|
|
2762
2851
|
*/
|
|
2763
|
-
_setupFramebufferDepthAttachments(generateStencilBuffer, generateDepthBuffer, width, height, samples = 1, depthTextureFormat) {
|
|
2852
|
+
_setupFramebufferDepthAttachments(generateStencilBuffer, generateDepthBuffer, width, height, samples = 1, depthTextureFormat, dontBindRenderBufferToFrameBuffer = false) {
|
|
2764
2853
|
const gl = this._gl;
|
|
2765
2854
|
depthTextureFormat = depthTextureFormat ?? (generateStencilBuffer ? 13 : 14);
|
|
2766
2855
|
const internalFormat = this._getInternalFormatFromDepthTextureFormat(depthTextureFormat, generateDepthBuffer, generateStencilBuffer);
|
|
2767
2856
|
// Create the depth/stencil buffer
|
|
2768
2857
|
if (generateStencilBuffer && generateDepthBuffer) {
|
|
2769
|
-
return this._createRenderBuffer(width, height, samples, gl.DEPTH_STENCIL, internalFormat, gl.DEPTH_STENCIL_ATTACHMENT);
|
|
2858
|
+
return this._createRenderBuffer(width, height, samples, gl.DEPTH_STENCIL, internalFormat, dontBindRenderBufferToFrameBuffer ? -1 : gl.DEPTH_STENCIL_ATTACHMENT);
|
|
2770
2859
|
}
|
|
2771
2860
|
if (generateDepthBuffer) {
|
|
2772
|
-
return this._createRenderBuffer(width, height, samples, internalFormat, internalFormat, gl.DEPTH_ATTACHMENT);
|
|
2861
|
+
return this._createRenderBuffer(width, height, samples, internalFormat, internalFormat, dontBindRenderBufferToFrameBuffer ? -1 : gl.DEPTH_ATTACHMENT);
|
|
2773
2862
|
}
|
|
2774
2863
|
if (generateStencilBuffer) {
|
|
2775
|
-
return this._createRenderBuffer(width, height, samples, internalFormat, internalFormat, gl.STENCIL_ATTACHMENT);
|
|
2864
|
+
return this._createRenderBuffer(width, height, samples, internalFormat, internalFormat, dontBindRenderBufferToFrameBuffer ? -1 : gl.STENCIL_ATTACHMENT);
|
|
2776
2865
|
}
|
|
2777
2866
|
return null;
|
|
2778
2867
|
}
|
|
@@ -2793,7 +2882,9 @@ export class ThinEngine extends AbstractEngine {
|
|
|
2793
2882
|
else {
|
|
2794
2883
|
gl.renderbufferStorage(gl.RENDERBUFFER, internalFormat, width, height);
|
|
2795
2884
|
}
|
|
2796
|
-
|
|
2885
|
+
if (attachment !== -1) {
|
|
2886
|
+
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, renderBuffer);
|
|
2887
|
+
}
|
|
2797
2888
|
if (unbindBuffer) {
|
|
2798
2889
|
gl.bindRenderbuffer(gl.RENDERBUFFER, null);
|
|
2799
2890
|
}
|