summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/library/precompiled-dxil.slang24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/library/precompiled-dxil.slang b/tests/library/precompiled-dxil.slang
new file mode 100644
index 000000000..19f67b075
--- /dev/null
+++ b/tests/library/precompiled-dxil.slang
@@ -0,0 +1,24 @@
+// precompiled-dxil.slang
+
+// A test that uses slang-modules with embedded precompiled DXIL.
+// The test compiles both library slang (export-library.slang) and entrypoint slang (this file) to two slang-modules, each with -embed-dxil options.
+// The result is two slang-modules that are then linked together in a third slangc invocation.
+// Internally, slang does not use the IR in the modules to link, but rather their embedded DXIL.
+// The test passes if there is no errror thrown.
+// TODO: Check if final linkage used only the precompiled dxil.
+
+//TEST(windows):COMPILE: tests/library/export-library.slang -o tests/library/export-library.slang-module -embed-dxil -profile lib_6_6 -incomplete-library
+//TEST(windows):COMPILE: tests/library/precompiled-dxil.slang -o tests/library/precompiled-dxil.slang-module -embed-dxil -profile lib_6_6 -incomplete-library
+//TEST(windows):COMPILE: tests/library/export-library.slang-module tests/library/precompiled-dxil.slang-module -target dxil -entry computeMain -profile cs_6_6 -o tests/library/linked.dxil
+
+extern int foo(int a);
+
+RWStructuredBuffer<int> outputBuffer;
+
+[shader("compute")]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ int index = (int)dispatchThreadID.x;
+
+ outputBuffer[index] = foo(index);
+}