colinmarc
colinmarc

Reputation: 2471

Vulkan specialization constants in WGSL

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?

Upvotes: 0

Views: 158

Answers (1)

dj2
dj2

Reputation: 9618

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

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

Upvotes: 1

Related Questions