wgsl-no-imports

star 0

Titan WGSL shaders are self-contained — no

Solidor777 By Solidor777 schedule Updated 6/15/2026

name: wgsl-no-imports description: Titan WGSL shaders are self-contained — no #import, #include, or module system. All shared helper functions must be inlined in each shader file. Do not write import directives. source: auto-skill extracted_at: '2026-06-15T04:10:33.966Z'

WGSL — no imports, self-contained shaders

Titan's WGSL shaders do not use any import/include/module system. Each .wgsl file is fully self-contained. Shared helper functions (edge-stop weights, pack/unpack, luminance) must be inlined in each shader that needs them.

Why: Titan uses naga_oil for shader preprocessing but does not enable its import system. No #import or #include directives are used anywhere in the existing shader corpus. The compilation path is include_str!("shaders/foo.wgsl") → raw WGSL string → wgpu create_shader_module.

How to apply:

  • Write shared helpers in a reference file (e.g. reblur_common.wgsl) as documentation, then copy-paste the needed functions into each shader.
  • A reblur_common.wgsl file that's never compiled serves as the canonical source of truth for formulas; individual shaders carry inlined copies.
  • Do NOT write #import reblur_common; or any similar directive — Titan has no mechanism to resolve it and the shader will fail to compile.

Correct pattern:

// In reblur_preblur.wgsl — INLINE the helpers:
fn luminance(rgb: vec3<f32>) -> f32 {
    return dot(rgb, vec3(0.2126, 0.7152, 0.0722));
}

@compute @workgroup_size(8, 8)
fn main(@builtin(global_invocation_id) gid: vec3<u32>) {
    let l = luminance(center.rgb);
    // ...
}

Wrong pattern:

#import reblur_common;  // No such mechanism — will fail
Install via CLI
npx skills add https://github.com/Solidor777/Titan --skill wgsl-no-imports
Repository Details
star Stars 0
call_split Forks 0
navigation Branch main
article Path SKILL.md
More from Creator