yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
712ce653d
master
1// multiple-namespace.slang 2 3//TEST(compute):COMPARE_COMPUTE: -shaderobj 4 5// Multiple namespace open/closing 6 7namespace A 8{ 9 struct Struct1 10 { 11 int a; 12 } 13} 14 15namespace A 16{ 17 struct Struct2 18 { 19 int b; 20 } 21} 22 23namespace A 24{ 25 struct Struct3 26 { 27 int c; 28 } 29} 30 31// A few more 32 33namespace A {} 34namespace A {} 35namespace A { namespace A {} } 36 37int test(int val) 38{ 39 A.Struct1 s1 = {}; 40 A::Struct2 s2 = { val }; 41 A.Struct3 s3 = { val * val }; 42 43 return s1.a + s2.b + s3.c; 44} 45 46//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer 47RWStructuredBuffer<int> outputBuffer; 48 49[numthreads(4, 1, 1)] 50void computeMain(int3 dispatchThreadID : SV_DispatchThreadID) 51{ 52 int tid = dispatchThreadID.x; 53 int inVal = tid; 54 int outVal = test(inVal); 55 outputBuffer[tid] = outVal; 56}