yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
28006e36d
master
1//TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -shaderobj 2//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -render-feature double 3//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -shaderobj 4//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -render-feature double 5//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-cuda -compute -shaderobj 6//DISABLE_TEST(compute):COMPARE_COMPUTE:-slang -shaderobj -mtl 7// Not supported in WGSL: Double and other unsupported scalar types 8//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-wgpu 9 10// inf, -inf, nan, finite 11//TEST_INPUT:ubuffer(data=[ 0 0x7ff00000 0 0xfff00000 0xffffffff 0x7fffffff 1 0], stride=4):name inputBuffer 12RWStructuredBuffer<uint> inputBuffer; 13 14//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer 15RWStructuredBuffer<int> outputBuffer; 16 17[numthreads(4, 1, 1)] 18void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 19{ 20 int idx = int(dispatchThreadID.x); 21 22 uint low = inputBuffer[idx * 2 + 0]; 23 uint high = inputBuffer[idx * 2 + 1]; 24 25 double v = asdouble(low, high); 26 27 int flags = 0; 28 29 flags |= isnan(v) ? 1 : 0; 30 flags |= isfinite(v) ? 2 : 0; 31 flags |= isinf(v) ? 4 : 0; 32 33 outputBuffer[idx] = flags; 34}