Expand description
§Procedural texture shader contract
Procedural textures are generated using WGSL compute shaders. Each shader must follow this binding layout exactly:
§Bind group layout
-
@group(0) @binding(0)texture_storage_2d<rgba8unorm, write>- Destination texture for the current mip level
-
@group(0) @binding(1)- Uniform buffer containing
TextureParams
- Uniform buffer containing
§Entry point
@compute
@workgroup_size(8, 8, 1)
fn main(@builtin(global_invocation_id) id: vec3<u32>) { ... }§Mip generation
The compute shader is dispatched once per mip level. The destination texture view always refers to the current mip only.
§Resolution
The shader must infer pixel coordinates from
global_invocation_id.xy and must not write out of bounds.
Structs§
- Texture
Generator - GPU-based procedural texture generator.
- Texture
Key - Key used for procedural texture caching.
- Texture
Params - Parameters passed to procedural texture generation shaders.