yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
613a29aff
master
1// precompiled-dxil-generics.slang 2 3// A test that uses slang-modules with embedded precompiled DXIL 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 dxil. 8 9//TEST(windows):COMPILE: tests/library/export-library-generics.slang -o tests/library/export-library-generics.slang-module -target dxil -embed-downstream-ir -profile lib_6_6 -incomplete-library 10//TEST(windows):COMPILE: tests/library/precompiled-dxil-generics.slang -target dxil -stage anyhit -entry anyhit -o tests/library/linked.dxil 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}