Class: Gfx3DynamicGroup
The `Gfx3DynamicGroup` class represents a group of dynamic graphics resources, such as uniforms
that can be bound to a GPU render pipeline. It is called dynamic because we are not limited to one
possible allocation like static-group but as many you need for this data-set (related to dynamic-size of n).
Constructors
- new Gfx3DynamicGroup(device: GPUDevice, pipeline: GPURenderPipeline, groupIndex: number): Gfx3DynamicGroup
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(size: number): void
The `allocate` function creates n-size bind groups with the provided uniforms entries.
- size: The `size` parameter in the `allocate` function is the number of bind
groups to allocate. It determines how many bind groups will be created and stored in the
`bindGroups` array. Each bind group represents a set of resources that can be bound to a shader
pipeline for rendering.
- beginWrite(): void
The "beginWrite" function prepare the uniform buffer to write process.
- delete(): 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(i: number): GPUBindGroup
The getBindGroup function returns the bind group at index i.
- getSize(): number
The "getSize" function returns the number of bindgroups.
- 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.
- 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.