yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
e1c3c4ae3
master
1// row-major.slang 2 3//TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -output-using-type -compile-arg -O3 -xslang -matrix-layout-row-major -shaderobj 4//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -output-using-type -xslang -matrix-layout-row-major -shaderobj 5//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -output-using-type -xslang -matrix-layout-row-major -shaderobj 6//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -output-using-type -xslang -matrix-layout-row-major -shaderobj 7 8//TEST_INPUT:cbuffer(data=[1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 0.0 10.0 20.0 30.0 1.0]):name matrixBuffer 9ConstantBuffer<float4x4> matrixBuffer; 10 11//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name output 12RWStructuredBuffer<float> output; 13 14[numthreads(1, 1, 1)] 15void computeMain(uint3 tid : SV_DispatchThreadID) 16{ 17 float4 v = float4(1, 2, 3, 1); 18 19 float4x4 M = matrixBuffer; 20 21 float4 r = mul(v, M); 22 23 output[0] = r.x; 24 output[1] = r.y; 25 output[2] = r.z; 26 output[3] = r.w; 27}