Class WebGPURenderTargetWrapper
Hierarchy (View Summary)
- RenderTargetWrapper
- WebGPURenderTargetWrapper
Constructors
constructor
-
new WebGPURenderTargetWrapper(
isMulti: boolean,
isCube: boolean,
size: TextureSize,
engine: ThinWebGPUEngine,
label?: string,
): WebGPURenderTargetWrapperInitializes the render target wrapper
Parameters
- isMulti: boolean
true if the wrapper is a multi render target
- isCube: boolean
true if the wrapper should render to a cube texture
- size: TextureSize
size of the render target (width/height/layers)
- engine: ThinWebGPUEngine
engine used to create the render target
Optionallabel: stringdefines the label to use for the wrapper (for debugging purpose only)
Returns WebGPURenderTargetWrapper
- isMulti: boolean
Properties
depth Read Only
Indicates if the depth texture is in read-only mode (may allow some optimizations in WebGPU)
disable Automatic MSAA Resolve
Sets this property to true to disable the automatic MSAA resolve that happens when the render target wrapper is unbound (default is false)
Optional Readonlygpu Time In Frame
Gets the GPU time spent rendering this render target in the last frame (in nanoseconds). You have to enable the "timestamp-query" extension in the engine constructor options and set engine.enableGPUTimingMeasurements = true.
Optionallabel
Gets or sets the label of the render target wrapper (optional, for debugging purpose)
resolve MSAA Colors
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) Note that you can trigger a MSAA resolve at any time by calling resolveMSAATextures()
resolve MSAA Depth
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)
resolve MSAA Stencil
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)
stencil Read Only
Indicates if the stencil texture is in read-only mode (may allow some optimizations in WebGPU)
Accessors
depth
-
get depth(): number
Gets the depth of the render target wrapper (only used if is3D is true and wrapper is not a multi render target)
Returns number
depth Stencil Texture
-
Gets the depth/stencil texture
Returns Nullable<InternalTexture>
depth Stencil Texture With Stencil
-
get depthStencilTextureWithStencil(): boolean
Indicates if the depth/stencil texture has a stencil aspect
Returns boolean
face Indices
-
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
Returns Nullable<number[]>
height
-
get height(): number
Gets the height of the render target wrapper
Returns number
is2 D Array
-
get is2DArray(): boolean
Defines if the render target wrapper is for a single or an array of textures
Returns boolean
is3 D
-
get is3D(): boolean
Defines if the render target wrapper is for a 3D texture
Returns boolean
is Cube
-
get isCube(): boolean
Defines if the render target wrapper is for a cube texture or if false a 2d texture
Returns boolean
is Multi
-
get isMulti(): boolean
Defines if the render target wrapper is for a single or multi target render wrapper
Returns boolean
layer Indices
-
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
Returns Nullable<number[]>
layers
-
get layers(): number
Gets the number of layers of the render target wrapper (only used if is2DArray is true and wrapper is not a multi render target)
Returns number
samples
-
get samples(): number
Gets the sample count of the render target
Returns number
size
-
get size(): number
Gets the size of the render target wrapper (used for cubes, as width=height in this case)
Returns number
texture
-
Gets the render texture. If this is a multi render target, gets the first texture
Returns Nullable<InternalTexture>
textures
-
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)
Returns Nullable<InternalTexture[]>
width
-
get width(): number
Gets the width of the render target wrapper
Returns number
Methods
_ share Depth
-
Parameters
- renderTarget: RenderTargetWrapper
Destination renderTarget
Returns void
- renderTarget: RenderTargetWrapper
create Depth Stencil Texture
-
createDepthStencilTexture(
comparisonFunction?: number,
bilinearFiltering?: boolean,
generateStencil?: boolean,
samples?: number,
format?: number,
label?: string,
): InternalTextureCreates the depth/stencil texture
Parameters
- comparisonFunction: number = 0
Comparison function to use for the texture
- bilinearFiltering: boolean = true
true if bilinear filtering should be used when sampling the texture
- generateStencil: boolean = false
Not used anymore. "format" will be used to determine if stencil should be created
- samples: number = 1
sample count to use when creating the texture (default: 1)
- format: number = Constants.TEXTUREFORMAT_DEPTH32_FLOAT
format of the depth texture (default: Constants.TEXTUREFORMAT_DEPTH32_FLOAT)
Optionallabel: stringdefines the label to use for the texture (for debugging purpose only)
Returns InternalTexture
the depth/stencil created texture
- comparisonFunction: number = 0
dispose
-
Disposes the whole render target wrapper
Parameters
- disposeOnlyFramebuffers: boolean = false
true if only the frame buffers should be released (used for the WebGL engine). If false, all the textures will also be released
Returns void
- disposeOnlyFramebuffers: boolean = false
generate Mip Maps
-
Generates mipmaps for each texture of the render target
Returns void
get Base Array Layer
-
Gets the base array layer of a texture in the textures array This is an number that is calculated based on the layer and face indices set for this texture at that index
Parameters
- index: number
The index of the texture in the textures array to get the base array layer for
Returns number
the base array layer of the texture at the given index
- index: number
release Textures
-
Releases the internal render textures
Returns void
resolve MSAA Textures
-
Resolves the MSAA textures into their non-MSAA version. Note that if samples equals 1 (no MSAA), no resolve is performed.
Returns void
set Depth Stencil Texture
-
Sets the depth/stencil texture
Parameters
- texture: Nullable<InternalTexture>
The depth/stencil texture to set
- disposeExisting: boolean = true
True to dispose the existing depth/stencil texture (if any) before replacing it (default: true)
Returns void
- texture: Nullable<InternalTexture>
set Layer And Face Index
-
Sets the layer and face indices of a texture in the textures array that should be bound to each color attachment
Parameters
- index: number = 0
The index of the texture in the textures array to modify
Optionallayer: numberThe layer of the texture to be set
Optionalface: numberThe face of the texture to be set
Returns void
- index: number = 0
set Layer And Face Indices
-
Sets the layer and face indices of every render target texture bound to each color attachment
Parameters
- layers: number[]
The layers of each texture to be set
- faces: number[]
The faces of each texture to be set
Returns void
- layers: number[]
set Samples
-
Sets the sample count of the render target
Parameters
- value: number
sample count
- initializeBuffers: boolean = true
If set to true, the engine will make an initializing call to drawBuffers (only used when isMulti=true).
- force: boolean = false
true to force calling the update sample count engine function even if the current sample count is equal to value
Returns number
the sample count that has been set
- value: number
set Texture
-
Set a texture in the textures array
Parameters
- texture: InternalTexture
The texture to set
- index: number = 0
The index in the textures array to set
- disposePrevious: boolean = true
If this function should dispose the previous texture
Returns void
- texture: InternalTexture
set Textures
-
Sets the render target texture(s)
Parameters
- textures: InternalTexture | InternalTexture[] | null
texture(s) to set
Returns void
- textures: InternalTexture | InternalTexture[] | null
share Depth
-
Shares the depth buffer of this render target with another render target.
Parameters
- renderTarget: RenderTargetWrapper
Destination renderTarget
Returns void
- renderTarget: RenderTargetWrapper
Specialized class used to store a render target of a WebGPU engine