summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorvenkataram-nv <vedavamadath@nvidia.com>2024-06-27 07:18:02 -0700
committerGitHub <noreply@github.com>2024-06-27 07:18:02 -0700
commit7751963f14544fdb6d606a8017f58d131c852ad2 (patch)
treef8750c95ea8c95cb1a30e88a673f33138fa60928 /tests
parent4dd41de7558b2b3b7fe99b4b624dc91969031abe (diff)
Implement `uint2` variant of `asdouble` intrinsic (#4488)
* Implement asdouble2 intrinsic and tests Fixes #4437 Adds a new asdouble2 intrinsic for all platforms except Metal. Extends the test for asdouble to test asdouble2 as well.
Diffstat (limited to 'tests')
-rw-r--r--tests/hlsl-intrinsic/bit-cast-double.slang53
-rw-r--r--tests/hlsl-intrinsic/bit-cast-double.slang.expected.txt4
2 files changed, 36 insertions, 21 deletions
diff --git a/tests/hlsl-intrinsic/bit-cast-double.slang b/tests/hlsl-intrinsic/bit-cast-double.slang
index ecc70b1da..bacaaee03 100644
--- a/tests/hlsl-intrinsic/bit-cast-double.slang
+++ b/tests/hlsl-intrinsic/bit-cast-double.slang
@@ -1,23 +1,42 @@
-//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -cpu -shaderobj
-//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
-//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -shaderobj
-//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-slang -vk -compute -shaderobj -render-feature double
-//TEST(compute):COMPARE_COMPUTE_EX:-slang -cuda -compute -shaderobj
-//DISABLE_TEST(compute):COMPARE_COMPUTE:-slang -shaderobj -mtl
-
-//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
+//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -compute -cpu -shaderobj
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHK):-slang -compute -dx11 -shaderobj
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHK):-slang -compute -dx12 -shaderobj
+//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -vk -compute -shaderobj -render-feature double
+//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -cuda -compute -shaderobj
+//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHK):-slang -shaderobj -mtl
+
+//CHK: 1
+
+//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer
RWStructuredBuffer<int> outputBuffer;
-[numthreads(4, 1, 1)]
+[numthreads(1, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
+ // uint variant
double d = double(dispatchThreadID.x);
-
- uint hi, low;
- asuint(d, low, hi);
-
- // Reconstruct
- double r = asdouble(low, hi);
-
- outputBuffer[dispatchThreadID.x] = int(r);
+
+ uint high;
+ uint low;
+
+ asuint(d, low, high);
+
+ double r = asdouble(low, high);
+
+ // uint2 variant
+ double a = double(dispatchThreadID.x + 1);
+ double b = double(dispatchThreadID.x + 2);
+
+ uint2 high2;
+ uint2 low2;
+
+ asuint(a, low2.x, high2.x);
+ asuint(b, low2.y, high2.y);
+
+ double2 s = asdouble(low2, high2);
+
+ // status
+ outputBuffer[0] = (int(r) == 0)
+ && (int(s.x) == 1)
+ && (int(s.y) == 2);
}
diff --git a/tests/hlsl-intrinsic/bit-cast-double.slang.expected.txt b/tests/hlsl-intrinsic/bit-cast-double.slang.expected.txt
deleted file mode 100644
index bc856dafa..000000000
--- a/tests/hlsl-intrinsic/bit-cast-double.slang.expected.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-0
-1
-2
-3