yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
712ce653d
master
1//TEST(compute):COMPARE_COMPUTE: -shaderobj -output-using-type 2//TEST(compute):COMPARE_COMPUTE: -vk -shaderobj -output-using-type 3 4struct S 5{ 6 int4 data; 7 __subscript(int x, int y) -> int 8 { 9 [__unsafeForceInlineEarly] get { return data[y * 2 + x]; } 10 [__unsafeForceInlineEarly] set { data[y * 2 + x] = newValue;} 11 } 12} 13 14int test() 15{ 16 S s = {}; 17 s[1, 0] = 1; 18 s[1, 1] = 2; 19 let b = s[1, 0] + s[1, 1]; 20 return b; 21} 22 23//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer 24RWStructuredBuffer<int> outputBuffer; 25 26[numthreads(4, 1, 1)] 27void computeMain(int3 dispatchThreadID: SV_DispatchThreadID) 28{ 29 int tid = dispatchThreadID.x; 30 outputBuffer[tid] = test(); 31}