yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
97f302eef
master
1//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj 2//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -shaderobj 3//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj 4 5//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer 6RWStructuredBuffer<float> outputBuffer; 7 8[numthreads(4,1,1)] 9void computeMain(uint2 dispatchID : SV_DispatchThreadID) 10{ 11 float a = dispatchID.x * 0.5f; 12 float b = dispatchID.x + 1.0f; 13 14 float2 c2_0 = float2( a, b); 15 16 float3 c3_0 = float3( a, b, a); 17 float3 c3_1 = float3( float2(a, b), a); 18 float3 c3_2 = float3( b, float2(a, b)); 19 20 float4 c4_0 = float4(a, b, a, b); 21 float4 c4_1 = float4(float2(a, b), a, b); 22 float4 c4_2 = float4(a, float2(b, a), b); 23 float4 c4_3 = float4(a, b, float2(a, b)); 24 float4 c4_4 = float4(float2(a, b), float2(a, b)); 25 float4 c4_5 = float4(float3(a, b, a), a); 26 float4 c4_6 = float4(a, float3(a, b, a)); 27 28 float r = c2_0.x + 29 c3_0.y + c3_1.z + c3_2.x + 30 c4_0.x + c4_1.x + c4_2.x + c4_3.x + c4_4.x + c4_5.x + c4_6.x; 31 32 outputBuffer[dispatchID.x] = r; 33}