yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
9043bc552
master
1//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -g0 2//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -g0 3 4//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer 5RWStructuredBuffer<uint> outputBuffer; 6 7__target_intrinsic(hlsl, "@") 8__target_intrinsic(glsl, "@") 9__target_intrinsic(cpp, "@") 10__target_intrinsic(cuda, "@") 11[__readNone] 12int produceSyntaxError() { return 0; } 13 14[numthreads(1, 1, 1)] 15void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID) 16{ 17 int sum = 0; 18 int array[100]; 19 // Next, this loop will be removed because there is no use of `array`. 20 for (int i = 0; i < 100; i++) 21 { 22 // This loop must be removed, or we will fail downstream compilation. 23 array[i] = i + produceSyntaxError(); 24 } 25 26 // First, this loop will be removed because there is no use of `sum`. 27 for (int i = 0; i < 100; i++) 28 { 29 // This loop must be removed, or we will fail downstream compilation. 30 if (i < 50) 31 { 32 sum += array[i] + produceSyntaxError(); 33 } 34 else 35 { 36 sum += i * 2 + produceSyntaxError(); 37 } 38 } 39 outputBuffer[0] = 1; 40}