yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
712ce653d
master
1//TEST(compute):COMPARE_COMPUTE: -shaderobj -output-using-type 2 3struct PlusOne<let v : int> 4{ 5 static const int value = v > 0? v + 1 : v - 1; 6} 7 8struct GetConst<let v : int, let u : int> 9{ 10 static const int value = (u/2+v)*(u+v) / PlusOne<u-1>.value; 11 int arr[value]; 12} 13 14//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer 15RWStructuredBuffer<int> outputBuffer; 16 17[numthreads(4, 1, 1)] 18void computeMain(int3 dispatchThreadID : SV_DispatchThreadID) 19{ 20 int tid = dispatchThreadID.x; 21 int inVal = tid; 22 int arr[GetConst<5, 2>.value + 1]; 23 GetConst<5, 3> obj; 24 obj.arr[0] = GetConst<5, 3>.value + 1; 25 outputBuffer[tid] = obj.arr[0]; 26}