std.gpu: add instanceIndex

This commit is contained in:
Ali Cheraghi 2024-10-31 01:42:30 +03:30
parent c07b3c8279
commit 38345d5909
No known key found for this signature in database
GPG Key ID: 7AD1F6DBB6B5A0DA

View File

@ -47,6 +47,17 @@ pub fn vertexIndex(comptime ptr: *addrspace(.input) u32) void {
);
}
/// Will make `ptr` contain the index of the instance that is
/// being processed by the current vertex shader invocation.
/// `ptr` must be a reference to variable or struct field.
pub fn instanceIndex(comptime ptr: *addrspace(.input) u32) void {
asm volatile (
\\OpDecorate %ptr BuiltIn InstanceIndex
:
: [ptr] "" (ptr),
);
}
/// Output fragment depth from a `Fragment` entrypoint
/// `ptr` must be a reference to variable or struct field.
pub fn fragmentCoord(comptime ptr: *addrspace(.input) @Vector(4, f32)) void {