yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
7dabfa76c
master
1// gh-775.slang 2//TEST(compute):COMPARE_COMPUTE: -shaderobj 3 4int test(int inVal) 5{ 6 float4x4 identity = { 7 1, 0, 0, 0, 8 0, 1, 0, 0, 9 0, 0, 1, 0, 10 0, 0, 0, 1 11 }; 12 13 float4 v = float4(inVal, inVal+1, inVal+2, inVal+3); 14 15 v = mul(identity, v); 16 17 return int(dot(v, float4(1, 16, 256, 4096))); 18} 19 20//TEST_INPUT:ubuffer(data=[9 9 9 9], stride=4):out,name outputBuffer 21RWStructuredBuffer<int> outputBuffer; 22 23[numthreads(4, 1, 1)] 24void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 25{ 26 uint tid = dispatchThreadID.x; 27 28 int inVal = int(tid); 29 int outVal = test(inVal); 30 31 outputBuffer[tid] = outVal; 32}