yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f02b08490
master
1// Float16 not supported on CPU currently 2//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -output-using-type 3// Doesn't work on FXC 4//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -output-using-type 5 6//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -profile sm_6_2 -render-feature half -output-using-type 7//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -render-feature int16,half -output-using-type 8//TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -render-features half -output-using-type 9 10//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):out,name outputBuffer 11RWStructuredBuffer<float> outputBuffer; 12 13[numthreads(8, 1, 1)] 14void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 15{ 16 int idx = int(dispatchThreadID.x); 17 18 // 1 19 float16_t m = asfloat16(uint16_t(0x3c00)); 20 21 float16_t v = asfloat16(uint16_t(0x3c00 + (idx << 8))) + m; 22 float f = v; 23 24 outputBuffer[idx] = f; 25}