I need to be able to use specialization constants in my zig shader, and am currently unable to figure out how to do so.
glsl I am trying to replicate:
layout(constant_id = 0) const uint spec_const = 0;
I need to be able to use specialization constants in my zig shader, and am currently unable to figure out how to do so.
glsl I am trying to replicate:
layout(constant_id = 0) const uint spec_const = 0;
inline asm can do the job. i think im gonna add something like this to std.spirv
pub fn specConst(T: type, comptime spec_id: u32) T {
return asm volatile (
\\%ret = OpSpecConstant %ty 0
\\OpDecorate %ret SpecId $spec_id
: [ret] "" (-> T),
: [ty] "t" (T),
[spec_id] "c" (spec_id),
);
}
export fn main() callconv(.kernel) void {
_ = specConst(u32, 0);
}