API

Class WebGPURenderTargetWrapper

Specialized class used to store a render target of a WebGPU engine

Hierarchy (View Summary)

Index
depthReadOnly: boolean = false

Indicates if the depth texture is in read-only mode (may allow some optimizations in WebGPU)

disableAutomaticMSAAResolve: boolean = false

Sets this property to true to disable the automatic MSAA resolve that happens when the render target wrapper is unbound (default is false)

gpuTimeInFrame?: WebGPUPerfCounter

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.

label?: string

Gets or sets the label of the render target wrapper (optional, for debugging purpose)

resolveMSAAColors: boolean = true

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()

resolveMSAADepth: boolean = false

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)

resolveMSAAStencil: boolean = false

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)

stencilReadOnly: boolean = false

Indicates if the stencil texture is in read-only mode (may allow some optimizations in WebGPU)

  • Creates 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: string

      defines the label to use for the texture (for debugging purpose only)

    Returns InternalTexture

    the depth/stencil created texture

  • 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

  • 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: number

      The layer of the texture to be set

    • Optionalface: number

      The face of the texture to be set

    Returns void

  • 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