yum-mirror/slang

Making it easier to work with shaders

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

cheneym2Initial -embed-spirv support (#4974)313677160

master
1.1 KiB23 linesraw
1// precompiled-dxil.slang
2
3// A test that uses slang-modules with embedded precompiled DXIL.
4// The test compiles both library slang (export-library.slang) to a slang-module using -embed-downstream-ir.
5// The result is linked together with this module (precompiled-dxil.slang) in a second slangc invocation.
6// Internally, slang does not use the IR in the modules to link, but rather their embedded DXIL.
7// The test passes if there is no errror thrown.
8// TODO: Check if final linkage used only the precompiled dxil.
9
10//TEST(windows):COMPILE: tests/library/export-library.slang -o tests/library/export-library.slang-module -target dxil -embed-downstream-ir -profile lib_6_6 -incomplete-library
11//TEST(windows):COMPILE: tests/library/precompiled-dxil.slang tests/library/export-library.slang-module -target dxil -entry computeMain -profile cs_6_6 -o tests/library/linked.dxil
12
13extern int foo(int a);
14
15RWStructuredBuffer<int> outputBuffer;
16
17[shader("compute")]
18void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
19{
20    int index = (int)dispatchThreadID.x;
21
22    outputBuffer[index] = foo(index);
23}