yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

cheneym2Precompiled SPIR-V import support (#5048)613a29aff

master
1.0 KiB31 linesraw
1// precompiled-spirv-pointer-param.slang
2
3// A test that uses slang-modules with embedded precompiled SPIRV and a library containing 
4// a function with a pointer parameter.
5// The test compiles a library slang (module-library-pointer-param.slang) with -embed-downstream-ir then links the
6// library to entrypoint slang (this file).
7// The test passes if there is no errror thrown.
8// TODO: Check if final linkage used only the precompiled spirv.
9
10//TEST:COMPILE: tests/library/module-library-pointer-param.slang -o tests/library/module-library-pointer-param.slang-module -target spirv -embed-downstream-ir -incomplete-library
11//TEST:COMPILE: tests/library/precompiled-spirv-pointer-param.slang -target spirv -stage anyhit -entry anyhit -o tests/library/linked.spirv
12
13import "module-library-pointer-param";
14
15struct Payload
16{
17    int val;
18}
19
20struct Attributes
21{
22    float2 bary;
23}
24
25[vk::push_constant] int* g_int;
26
27[shader("anyhit")]
28void anyhit(inout Payload payload, Attributes attrib)
29{
30    payload.val = ptrFunc(g_int);
31}