yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f428a058e
master
1//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-slang -dx12 -compute -shaderobj 2//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -compute -shaderobj 3//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=CHECK):-mtl -compute -shaderobj 4 5//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer 6RWStructuredBuffer<uint> outputBuffer; 7 8// note: `WorkgroupSize()` resolves into a compile time constant, 9// it is possible `size.x == 5` and others will resolve into `true` 10// at compile time. A compute test is required. 11[shader("compute")] 12[numthreads(5, 2, 1)] 13void computeMain(uint3 threadId: SV_DispatchThreadID) 14{ 15 // CHECK: 1 16 int3 size = WorkgroupSize(); 17 outputBuffer[0] = true 18 && size.x == 5 19 && size.y == 2 20 && size.z == 1 21 ; 22}