summaryrefslogtreecommitdiffstats
path: root/tests/serialization
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-12-04 12:46:19 -0500
committerGitHub <noreply@github.com>2019-12-04 12:46:19 -0500
commit0b4c1f63226eeff400eaa59be2331f0a480fd7b5 (patch)
tree7ae4a395b9a747a9911ae12539858e282604cd47 /tests/serialization
parentc2b492698b4628653e79a99b2cded9465564dd65 (diff)
Testing having a library with an entry point works. (#1141)
Diffstat (limited to 'tests/serialization')
-rw-r--r--tests/serialization/library-entry-point/library-entry-point-test.slang12
-rw-r--r--tests/serialization/library-entry-point/library-entry-point-test.slang.expected.txt4
-rw-r--r--tests/serialization/library-entry-point/library-entry-point.slang16
3 files changed, 32 insertions, 0 deletions
diff --git a/tests/serialization/library-entry-point/library-entry-point-test.slang b/tests/serialization/library-entry-point/library-entry-point-test.slang
new file mode 100644
index 000000000..9953c48b9
--- /dev/null
+++ b/tests/serialization/library-entry-point/library-entry-point-test.slang
@@ -0,0 +1,12 @@
+// library-entry-point-test.slang
+
+//TEST:COMPILE: -module-name module -no-codegen -profile cs_5_0 -entry computeMain tests/serialization/library-entry-point/library-entry-point.slang -o tests/serialization/library-entry-point/library-entry-point.slang-lib
+//TEST:COMPARE_COMPUTE_EX: -no-default-entry-point -xslang -module-name -xslang module -slang -compute -xslang -r -xslang tests/serialization/library-entry-point/library-entry-point.slang-lib
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0 ], stride=4):out,name outputBuffer
+
+int doSomething(int a)
+{
+ return a * a + 1;
+}
+
diff --git a/tests/serialization/library-entry-point/library-entry-point-test.slang.expected.txt b/tests/serialization/library-entry-point/library-entry-point-test.slang.expected.txt
new file mode 100644
index 000000000..146ab3c8c
--- /dev/null
+++ b/tests/serialization/library-entry-point/library-entry-point-test.slang.expected.txt
@@ -0,0 +1,4 @@
+1
+2
+5
+A
diff --git a/tests/serialization/library-entry-point/library-entry-point.slang b/tests/serialization/library-entry-point/library-entry-point.slang
new file mode 100644
index 000000000..657b140ac
--- /dev/null
+++ b/tests/serialization/library-entry-point/library-entry-point.slang
@@ -0,0 +1,16 @@
+//TEST_IGNORE_FILE:
+
+// libray-entry-point.slang
+// Testing for the scenarion when an entry point is declared in a library
+
+[__extern] int doSomething(int a);
+
+RWStructuredBuffer<int> outputBuffer;
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ int index = int(dispatchThreadID.x);
+ outputBuffer[index] = doSomething(index);
+}
+