#syntax help with SPIRV zig shader coding
1 messages · Page 1 of 1 (latest)
You should check issues to see how finished SPIRV support is, and to answer your questions, you can import vertex ID from std.gpu. Check the docs:
https://ziglang.org/documentation/master/std/#std.gpu
- a SSBO/structured buffer: you can but it has to be done all in assembly until we get either
@SpirvType()or@Opaque() - GPU constants such as processed vertex ID: see
std.gpu - a matrix: no matrix support planned. use array of vectors
- a uniform buffer:
const UBO = extern struct {
object_color: @Vector(4, f32),
light_color: @Vector(4, f32),
};
extern const ubo: UBO addrspace(.uniform);
overall, i don't recommend using it for now unless for experiment
I see, i'll save zig shaders for another year then, thanks for the info.
So the plan is to allow the same matrix math library in both shader and the rest of the program?
yes. e.g. zmath just works