summaryrefslogtreecommitdiffstats
path: root/tools/gfx-unit-test/link-time-constant.slang
blob: 64a4f0befcb4c6f020a6eb18e3521319801b70b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
extern static const bool turnOnFeature;
extern static const float constValue;
extern static const uint numthread = 0;
extern static const int arraySize = -1;

// Main entry-point. Write some value into buffer depending on link
// time constant.
[shader("compute")]
[numthreads(numthread, 1, 1)]
void computeMain(
    uint3 sv_dispatchThreadID: SV_DispatchThreadID,
    uniform RWStructuredBuffer<float> buffer)
{
    int array[arraySize];

    array[sv_dispatchThreadID.x] = sv_dispatchThreadID.x;
    if (turnOnFeature)
    {
        buffer[array[0]] = constValue;
    }
    else
    {
        buffer[0] = -1.0;
    }
}