yum-mirror/slang

Making it easier to work with shaders

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

Jay KwakFix typo SV_DispatchThreadIndex (#4962)e9f52a694

master
756 B33 linesraw
1//TEST_DISABLED:EVAL:
2
3// Note: This test has been disabled as part of introducing
4// the IR-level type system, because it changes the overall
5// structure of IR moduels quite a bit, and no user code
6// actually relies on the serialized IR or VM.
7//
8// This test should ideally be re-enabled once work is
9// done to revamp the serialized bytecode format into
10// something more essential to the compiler (e.g., for
11// modular separate compilation).
12
13StructuredBuffer<int> input;
14RWStructuredBuffer<int> output;
15
16int factorial(int n)
17{
18    int result = 1;
19    while(n > 0)
20    {
21        result *= n;
22        n--;
23    }
24    return result;
25}
26
27[numthreads(1, 1, 1)]
28void main(
29    uint tid   : SV_DispatchThreadID)
30{
31    output[tid] = factorial(input[tid]);
32}
33