yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
e8797496b
master
1//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -compute -shaderobj 2//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-slang -compute -shaderobj 3//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-slang -compute -dx12 -shaderobj 4//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -compute -shaderobj 5//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cuda -compute -shaderobj 6 7//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0], stride=4):out,name outputBuffer 8RWStructuredBuffer<uint> outputBuffer; 9 10[numthreads(1, 1, 1)] 11void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 12{ 13 bool result = true; 14 result = result && firstbithigh(0) == -1; 15 result = result && firstbithigh(1) == 0; 16 result = result && firstbithigh(2) == 1; 17 result = result && firstbithigh(3) == 1; 18 result = result && firstbithigh(4) == 2; 19 result = result && firstbithigh(5) == 2; 20 result = result && firstbithigh(6) == 2; 21 result = result && firstbithigh(7) == 2; 22 result = result && firstbithigh(8) == 3; 23 24 result = result && firstbithigh(-1) == -1; 25 result = result && firstbithigh(-2) == 0; 26 result = result && firstbithigh(-3) == 1; 27 result = result && firstbithigh(-4) == 1; 28 result = result && firstbithigh(-5) == 2; 29 result = result && firstbithigh(-6) == 2; 30 result = result && firstbithigh(-7) == 2; 31 result = result && firstbithigh(-8) == 2; 32 result = result && firstbithigh(-9) == 3; 33 34 outputBuffer[0] = (result == true) ? 1 : 0; 35} 36 37// CHECK: 1