Skip to main content

Module generator

Module generator 

Source
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)

§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§

TextureGenerator
GPU-based procedural texture generator.
TextureKey
Key used for procedural texture caching.
TextureParams
Parameters passed to procedural texture generation shaders.

Constants§

NOTEX_SHADER