yum-mirror/slang

Making it easier to work with shaders

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

Yong HeRefactor compiler option representations. (#3598)4d20fd329

master
533 B20 linesraw
1// link-time-options.slang
2
3// Test that we can pass in additional compiler options
4// at link time.
5
6// Lowers to `DOWNSTREAM_VALUE`, a macro that we will define
7// for downstream compilation through link-time options.
8float getMacroDefinedForDownstream()
9{
10    __intrinsic_asm "(DOWNSTREAM_VALUE)";
11}
12
13[shader("compute")]
14[numthreads(4,1,1)]
15void computeMain(
16    uint3 sv_dispatchThreadID : SV_DispatchThreadID,
17    uniform RWStructuredBuffer<float> buffer)
18{
19    buffer[sv_dispatchThreadID.x] = getMacroDefinedForDownstream();
20}