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
1.1 KiB41 linesraw
1// syntax-error-op-line-3.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//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
14RWStructuredBuffer<int> outputBuffer;
15
16// Here the thing being checked is error reporting around return, and +=
17
18[__unsafeForceInlineEarly]
19int doSomething(int a)
20{
21    a += a;
22
23    return a
24    +=
25    __SyntaxError();
26}
27
28[shader("compute")]
29[numthreads(4, 1, 1)]
30void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
31{
32    int id = int(dispatchThreadID.x);
33
34    int v = int(dispatchThreadID.y);
35
36
37    //CHK:([[#@LINE+1]]): error
38    v += doSomething(id);
39
40    outputBuffer[id] = v;
41}