summaryrefslogtreecommitdiffstats
path: root/tests/diagnostics/local-line.slang
blob: 8874aec1e6b1cc1001bd2d37fb402f174ed460fc (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//TEST:SIMPLE_LINE:-entry computeMain -target spirv -stage compute -emit-spirv-via-glsl
//TEST:SIMPLE_LINE:-entry computeMain -target dxil -profile cs_6_0 
//TEST:SIMPLE_LINE:-entry computeMain -target dxbc  -stage compute
//TEST:SIMPLE_LINE:-entry computeMain -target shader-dll -stage compute
//TEST:SIMPLE_LINE:-entry computeMain -capability cuda_sm_8_0 -target ptx -stage compute 
//TEST:SIMPLE_LINE(filecheck=CHECK):-entry computeMain -target spirv -stage compute -emit-spirv-via-glsl

//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
RWStructuredBuffer<int> outputBuffer;

int doThing(int a, int b) 
{
    while (b >= 0)
    {
        a 
        += 
        a;
    }
    
    return a;
}

[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
    int a = int(dispatchThreadID.x);
    int b = int(dispatchThreadID.y);
    int c = int(dispatchThreadID.z);
    int d = a + b * c;
    int e = d + c / 2;
    
    for (int i = 0; i < b; ++i)
    {
        if (e > 10 && (i & 2) != 0)
        {
            a += b; b -= c; c += c; d = d + e + a; e = a;
        }
        else
        {
            a = e; b = c + c; d += d + __SyntaxError(); e = doThing(e, int(dispatchThreadID.x));
            // CHECK: [[#@LINE-1]]
            
        }
    }
    
    outputBuffer[dispatchThreadID.x] = a + b + c + d + e;
}