diff options
| author | Yong He <yonghe@outlook.com> | 2019-01-28 09:42:27 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-28 09:42:27 -0800 |
| commit | 71f1750dea041cb19eb6f25def585085dd171915 (patch) | |
| tree | fe9c11d126e8ee656726d92ff55d6be1e81c45c5 /tests | |
| parent | eefe2539373a2e17eda2f11c420908c0aebcac6d (diff) | |
| parent | df9dc5710725d00630831b77ca7005e390383aa6 (diff) | |
Merge branch 'master' into texture-fix
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/compute/bit-cast-double.slang | 21 | ||||
| -rw-r--r-- | tests/compute/bit-cast-double.slang.expected.txt | 4 | ||||
| -rw-r--r-- | tests/compute/bit-cast.slang | 42 | ||||
| -rw-r--r-- | tests/compute/bit-cast.slang.expected.txt | 12 |
4 files changed, 79 insertions, 0 deletions
diff --git a/tests/compute/bit-cast-double.slang b/tests/compute/bit-cast-double.slang new file mode 100644 index 000000000..27d0b48cf --- /dev/null +++ b/tests/compute/bit-cast-double.slang @@ -0,0 +1,21 @@ +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 +//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(0),out + +RWStructuredBuffer<int> outputBuffer; + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + double d = double(dispatchThreadID.x); + + uint hi, low; + asuint(d, low, hi); + + // Reconstruct + double r = asdouble(low, hi); + + outputBuffer[dispatchThreadID.x] = int(r); +}
\ No newline at end of file diff --git a/tests/compute/bit-cast-double.slang.expected.txt b/tests/compute/bit-cast-double.slang.expected.txt new file mode 100644 index 000000000..bc856dafa --- /dev/null +++ b/tests/compute/bit-cast-double.slang.expected.txt @@ -0,0 +1,4 @@ +0 +1 +2 +3 diff --git a/tests/compute/bit-cast.slang b/tests/compute/bit-cast.slang new file mode 100644 index 000000000..050b84f30 --- /dev/null +++ b/tests/compute/bit-cast.slang @@ -0,0 +1,42 @@ +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 +//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute + +//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0], stride=4):dxbinding(0),glbinding(0),out + +RWStructuredBuffer<int> outputBuffer; + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + const int id = asint(dispatchThreadID.x); + + { + int4 i4 = int4(id, id + 1, id + 2, id + 3); + uint3 u3 = asuint(i4.xyz); + int2 i2 = asint(u3.xy); + uint u1 = asuint(i2.x); + + outputBuffer[id + 0] = int(u1); + } + + { + uint v = asuint(id); + uint4 u4 = uint4(v, v + 1, v + 2, v + 3); + int3 i3 = asint(u4.xyz); + uint2 u2 = asuint(i3.xy); + int i1 = asint(u2.x); + + outputBuffer[id + 4] = i1; + } + + { + int4 i4 = int4(id, id + 1, id + 2, id + 3); + float4 f4 = asfloat(i4); + uint3 u3 = asuint(f4.xyz); + float2 f2 = asfloat(u3.xy); + int i1 = asint(id); + + outputBuffer[id + 8] = i1; + } +}
\ No newline at end of file diff --git a/tests/compute/bit-cast.slang.expected.txt b/tests/compute/bit-cast.slang.expected.txt new file mode 100644 index 000000000..f5414793f --- /dev/null +++ b/tests/compute/bit-cast.slang.expected.txt @@ -0,0 +1,12 @@ +0 +1 +2 +3 +0 +1 +2 +3 +0 +1 +2 +3
\ No newline at end of file |
