yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
adaea0e99
master
1//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj 2//TEST(compute,vulkan):COMPARE_COMPUTE_EX:-vk -slang -compute -shaderobj 3 4struct Thing 5{ 6 bool a; 7 bool b; 8}; 9 10//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer 11RWStructuredBuffer<int> outputBuffer; 12 13[numthreads(4, 1, 1)] 14void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 15{ 16 Thing thing = {}; 17 int index = int(dispatchThreadID.x); 18 19 if (index % 3 != 0) 20 { 21 thing.a = (index & 1) != 0; 22 } 23 else 24 { 25 thing.b = (index & 2) != 0; 26 } 27 28 int v = (thing.a ? 2 : 0) + (thing.b ? 1: 0); 29 30 outputBuffer[index] = v; 31}