diff options
| author | cheneym2 <acheney@nvidia.com> | 2024-09-05 14:59:28 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-05 11:59:28 -0700 |
| commit | 313677160a186efebf83fab4df7d08dd119a5cd2 (patch) | |
| tree | e12e159846f0b7b0e3567d028ad4a57cd9f001aa /tests/library/precompiled-spirv-generics.slang | |
| parent | 33e8bfd43f66613f6f834fb0e1816ef43071f2e4 (diff) | |
Initial -embed-spirv support (#4974)
* Initial -embed-spirv support
Add support for SPIR-V precompilation using the framework
established for DXIL.
Work on #4883
* SLANG_UNUSED
* Add linkage attributes to exported spirv functions
* Combine DXIL and SPIRV paths
* Whitespace fix
* Merge remaining precompiled spirv/dxil paths
* Change inst accessors to return codegentarget
* Add unit test for precompiled spirv
---------
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tests/library/precompiled-spirv-generics.slang')
| -rw-r--r-- | tests/library/precompiled-spirv-generics.slang | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/library/precompiled-spirv-generics.slang b/tests/library/precompiled-spirv-generics.slang new file mode 100644 index 000000000..a55f58513 --- /dev/null +++ b/tests/library/precompiled-spirv-generics.slang @@ -0,0 +1,28 @@ +// precompiled-spirv-generics.slang + +// A test that uses slang-modules with embedded precompiled SPIRV and a library containing generics. +// The test compiles a library slang (export-library-generics.slang) with -embed-downstream-ir then links the +// library to entrypoint slang (this file). +// The test passes if there is no errror thrown. +// TODO: Check if final linkage used only the precompiled spirv. + +//TEST:COMPILE: tests/library/export-library-generics.slang -o tests/library/export-library-generics.slang-module -target spirv -embed-downstream-ir -profile lib_6_6 -incomplete-library +//TEST:COMPILE: tests/library/precompiled-spirv-generics.slang -target spirv -stage anyhit -entry anyhit -o tests/library/linked.spirv + +import "export-library-generics"; + +struct Payload +{ + int val; +} + +struct Attributes +{ + float2 bary; +} + +[shader("anyhit")] +void anyhit(inout Payload payload, Attributes attrib) +{ + payload.val = normalFunc(x * y) + normalFuncUsesGeneric(y); +} |
