diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/compute/half-rw-texture-convert.slang | 42 | ||||
| -rw-r--r-- | tests/compute/half-rw-texture-convert.slang.expected.txt | 5 |
2 files changed, 47 insertions, 0 deletions
diff --git a/tests/compute/half-rw-texture-convert.slang b/tests/compute/half-rw-texture-convert.slang new file mode 100644 index 000000000..cf6eea4ea --- /dev/null +++ b/tests/compute/half-rw-texture-convert.slang @@ -0,0 +1,42 @@ + + +// Native half not supported on CPU currently +//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -output-using-type -shaderobj +// Doesn't work on DX11 currently - locks up on binding +//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -output-using-type -shaderobj +// Produces a different result on DX12 with DXBC than expected(!). So disabled for now +//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -output-using-type -shaderobj +//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -profile cs_6_0 -use-dxil -output-using-type -shaderobj +// TODO(JS): Doesn't work on vk currently, because createTextureView not implemented on vk renderer +//DIABLE_TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -output-using-type -shaderobj + +// Note that this test is a little silly. The output does not confirm that the write actually worked. +// This is because it's not trivial on CUDA to do so. If there is a write conversion, the RWTexture +// is backed by a surface. There is a texture converting write (in sust.p) but not in reading. +// +// In practice if if you wanted a texture read, you'd either only be able to read *without* format +// conversion, or via a separate binding of the same surface as a Texture. +// There's no simple way to describe either, so this test just confirms it outputs PTX that can +// be executed, and unfortunately doesn't test if the write conversion actually *worked* + +//TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -output-using-type -shaderobj -render-features half + +//TEST_INPUT: RWTexture2D(format=R_Float16, size=4, content = one, mipMaps = 1):name rwt2D +[format("r16f")] +RWTexture2D<float> rwt2D; + +//TEST_INPUT: ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer +RWStructuredBuffer<float> outputBuffer; + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + int idx = dispatchThreadID.x; + + float val = idx; + + // Do a format converting write! + rwt2D[uint2(idx, idx)] = val; + + outputBuffer[idx] = val; +} diff --git a/tests/compute/half-rw-texture-convert.slang.expected.txt b/tests/compute/half-rw-texture-convert.slang.expected.txt new file mode 100644 index 000000000..8867afc5a --- /dev/null +++ b/tests/compute/half-rw-texture-convert.slang.expected.txt @@ -0,0 +1,5 @@ +type: float +0.000000 +1.000000 +2.000000 +3.000000 |
