yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f02b08490
master
1// Native half not supported on CPU currently 2//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -output-using-type -shaderobj 3// Doesn't work on DX11 currently - locks up on binding 4//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -output-using-type -shaderobj 5// Produces a different result on DX12 with DXBC than expected(!). So disabled for now 6//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -output-using-type -shaderobj 7//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -profile cs_6_0 -output-using-type -shaderobj 8//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -output-using-type -shaderobj 9//TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -output-using-type -shaderobj -render-features half 10 11// Note that this test is a little silly. The output does not confirm that the write actually worked. 12// half-rw-texture-convert2.slang tests this 13 14//TEST_INPUT: RWTexture2D(format=R16Float, size=4, content = one, mipMaps = 1):name rwt2D 15[format("r16f")] 16RWTexture2D<float> rwt2D; 17 18//TEST_INPUT: RWTexture2D(format=RG16Float, size=4, content = one, mipMaps = 1):name rwt2D_2 19[format("rg16f")] 20RWTexture2D<float2> rwt2D_2; 21 22//TEST_INPUT: RWTexture2D(format=RGBA16Float, size=4, content = one, mipMaps = 1):name rwt2D_4 23[format("rgba16f")] 24RWTexture2D<float4> rwt2D_4; 25 26//TEST_INPUT: ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer 27RWStructuredBuffer<float> outputBuffer; 28 29[numthreads(4, 1, 1)] 30void computeMain(int3 dispatchThreadID : SV_DispatchThreadID) 31{ 32 int idx = dispatchThreadID.x; 33 34 float val = idx; 35 36 // Do a format converting write! 37 rwt2D[uint2(idx, idx)] = val; 38 39 rwt2D_2[uint2(idx, idx)] = float2(val * 2, val * 3); 40 41 rwt2D_4[uint2(idx, idx)] = float4(val + 1, val - 1, val * 4, val * -4); 42 43 outputBuffer[idx] = val; 44}