AdvancedThe structs and groups extracted from the shader source, typically produced by extractStructAndGroups.
Defines the structure of the extracted WGSL structs and groups.
The generated bind group layout description, one entry array per bind group.
import { extractStructAndGroups, generateGpuLayoutGroups, GpuProgram } from 'pixi.js';
const gpuLayout = generateGpuLayoutGroups(extractStructAndGroups(source));
// only expose this texture to the fragment stage
gpuLayout[0][1].visibility = GPUShaderStage.FRAGMENT;
const program = new GpuProgram({ vertex, fragment, gpuLayout });
Generates the default WebGPU bind group layout for a shader from its extracted structs and groups. Every binding is marked visible to both the vertex and fragment stages (
GPUShaderStage.VERTEX | GPUShaderStage.FRAGMENT).This is the same generator GpuProgram uses internally when no
gpuLayoutis supplied. It is exported so you can build the default layout, tweak only the entries you care about (for example narrowing a binding'svisibilityto a single stage), and pass the complete result back in via thegpuLayoutoption - rather than hand-authoring the whole layout: