summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2021-05-06 12:45:00 -0400
committerGitHub <noreply@github.com>2021-05-06 12:45:00 -0400
commite510a287deb25f2542a68bf21382f2557740d70c (patch)
treea2bc079431edeeb979d61fa4612858f6aa13c901 /tests
parent85632e8db19916a2f348fe356a91119d2fde2929 (diff)
Half texture support (#1836)
* #include an absolute path didn't work - because paths were taken to always be relative. * Split out StringEscapeUtil. * Added StringEscapeUtil. * Fix typo in unix quoting type. * Small comment improvements. * Try to fix linux linking issue. * Fix typo. * Attempt to fix linux link issue. * Update VS proj even though nothing really changed. * Fix another typo issue. * Fix for windows issue. Fixed bug. * Make separate Utils for escaping. * Fix typo. * Split out into StringEscapeHandler. * Windows shell does handle removing quotes (so remove code to remove them). * Handle unescaping if not initiating using the shell. * Slight improvement around shell like decoding. * Simplify command extraction. * Add shared-library category type. * Fix bug in command extraction. * Typo in transcendental category. * Enable unit-test on in smoke test category. * Make parsing failing output as a failing test. * Fixes for transcendental tests. Disable tests that do not work. * Changed category parsing. * Removed the TestResult parameter from _gatherTestsForFile. Made testsList only output. * Remove testing if all tests were disabled. * Make args of CommandLine always unescaped. * Add category. * Don't need escaping on unix/linux. * Remove some no longer used functions. * Add requireSMVersion to CUDAExtensionTracker. * half-calc.slang now works for CUDA. * bit-cast-16-bit works on CUDA. * WIP handling of CUDA vector<half> types. * Half swizzle CUDA. * Half vector test. * Fix swizzle half bug. * Fix compilation issue with narrowing to Index. * Add unary ops. * Add some vector scalar maths ops. * Add half vector conversions for CUDA. * Fix erroneous comment. * Support for half comparisons. * First pass test for half compare. * Fix bug in CUDA specialized emit control. Updated tests to have pre and post inc/dec. * Removed unneeded parts of the cuda prelude. * Half structured buffer works on CUDA. * Added name lookup for Gfx::Format * Support half texture type in test system. * Test for half reading on CUDA. * Add half formats to Vk and D3D utils. * Fix getAt for CUDA - where there might not be a .x member in a vector.
Diffstat (limited to 'tests')
-rw-r--r--tests/compute/half-texture-simple.slang53
-rw-r--r--tests/compute/half-texture-simple.slang.expected.txt4
2 files changed, 57 insertions, 0 deletions
diff --git a/tests/compute/half-texture-simple.slang b/tests/compute/half-texture-simple.slang
new file mode 100644
index 000000000..1f775ec59
--- /dev/null
+++ b/tests/compute/half-texture-simple.slang
@@ -0,0 +1,53 @@
+//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -shaderobj
+//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
+//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -shaderobj
+//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -profile cs_6_0 -use-dxil -shaderobj
+// TODO(JS): Doesn't work on vk currently, because createTextureView not implemented on vk renderer
+//DISABLE_TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj
+//TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -shaderobj
+
+// Doesn't work on CUDA, not clear why yet
+//DISABLE_TEST_INPUT: Texture1D(format=R_Float16, size=4, content = one, mipMaps=1):name tLoad1D
+//Texture1D<float> tLoad1D;
+
+//TEST_INPUT: Texture1D(format=R_Float16, size=4, content = one):name t1D
+Texture1D<float> t1D;
+//TEST_INPUT: Texture2D(format=R_Float16, size=4, content = one):name t2D
+Texture2D<float> t2D;
+//TEST_INPUT: Texture3D(format=R_Float16, size=4, content = one):name t3D
+Texture3D<float> t3D;
+//TEST_INPUT: TextureCube(format=R_Float16, size=4, content = one):name tCube
+TextureCube<float> tCube;
+
+//TEST_INPUT: Texture1D(format=R_Float16, size=4, content = one, arrayLength=2):name t1DArray
+Texture1DArray<float> t1DArray;
+//TEST_INPUT: Texture2D(format=R_Float16, size=4, content = one, arrayLength=2):name t2DArray
+Texture2DArray<float> t2DArray;
+//TEST_INPUT: TextureCube(format=R_Float16, size=4, content = one, arrayLength=2):name tCubeArray
+TextureCubeArray<float> tCubeArray;
+
+//TEST_INPUT: Sampler:name samplerState
+SamplerState samplerState;
+
+//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 u = idx * (1.0f / 4);
+
+ float val = 0.0f;
+
+ val += t1D.SampleLevel(samplerState, u, 0);
+ val += t2D.SampleLevel(samplerState, float2(u, u), 0);
+ val += t3D.SampleLevel(samplerState, float3(u, u, u), 0);
+ val += tCube.SampleLevel(samplerState, normalize(float3(u, 1 - u, u)), 0);
+
+ val += t1DArray.SampleLevel(samplerState, float2(u, 0), 0);
+ val += t2DArray.SampleLevel(samplerState, float3(u, u, 0), 0);
+ val += tCubeArray.SampleLevel(samplerState, float4(u, u, u, 0), 0);
+
+ outputBuffer[idx] = val;
+}
diff --git a/tests/compute/half-texture-simple.slang.expected.txt b/tests/compute/half-texture-simple.slang.expected.txt
new file mode 100644
index 000000000..cf6e7405a
--- /dev/null
+++ b/tests/compute/half-texture-simple.slang.expected.txt
@@ -0,0 +1,4 @@
+40E00000
+40E00000
+40E00000
+40E00000