yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
2a5d5b323
master
1// glsl-bool-ops.slang 2 3// This test exists to ensure that binary operations on 4// vectors of `bool` produce correct GLSL/SPIR-V output. 5 6//TEST(compute):COMPARE_COMPUTE:-dx11 -compute -shaderobj 7//TEST(compute):COMPARE_COMPUTE:-vk -compute -shaderobj 8 9uint test(uint val) 10{ 11 bool2 a = val > uint2(0); 12 bool2 b = (val & uint2(1)) == 0; 13 bool2 c = val < uint2(3); 14 15 bool2 d = a && b; 16 bool2 e = a || c; 17 18 bool2 f = !(a & b); 19 bool2 g = a | c; 20 bool2 h = a ^ c; 21 22 uint2 t = 0; 23 t = t*2 + d; 24 t = t*2 + e; 25 t = t*2 + f; 26 t = t*2 + g; 27 t = t*2 + h; 28 29 uint result = 0; 30 result = result*256 + t.x; 31 result = result*256 + t.y; 32 return result; 33} 34 35//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer 36RWStructuredBuffer<uint> outputBuffer; 37 38[numthreads(4, 1, 1)] 39void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 40{ 41 uint tid = dispatchThreadID.x; 42 outputBuffer[tid] = test(tid); 43}