Class: Gfx3StaticGroup
The `Gfx3StaticGroup` class represents a group of static graphics resources, such as uniforms and
textures, that can be bound to a GPU render pipeline. It is called static because there is only one
possible allocation for this data-set (related to static-size of 1).
Constructors
- new Gfx3StaticGroup(device: GPUDevice, pipeline: GPURenderPipeline, groupIndex: number): Gfx3StaticGroup
This constructor.
- device: The `device` parameter is an instance of the `GPUDevice` class. It
represents the GPU device that will be used for rendering.
- pipeline: The `pipeline` parameter is the graphics pipeline that will be used for rendering.
- groupIndex: The `groupIndex` parameter is used to identify which shader group is used
to binding the uniform buffer and textures to the GPU.
Methods
- allocate(): void
The "allocate" function creates a bind group with the provided uniforms and textures entries.
- beginWrite(): void
The "beginWrite" function prepare the uniform buffer to write process.
- destroy(): void
The "destroy" function destroys uniforms buffer.
Warning: you need to call this method to free allocation for this object.
- endWrite(): void
The `endWrite` function close the write process.
- getBindGroup(): GPUBindGroup
The "getBindGroup" function returns the bind group.
- setFloat(binding: number, name: string, length: number): Float32Array
The "setFloat" function sets a float bindgroup entry and returns a Float32Array of the specified
length.
- binding: The `binding` parameter is a number that represents the binding index.
It is used to identify the specific uniform in the shader program.
- name: The `name` parameter is a string that represents the name of the uniform variable.
It is used for identification purposes and can be any string value.
- length: The `length` parameter represents the number of float elements in the
uniform.
- setInteger(binding: number, name: string, length: number): Uint32Array
The "setInteger" function sets a integer bindgroup entry and returns a Uint32Array of the specified
length.
- binding: The `binding` parameter is a number that represents the binding index.
It is used to identify the specific uniform in the shader program.
- name: The `name` parameter is a string that represents the name of the uniform variable.
It is used for identification purposes and can be any string value.
- length: The `length` parameter represents the number of integer elements in the
uniform.
- setTexture(binding: number, name: string, texture: Gfx3Texture, createViewDescriptor: GPUTextureViewDescriptor): Gfx3Texture
The "setTexture" function sets a texture and sampler resource for a given bindgroup entry.
- binding: The `binding` parameter is a number that represents the binding index.
It is used to identify the specific uniform in the shader program.
- name: The name of the texture. It is used for identification purposes and can be
any string value.
- texture: The `texture` parameter is of type `Gfx3Texture`.
- createViewDescriptor: The `createViewDescriptor` parameter is an
optional object that contains properties used to create a GPUTextureViewDescriptor. This descriptor
is used to specify how the texture view should be created, such as the format, dimension, and mip
level range of the view.
- write(index: number, data): void
The "write" function writes data to a buffer and updates the current offset.
Warning: You need to call this method before write your data.
- index: The binding index of uniform. It is used for identification purposes and can be
any number value.
- data: The `data` parameter can be either a `Float32Array` or a
`Uint32Array`. It represents the data that will be written to the buffer.