yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
5ec41675d
master
1//TEST(compute):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -emit-spirv-directly 2//TEST(compute):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -emit-spirv-via-glsl 3//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -profile cs_6_7 -dx12 -shaderobj -render-feature hardware-device 4//TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -profile cs_6_7 -shaderobj -render-feature hardware-device 5//TEST(compute):COMPARE_COMPUTE_EX:-metal -compute -shaderobj -xslang -DMETAL 6 7//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out,name outputBuffer 8RWStructuredBuffer<uint> outputBuffer; 9 10[numthreads(16, 1, 1)] 11void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 12{ 13 uint index = WaveGetLaneIndex(); 14 15 if (index < 4) 16 { 17 // Quad 1. 18 // Should return true, index 0's expr is true while all other indices' expr are false. 19 outputBuffer[index] = uint(QuadAny((index % 4) == 0)); 20 } 21 else if (index < 8) 22 { 23 // Quad 2. 24 // Should return false, all indices' expr are false. 25 bool falseCondition = (5 == 4); 26 outputBuffer[index] = uint(QuadAny(falseCondition)); 27 } 28 else if (index < 12) 29 { 30 // Quad 3. 31 // Should return false, index 0's expr is true while all other indices' expr are false. 32 outputBuffer[index] = uint(QuadAll((index % 4) == 0)); 33 } 34 else 35 { 36 // Quad 4. 37 // Should return true, all indices' expr are true. 38 bool trueCondition = (5 == 5); 39 outputBuffer[index] = uint(QuadAll(trueCondition)); 40 } 41} 42