summaryrefslogtreecommitdiff
path: root/tests/compute/rewriter-parameter-block-complex.hlsl
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2017-12-08 14:23:12 -0800
committerGitHub <noreply@github.com>2017-12-08 14:23:12 -0800
commit0f55649cc1aa8ad3218b7f8ba7b1eabdd2ec6526 (patch)
tree0dc7fd5e88fbc530dc121946f4a20085aa5518d8 /tests/compute/rewriter-parameter-block-complex.hlsl
parent301cdf5ef42797b1073d9e6c741ef0ba98a38792 (diff)
Cleanups to `ParameterBlock<T>` behavior. (#304)
* Cleanups to `ParameterBlock<T>` behavior. These add some more realistic tests using the `ParameterBlock<T>` support, and show that it can work with the "rewriter" mode. Unfortunately, this code does *not* currently work with the rewriter + the IR at once. That will need to be fixed in a follow-on change, because I now see that the root problem is pretty ugly. * cleanup
Diffstat (limited to 'tests/compute/rewriter-parameter-block-complex.hlsl')
-rw-r--r--tests/compute/rewriter-parameter-block-complex.hlsl32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/compute/rewriter-parameter-block-complex.hlsl b/tests/compute/rewriter-parameter-block-complex.hlsl
new file mode 100644
index 000000000..4dc312f95
--- /dev/null
+++ b/tests/compute/rewriter-parameter-block-complex.hlsl
@@ -0,0 +1,32 @@
+//TEST(compute):HLSL_COMPUTE:-xslang -no-checking
+//TEST(compute):COMPARE_COMPUTE:-xslang -use-ir
+
+// Doesn't work with IR yet.
+//DISABLED_TEST(compute):HLSL_COMPUTE:-xslang -no-checking -xslang -use-ir
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(0),out
+
+//TEST_INPUT:cbuffer(data=[256]):dxbinding(0),glbinding(0)
+//TEST_INPUT:ubuffer(data=[0 1 2 3], stride=4):dxbinding(1),glbinding(1)
+
+//TEST_INPUT:cbuffer(data=[4096]):dxbinding(1),glbinding(1)
+//TEST_INPUT:ubuffer(data=[16 32 48 64], stride=4):dxbinding(2),glbinding(2)
+
+// Test that we can declare a `ParameterBlock<...>` type as a shader
+// parameter (potentially nested inside a `cbuffer`) and use it in
+// shader code processed by the "rewriter"
+
+import rewriter_parameter_block_complex;
+
+RWStructuredBuffer<int> outputBuffer : register(u0);
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ uint tid = dispatchThreadID.x;
+ int inVal = tid;
+
+ int outVal = test(gA, inVal) + test(gB, inVal);
+
+ outputBuffer[tid] = outVal;
+} \ No newline at end of file