summaryrefslogtreecommitdiffstats
path: root/tests/experiments/algorithm/generic-int-controlled-2.slang
diff options
context:
space:
mode:
Diffstat (limited to 'tests/experiments/algorithm/generic-int-controlled-2.slang')
-rw-r--r--tests/experiments/algorithm/generic-int-controlled-2.slang33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/experiments/algorithm/generic-int-controlled-2.slang b/tests/experiments/algorithm/generic-int-controlled-2.slang
new file mode 100644
index 000000000..52ef02336
--- /dev/null
+++ b/tests/experiments/algorithm/generic-int-controlled-2.slang
@@ -0,0 +1,33 @@
+//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
+
+/* Test to control altering of an algorithm via generic compile time values.
+
+Works.
+ */
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
+RWStructuredBuffer<float> outputBuffer;
+
+int reduce<let Clustering : int, let DupTest : int>( int a)
+{
+ if (Clustering)
+ {
+ a = a + a;
+ }
+ if (DupTest)
+ {
+ a *= a;
+ }
+ return a;
+}
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ int index = dispatchThreadID.x;
+
+ int r = reduce<1, 2>(index);
+
+ outputBuffer[index] = r;
+}
+