yum-mirror/slang

Making it easier to work with shaders

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

Jay KwakFix false negative result for CUDA with recent versions (#7409)63ca2325d

master
990 B34 linesraw
1// syntax-error-op-line-2.slang
2
3// NOTE! That although this is a 'diagnostic' like test, it tests using downstream compiler
4// the downstream compiler being present is a requirement, so we mark as a 'TEST' so that
5// those tests are made.
6
7//TEST:SIMPLE(filecheck=CHK):-entry computeMain -target spirv -emit-spirv-via-glsl
8//TEST:SIMPLE(filecheck=CHK):-entry computeMain -target dxil -profile cs_6_0
9//TEST:SIMPLE(filecheck=CHK):-entry computeMain -target dxbc
10//TEST:SIMPLE(filecheck=CHK):-entry computeMain -target shader-dll
11//TEST:SIMPLE(filecheck=CHK):-entry computeMain -target ptx
12
13// Here the thing being checked is error reporting around return, and +=
14
15int doSomething(int a)
16{
17    a += a;
18
19    return a
20    +=
21    __SyntaxError();
22    //CHK:([[#@LINE-1]]): error
23}
24
25[shader("compute")]
26[numthreads(4, 1, 1)]
27void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
28{
29    int id = int(dispatchThreadID.x);
30
31    int v = int(dispatchThreadID.y);
32
33    v += doSomething(id);
34}