authorgravatar for alichraghi@proton.meAli Chraghi <alichraghi@proton.me> 2024-10-31 01:42:30+03:30
committergravatar for alichraghi@proton.meAli Chraghi <alichraghi@proton.me> 2024-11-01 02:04:27+03:30
log38345d590949b0c88d83bccb259364f02a59a90e
treedabeed95f72bfa1bdc41ba5ea24753d4e90ce0a1
parentc07b3c8279def54c0cea5b12f5970c44cd2562dd
signaturelock-open Commit is signed but in an unrecognized format.

std.gpu: add `instanceIndex`


1 files changed, 11 insertions(+), 0 deletions(-)

lib/std/gpu.zig+11
...@@ -47,6 +47,17 @@ pub fn vertexIndex(comptime ptr: *addrspace(.input) u32) void {...@@ -47,6 +47,17 @@ pub fn vertexIndex(comptime ptr: *addrspace(.input) u32) void {
47 );47 );
48}48}
4949
50/// Will make `ptr` contain the index of the instance that is
51/// being processed by the current vertex shader invocation.
52/// `ptr` must be a reference to variable or struct field.
53pub fn instanceIndex(comptime ptr: *addrspace(.input) u32) void {
54 asm volatile (
55 \\OpDecorate %ptr BuiltIn InstanceIndex
56 :
57 : [ptr] "" (ptr),
58 );
59}
60
50/// Output fragment depth from a `Fragment` entrypoint61/// Output fragment depth from a `Fragment` entrypoint
51/// `ptr` must be a reference to variable or struct field.62/// `ptr` must be a reference to variable or struct field.
52pub fn fragmentCoord(comptime ptr: *addrspace(.input) @Vector(4, f32)) void {63pub fn fragmentCoord(comptime ptr: *addrspace(.input) @Vector(4, f32)) void {