yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
2a5d5b323
master
1//TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -shaderobj 2//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj 3//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -shaderobj 4//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj 5//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-cuda -compute -shaderobj 6 7//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer 8RWStructuredBuffer<int> outputBuffer; 9 10[numthreads(4, 1, 1)] 11void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 12{ 13 int idx = int(dispatchThreadID.x); 14 15 int ti =0; 16 17 ti += max(2, idx); 18 ti += min(idx, 1); 19 ti += abs(idx - 2); 20 ti += (idx * 3) % 5; 21 22 ti += clamp(idx * 10, 11, 23); 23 24 outputBuffer[idx] = ti; 25}