Class: BindGroup
Defined in: node_modules/pixi.js/lib/rendering/renderers/gpu/shader/BindGroup.d.ts:29
A bind group is a collection of resources that are bound together for use by a shader. They are essentially a wrapper for the WebGPU BindGroup class. But with the added bonus that WebGL can also work with them.
See
https://gpuweb.github.io/gpuweb/#dictdef-gpubindgroupdescriptor
Example
// Create a bind group with a single texture and sampler
const bindGroup = new BindGroup({
uTexture: texture.source,
uTexture: texture.style,
});
Bind groups resources must implement the {@link BindResource} interface.
The following resources are supported:
- {@link TextureSource}
- {@link TextureStyle}
- {@link Buffer}
- {@link BufferResource}
- {@link UniformGroup}
The keys in the bind group must correspond to the names of the resources in the GPU program.
This bind group class will also watch for changes in its resources ensuring that the changes
are reflected in the WebGPU BindGroup.
Advanced
Constructors
Constructor
> new BindGroup(resources?): BindGroup
Defined in: node_modules/pixi.js/lib/rendering/renderers/gpu/shader/BindGroup.d.ts:42
Create a new instance eof the Bind Group.
Parameters
resources?
Record<string, BindResource>
The resources that are bound together for use by a shader.
Returns
BindGroup
Properties
_key
> _key: string
Defined in: node_modules/pixi.js/lib/rendering/renderers/gpu/shader/BindGroup.d.ts:36
Internal
a key used internally to match it up to a WebGPU Bindgroup
resources
> resources: Record<string, BindResource>
Defined in: node_modules/pixi.js/lib/rendering/renderers/gpu/shader/BindGroup.d.ts:31
The resources that are bound together for use by a shader.
Methods
_touch()
> _touch(now, tick): void
Defined in: node_modules/pixi.js/lib/rendering/renderers/gpu/shader/BindGroup.d.ts:70
Internal
Used internally to 'touch' each resource, to ensure that the GC knows that all resources in this bind group are still being used.
Parameters
now
number
The current time in milliseconds.
tick
number
The current tick.
Returns
void
_updateKey()
> _updateKey(): void
Defined in: node_modules/pixi.js/lib/rendering/renderers/gpu/shader/BindGroup.d.ts:48
Internal
Updates the key if its flagged as dirty. This is used internally to match this bind group to a WebGPU BindGroup.
Returns
void
destroy()
> destroy(): void
Defined in: node_modules/pixi.js/lib/rendering/renderers/gpu/shader/BindGroup.d.ts:72
Destroys this bind group and removes all listeners.
Returns
void
getResource()
> getResource(index): BindResource
Defined in: node_modules/pixi.js/lib/rendering/renderers/gpu/shader/BindGroup.d.ts:62
Returns the resource at the current specified index.
Parameters
index
number
The index of the resource to get.
Returns
- The resource at the specified index.
onResourceChange()
> protected onResourceChange(resource): void
Defined in: node_modules/pixi.js/lib/rendering/renderers/gpu/shader/BindGroup.d.ts:73
Parameters
resource
Returns
void
setResource()
> setResource(resource, index): void
Defined in: node_modules/pixi.js/lib/rendering/renderers/gpu/shader/BindGroup.d.ts:56
Set a resource at a given index. this function will ensure that listeners will be removed from the current resource and added to the new resource.
Parameters
resource
The resource to set.
index
number
The index to set the resource at.
Returns
void