summaryrefslogtreecommitdiffstats
path: root/tests/compute
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2018-02-01 12:06:06 -0800
committerGitHub <noreply@github.com>2018-02-01 12:06:06 -0800
commit4583e395ad503b63343a14adaeb621dee8a8da71 (patch)
tree8dc7ea0861ee11c5742925785ecb7b312c242599 /tests/compute
parentb6bc0837ba6e7fb42280bf6289f4dab633c88392 (diff)
Implement type splitting for raw buffers (#393)
* Fix render-test to handle raw buffers I don't know if this fix will work for UAVs that are neither structured nor raw, but it fixes the code that currently only really works if every UAV is structured (since it doesn't set a format). * Make type legalization consider raw buffer types The type layout logic was already handling these, but the type splitting logic in legalization was failing to split structure types that contain, e.g., `RWByteAddressBuffer`. A compute test case has been added to confirm the fix.
Diffstat (limited to 'tests/compute')
-rw-r--r--tests/compute/buffer-type-splitting.slang29
-rw-r--r--tests/compute/buffer-type-splitting.slang.expected.txt4
2 files changed, 33 insertions, 0 deletions
diff --git a/tests/compute/buffer-type-splitting.slang b/tests/compute/buffer-type-splitting.slang
new file mode 100644
index 000000000..c7577a0b2
--- /dev/null
+++ b/tests/compute/buffer-type-splitting.slang
@@ -0,0 +1,29 @@
+//TEST(compute):COMPARE_COMPUTE:
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(0),out
+//TEST_INPUT:ubuffer(data=[0 2 3 3]):dxbinding(1),glbinding(1)
+//TEST_INPUT:ubuffer(data=[4 5 6 7]):dxbinding(2),glbinding(2)
+//TEST_INPUT:ubuffer(data=[8 9 10 11]):dxbinding(3),glbinding(3)
+//TEST_INPUT:ubuffer(data=[12 13 14 15]):dxbinding(4),glbinding(4)
+
+RWStructuredBuffer<int> outputBuffer;
+
+struct S
+{
+ RWByteAddressBuffer a;
+ RWByteAddressBuffer b;
+};
+S s[2];
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ uint i = dispatchThreadID.x;
+
+ int val =
+ s[0].a.Load(i * 4)
+ + s[1].a.Load(i * 4)*16
+ + s[0].b.Load(i * 4)*256
+ + s[1].b.Load(i * 4)*4096;
+
+ outputBuffer[i] = val;
+} \ No newline at end of file
diff --git a/tests/compute/buffer-type-splitting.slang.expected.txt b/tests/compute/buffer-type-splitting.slang.expected.txt
new file mode 100644
index 000000000..4bc5fcbf9
--- /dev/null
+++ b/tests/compute/buffer-type-splitting.slang.expected.txt
@@ -0,0 +1,4 @@
+C840
+D952
+EA63
+FB73