yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
cdfea42f1
master
1//TEST(smoke,compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -shaderobj -output-using-type 2 3// CHECK: 4 4// CHECK-NEXT: 99 5// CHECK-NEXT: 111 6// CHECK-NEXT: 40 7 8//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer 9RWStructuredBuffer<int> outputBuffer; 10 11[numthreads(1, 1, 1)] 12void computeMain() 13{ 14 outputBuffer[0] = f(); 15 outputBuffer[1] = g(); 16 outputBuffer[2] = h(); 17 outputBuffer[3] = k(30, 40); 18} 19 20static let x = 1; 21 22func f() -> int 23{ 24 let y = x; // should refer to the global x 25 let x = 3; 26 return x + y; // should refer to the local x 27} 28func g() -> int 29{ 30 // Can we shadow this keyword 31 int out; 32 out = 99; 33 return out; 34} 35 36static var input = 999; 37func h() -> int 38{ 39 // This should still parse as an identifier (it's a keyword, being shadowed 40 // by something in a parent scope) 41 input = 10; 42 int input = input; 43 input += 101; 44 return input; 45} 46 47int k(int a, int b) 48{ 49 int umax = max(a, b); 50 51 int max = umax; 52 return max; 53}