diff options
| author | Yong He <yonghe@outlook.com> | 2024-08-19 15:03:56 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-19 15:03:56 -0700 |
| commit | 453683bf44f2112719802eaac2b332d49eebd640 (patch) | |
| tree | d399db4c9cba90c11980186d3df1ffcc4d423b5a /tests/language-feature/tuple/tuple-compare.slang | |
| parent | ecf85df6eee3da76ef54b14e4ab083f22da89e46 (diff) | |
Tuple swizzling, concat, comparison and `countof`. (#4856)
* Tuple swizzling and element access.
* Update proposal status.
* Cleanup.
* Fix merrge error.
* Address review.
Diffstat (limited to 'tests/language-feature/tuple/tuple-compare.slang')
| -rw-r--r-- | tests/language-feature/tuple/tuple-compare.slang | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/language-feature/tuple/tuple-compare.slang b/tests/language-feature/tuple/tuple-compare.slang new file mode 100644 index 000000000..b4d0e7833 --- /dev/null +++ b/tests/language-feature/tuple/tuple-compare.slang @@ -0,0 +1,44 @@ +// Test tuple comparison. + +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-shaderobj -output-using-type +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -shaderobj -output-using-type +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -shaderobj -output-using-type +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -shaderobj -output-using-type + +//TEST_INPUT:ubuffer(data=[1 2 3 4], stride=4):out,name=outputBuffer +RWStructuredBuffer<int> outputBuffer; + +[numthreads(1, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + var t = makeTuple(1, 2, 2.0); + var u = makeTuple(1, 3, 2.0); + + // CHECK: 1 + if (t._0_2 == u._0_2 && t != u) + outputBuffer[0] = 1; + + int result = 1; + if (t < t) result = 0; + if (!(t <= t)) result = 0; + if (t != t) result = 0; + if (t > t) result = 0; + if (!(t >= t)) result = 0; + + if (!(t < u)) result = 0; + if (!(t <= u)) result = 0; + if (!(t != u)) result = 0; + if (t == u) result = 0; + if (t > u) result = 0; + if (t >= u) result = 0; + + if (!(u > t)) result = 0; + if (!(u >= t)) result = 0; + if (!(u != t)) result = 0; + if (u == t) result = 0; + if (u < t) result = 0; + if (u <= t) result = 0; + + // CHECK: 1 + outputBuffer[1] = result; +} |
