A uniform buffer represents a GPU memory buffer storing the uniforms.

Constructors

  • Create a new UniformBuffer instance.

    Parameters

    • graphicsDevice: GraphicsDevice

      The graphics device used to manage this uniform buffer.

    • format: UniformBufferFormat

      Format of the uniform buffer.

    • Optionalpersistent: boolean = true

      Whether the buffer is persistent. Defaults to true.

    Returns UniformBuffer

Properties

persistent: boolean
renderVersionDirty: number = 0

A render version used to track the last time the properties requiring bind group to be updated were changed.

storageFloat32: Float32Array
storageInt32: Int32Array
storageUint32: Uint32Array

Methods

  • Assign a value to the uniform specified by its format. This is the fast version of assigning a value to a uniform, avoiding any lookups.

    Parameters

    • uniformFormat: UniformFormat

      The format of the uniform.

    • value: any

      The value to assign to the uniform.

    Returns void

  • Parameters

    • OptionaldynamicBindGroup: DynamicBindGroup

      The function fills in the info about the dynamic bind group for this frame, which uses this uniform buffer. Only used if the uniform buffer is non-persistent. This allows the uniform buffer to be used without having to create a bind group for it. Note that the bind group can only contains this single uniform buffer, and no other resources.

    Returns void