summaryrefslogtreecommitdiff
path: root/tests/compute
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-03-13 16:31:29 -0400
committerGitHub <noreply@github.com>2019-03-13 16:31:29 -0400
commit04416431993b1d5efa8eac759a16832d40c2a159 (patch)
treee5059ff16c9ada8fd3386c39ace805118603e545 /tests/compute
parent3b33c1be0ad4c1256878d8669773ef1f8fc9b58d (diff)
Add support for vector/scalar compares for GLSL (#903)
* * leftSide and rightSide set op to nullptr, before was just uninitialized * Added support for GLSL for vector/scalar comparisons * Added test * * Remove unneeded precedence code. * Simplify function to _maybeEmitGLSLCast * * Take into account precedence & closing of brackets in same way as function call, if function call used for vector comparison (as on GLSL)
Diffstat (limited to 'tests/compute')
-rw-r--r--tests/compute/vector-scalar-compare.slang25
-rw-r--r--tests/compute/vector-scalar-compare.slang.expected.txt16
2 files changed, 41 insertions, 0 deletions
diff --git a/tests/compute/vector-scalar-compare.slang b/tests/compute/vector-scalar-compare.slang
new file mode 100644
index 000000000..e8e701dbc
--- /dev/null
+++ b/tests/compute/vector-scalar-compare.slang
@@ -0,0 +1,25 @@
+//TEST(compute):COMPARE_COMPUTE:-dx12 -compute
+//TEST(compute):COMPARE_COMPUTE:-vk -compute
+//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=4):dxbinding(0),glbinding(0),out
+
+// Test doing vector comparisons
+RWStructuredBuffer<int> outputBuffer;
+
+[numthreads(4, 4, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ uint2 threadInGroup = dispatchThreadID.xy;
+
+ int r = 0;
+ if(all((threadInGroup & 1) == 0))
+ {
+ r = 0;
+ }
+ else
+ {
+ r = 1;
+ }
+
+ int index = threadInGroup.x + threadInGroup.y * 4;
+ outputBuffer[index] = r;
+} \ No newline at end of file
diff --git a/tests/compute/vector-scalar-compare.slang.expected.txt b/tests/compute/vector-scalar-compare.slang.expected.txt
new file mode 100644
index 000000000..1424570bc
--- /dev/null
+++ b/tests/compute/vector-scalar-compare.slang.expected.txt
@@ -0,0 +1,16 @@
+0
+1
+0
+1
+1
+1
+1
+1
+0
+1
+0
+1
+1
+1
+1
+1