diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2022-04-15 15:46:45 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-15 15:46:45 -0400 |
| commit | d939773a9127bccbbd22903eb5b5620ad7127d37 (patch) | |
| tree | c9610f4891ba99f70bb5493ebca2daf16da88722 /tests/library | |
| parent | ac81614974700806e8257b8483a0ba97b925971a (diff) | |
DXIL library support and Artifact type (#2186)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Compile to a dxil library.
* Added CompileProduct.
* Support handling of ModuleLibrary.
* CacheBehavior -> Cache
* Use CompileProduct for -r references.
* CompileProduct -> Artifact.
* Determining an artifact type on binding.
* Determine binary linkability.
* Added Artifact::exists.
* Added ArtifactKeep.
* Small fixes.
* Small improvements to Artifact.
* Add zip extension.
* Fix some comments.
Diffstat (limited to 'tests/library')
| -rw-r--r-- | tests/library/library-test.slang | 27 | ||||
| -rw-r--r-- | tests/library/library.slang | 9 |
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/library/library-test.slang b/tests/library/library-test.slang new file mode 100644 index 000000000..06bb22961 --- /dev/null +++ b/tests/library/library-test.slang @@ -0,0 +1,27 @@ +// library-test.slang + +// A test to try out the basics of using libraries that can be linked (by downstream tools). +// (This is in contrast to Slang modules and Slangs own linkage mechanisms) + +// This didn't work for lib_6_2 when compiling via DXC (!). Even though it's stated elsewhere the feature is available from 6.1 + +//TEST:COMPILE: tests/library/library.slang -profile lib_6_3 -target dxil -o tests/library/library.dxil +//DISABLE_TEST:COMPILE: tests/library/library-test.slang -profile cs_6_3 tests/library/library.dxil -o tests/library/library-test.dxil + +// It seems that I can't just compile the source containing the entry point/stage with the library/s. +// Instead I have to compile all the parts with lib profile, and then link together at the end. + +//DISABLE_TEST:COMPARE_COMPUTE_EX:-slang -compute -xslang -r -xslang tests/serialization/serialized-module.slang-module -shaderobj + +extern int foo(int a); + +//TEST_INPUT:ubuffer(data=[0 0 0 0 ], stride=4):out,name outputBuffer +RWStructuredBuffer<int> outputBuffer; + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + int index = (int)dispatchThreadID.x; + + outputBuffer[index] = foo(index); +} diff --git a/tests/library/library.slang b/tests/library/library.slang new file mode 100644 index 000000000..a9e7e5e7a --- /dev/null +++ b/tests/library/library.slang @@ -0,0 +1,9 @@ +//TEST_IGNORE_FILE: + +// library.slang + +public int foo(int a) +{ + return a * a + 1; +} + |
