yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
53684ed91
master
1//TEST:SIMPLE(filecheck=CHECK): -target wgsl 2 3RWStructuredBuffer<float> outputBuffer; 4 5// CHECK: fn inner{{.*}}( x{{.*}} : ptr<function, f32>) 6// CHECK: (*x{{.*}}) = (*x{{.*}}) + 1.0 7void inner(inout float x) 8{ 9 x = x + 1; 10} 11 12// CHECK: fn test{{.*}}( x{{.*}} : ptr<function, f32>) 13void test(inout float x) 14{ 15 inner(x); 16} 17 18struct MyType 19{ 20 float myField[3]; 21} 22 23[numthreads(1,1,1)] 24void computeMain(int id : SV_DispatchThreadID) 25{ 26 MyType v; 27 v.myField[id] = 0.0f; 28 // CHECK: test{{.*}}(&({{.*}})); 29 test(v.myField[id]); 30 v.myField[1] = 2.0; 31 outputBuffer[0] = v.myField[id]; 32}