Vulkan specialization constants in WGSL

28 views Asked by At

I'm converting my shaders from GLSL to WGSL. I'm a little bit confused about how to define Vulkan Specialization Constants in the WGSL shader language.

In GLSL, for example, I might write:

layout (constant_id = 2) const float foobar = 0.1f;

What's the equivalent syntax in WGSL, or is this unsupported by the language?

1

There are 1 answers

0
dj2 On

I believe you're looking for override declarations. (https://www.w3.org/TR/WGSL/#override-decls)

@id(2) override foobar: f32 = 0.1f