yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
c5b0708ea
master
1//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -vk 2//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj 3//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -cpu 4 5//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0], stride=4):out,name outputBuffer 6RWStructuredBuffer<uint> outputBuffer; 7 8 9void silly<T : __BuiltinIntegerType>(T a, inout T b) 10{ 11 b *= a; 12} 13 14void silly2<T : __BuiltinIntegerType>(T a, out T b) 15{ 16 b = a; 17} 18 19 20[numthreads(4, 1, 1)] 21void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 22{ 23 int v = 0; 24 uint u = 0; 25 26 int idx = int(dispatchThreadID.x); 27 uint uidx = uint(idx); 28 29 v += uidx; 30 u += idx; 31 32 silly(u, v); 33 silly(v, u); 34 35 // Check that detects issues with undefined variables. 36 37 int undef1, undef2; // undefined 38 39 // Downstream compilers detect this... 40 //silly(u, undef1); 41 silly2(u, undef2); 42 43 outputBuffer[idx] = u + v + undef2; 44}