yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
613a29aff
master
1// precompiled-spirv-generics.slang 2 3// A test that uses slang-modules with embedded precompiled SPIRV and a library containing generics. 4// The test compiles a library slang (export-library-generics.slang) with -embed-downstream-ir then links the 5// library to entrypoint slang (this file). 6// The test passes if there is no errror thrown. 7// TODO: Check if final linkage used only the precompiled spirv. 8 9//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 10//TEST:COMPILE: tests/library/precompiled-spirv-generics.slang -target spirv -stage anyhit -entry anyhit -o tests/library/linked.spirv 11 12import "export-library-generics"; 13 14struct Payload 15{ 16 int val; 17} 18 19struct Attributes 20{ 21 float2 bary; 22} 23 24[shader("anyhit")] 25void anyhit(inout Payload payload, Attributes attrib) 26{ 27 payload.val = normalFunc(floor(x * y), x) + normalFuncUsesGeneric(y); 28}