yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
b423ea55b
master
1//TEST:SIMPLE_LINE:-entry computeMain -target spirv -stage compute -emit-spirv-via-glsl 2//TEST:SIMPLE_LINE:-entry computeMain -target dxil -profile cs_6_0 3//TEST:SIMPLE_LINE:-entry computeMain -target dxbc -stage compute 4//TEST:SIMPLE_LINE:-entry computeMain -target shader-dll -stage compute 5//TEST:SIMPLE_LINE:-entry computeMain -capability cuda_sm_8_0 -target ptx -stage compute 6//TEST:SIMPLE_LINE(filecheck=CHECK):-entry computeMain -target spirv -stage compute -emit-spirv-via-glsl 7 8//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer 9RWStructuredBuffer<int> outputBuffer; 10 11int doThing(int a, int b) 12{ 13 while (b >= 0) 14 { 15 a 16 += 17 a; 18 } 19 20 return a; 21} 22 23[numthreads(4, 1, 1)] 24void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 25{ 26 int a = int(dispatchThreadID.x); 27 int b = int(dispatchThreadID.y); 28 int c = int(dispatchThreadID.z); 29 int d = a + b * c; 30 int e = d + c / 2; 31 32 for (int i = 0; i < b; ++i) 33 { 34 if (e > 10 && (i & 2) != 0) 35 { 36 a += b; b -= c; c += c; d = d + e + a; e = a; 37 } 38 else 39 { 40 a = e; b = c + c; d += d + __SyntaxError(); e = doThing(e, int(dispatchThreadID.x)); 41 // CHECK: [[#@LINE-1]] 42 43 } 44 } 45 46 outputBuffer[dispatchThreadID.x] = a + b + c + d + e; 47}