yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
1562f98c0
master
1// matrix-layout-structured-buffer.slang 2 3// This test confirms that we apply the matrix layout 4// mode requested by the user, even in the case of structured 5// buffers of matrices, where fxc/dxc do *not* respect 6// the matrix layout mode by default. 7 8//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -xslang -matrix-layout-row-major -shaderobj -dx11 9//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -xslang -matrix-layout-column-major -shaderobj -dx11 10//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -xslang -matrix-layout-row-major -shaderobj -dx12 11//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -xslang -matrix-layout-column-major -shaderobj -dx12 12//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -xslang -matrix-layout-row-major -shaderobj -cuda 13 14 15//TEST_INPUT:ubuffer(data=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23], stride=48):name=gMatrices 16RWStructuredBuffer<int3x4> gMatrices; 17 18int test(int val) 19{ 20 int N = 256; 21 22 int tmp = 0; 23 24 tmp = tmp*N + gMatrices[val%2][(val )%3][(val )%4]; 25 tmp = tmp*N + gMatrices[val%2][(val+1)%3][(val )%4]; 26 tmp = tmp*N + gMatrices[val%2][(val )%3][(val+1)%4]; 27 tmp = tmp*N + val; 28 tmp = tmp + 0x80000000; 29 30 return tmp; 31} 32 33//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out,name=buffer 34RWStructuredBuffer<int> buffer; 35 36[numthreads(12, 1, 1)] 37void computeMain(int3 dispatchThreadID : SV_DispatchThreadID) 38{ 39 int tid = dispatchThreadID.x; 40 41 int val = tid; 42 val = test(val); 43 44 buffer[tid] = val; 45}