From c639cac500893674240dc3aa6f67ef33b6ae3717 Mon Sep 17 00:00:00 2001 From: tgrimesnv <158093149+tgrimesnv@users.noreply.github.com> Date: Thu, 15 Feb 2024 14:08:46 -0600 Subject: HLSL texture intrinsic test first draft. (#3583) * HLSL texture intrinsic test first draft. * Some updated to texture-intrinsics.slang * Update dx11 test config in texture-intrinsics.slang * made some edits that shouldn't matter, but commiting once more to be sure * Switch to filecheck-buffer and differing output values per api * Forgot to uncomment one function and updated expected values. * Delete tests/hlsl-intrinsic/texture/texture-intrinsics.slang.expected.txt * Cubemap SampleGrad * Enable Vulkan and have SampleCmpLevelZero ifdefed out for Vulkan --- .../texture/texture-intrinsics.slang | 302 +++++++++++++++++++++ 1 file changed, 302 insertions(+) create mode 100644 tests/hlsl-intrinsic/texture/texture-intrinsics.slang (limited to 'tests') diff --git a/tests/hlsl-intrinsic/texture/texture-intrinsics.slang b/tests/hlsl-intrinsic/texture/texture-intrinsics.slang new file mode 100644 index 000000000..01452ac9d --- /dev/null +++ b/tests/hlsl-intrinsic/texture/texture-intrinsics.slang @@ -0,0 +1,302 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -shaderobj -output-using-type +//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=DX11):-slang -compute -shaderobj -output-using-type -render-feature hardware-device +//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=DX12):-slang -compute -dx12 -shaderobj -output-using-type +//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=DX12CS6):-slang -compute -dx12 -profile cs_6_0 -use-dxil -shaderobj -output-using-type -xslang -DCS60 +//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=VK):-vk -emit-spirv-directly -compute -shaderobj -output-using-type -render-feature hardware-device -xslang -DVK +//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -shaderobj -output-using-type + +//TEST_INPUT: Texture1D(size=4, content = one):name t1D +Texture1D t1D; +//TEST_INPUT: Texture2D(size=4, content = one):name t2D +Texture2D t2D; +//TEST_INPUT: Texture3D(size=4, content = one):name t3D +Texture3D t3D; +//TEST_INPUT: TextureCube(size=4, content = one):name tCube +TextureCube tCube; + +//TEST_INPUT: Texture1D(size=4, content = one, arrayLength=2):name t1DArray +Texture1DArray t1DArray; +//TEST_INPUT: Texture2D(size=4, content = one, arrayLength=2):name t2DArray +Texture2DArray t2DArray; +//TEST_INPUT: TextureCube(size=4, content = one, arrayLength=2):name tCubeArray +TextureCubeArray tCubeArray; + +//TEST_INPUT: Sampler:name samplerState +SamplerState samplerState; +//TEST_INPUT: Sampler:name shadowSampler +SamplerComparisonState shadowSampler; + + +//TEST_INPUT: ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer +RWStructuredBuffer outputBuffer; + +[numthreads(4, 1, 1)] +void computeMain(int3 dispatchThreadID: SV_DispatchThreadID) +{ + int idx = dispatchThreadID.x; + float u = idx * (1.0f / 4); + + float val = 0.0f; + + uint width = 0, height = 0, depth = 0; + float fwidth = 0.0f, fheight = 0.0f, fdepth = 0.0f; + uint numLevels = 0, elements = 0; + float fnumLevels = 0.0f, felements = 0.0f; + + /* +