Files
wsg/lib/src/shaders
Jérôme Bousquié 82ea16d118 re-org en App
2026-07-07 16:42:37 +02:00
..
2026-07-07 16:42:37 +02:00
2026-07-07 16:42:37 +02:00

Shaders Directory

Overview

Contains WGSL shader source files used by the PipelineCache module. These are loaded at runtime from disk when referenced by their registered ID in PipelineCache.register_shader(). If a file is missing, PipelineCache falls back to the embedded BASIC_SHADER constant defined in utils::conf.

File Purpose
basic_shader.wgsl Default vertex/fragment shader pair (vs_main / fs_main entry points) with position, normal, UV, and color attributes matching the Vertex struct layout.

Shader Contract

The WGSL shader must define:

  • @vertex fn vs_main() -> @builtin(position) vec4<f32> — vertex entry point
  • @fragment fn fs_main() -> @location(0) vec4<f32> — fragment entry point writing RGBA output
  • Vertex input attributes matching the 56-byte stride of resources::Vertex:
    • @location(0) → position [f32; 3] (offset 0)
    • @location(1) → normal [f32; 3] (offset 12)
    • @location(2) → uv [f32; 2] (offset 24)
    • @location(3) → color [f32; 4] (offset 32)