summaryrefslogtreecommitdiff
path: root/tests/compute/default-parameter.slang
diff options
context:
space:
mode:
Diffstat (limited to 'tests/compute/default-parameter.slang')
-rw-r--r--tests/compute/default-parameter.slang24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/compute/default-parameter.slang b/tests/compute/default-parameter.slang
new file mode 100644
index 000000000..6e6631bb4
--- /dev/null
+++ b/tests/compute/default-parameter.slang
@@ -0,0 +1,24 @@
+//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute
+//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(0),out
+
+RWStructuredBuffer<int> outputBuffer;
+
+int helper(int val, int a = 16)
+{
+ return val + a;
+}
+
+int test(int val)
+{
+ return helper(val) + helper(val, 256);
+}
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ int inVal = (int) dispatchThreadID.x;
+ int outVal = test(inVal);
+ outputBuffer[dispatchThreadID.x] = outVal;
+} \ No newline at end of file