yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
7dabfa76c
master
1//TEST(compute):COMPARE_COMPUTE:-cpu -shaderobj 2//TEST(compute):COMPARE_COMPUTE: -shaderobj 3 4// Test that `break` from a loop works. 5 6int test(int inVal) 7{ 8 int ii = 0; 9 for(;;) 10 { 11 if(ii >= inVal) 12 break; 13 ii++; 14 } 15 return -ii; 16} 17 18//TEST_INPUT:ubuffer(data=[0 1 2 3], stride=4):out,name=outputBuffer 19RWStructuredBuffer<int> outputBuffer; 20 21[numthreads(4, 1, 1)] 22void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 23{ 24 uint tid = dispatchThreadID.x; 25 int inVal = outputBuffer[tid]; 26 int outVal = test(inVal); 27 outputBuffer[tid] = outVal; 28}