yum-mirror/slang

Making it easier to work with shaders

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

Yong HeUse two-stage parsing to disambiguate generic app and comparison. (#6281)7911c9437

master
656 B28 linesraw
1//TEST:COMPARE_COMPUTE(filecheck-buffer=CHECK): -output-using-type
2
3static const uint X_SIZE = 32;
4
5uint y<int x> (int y){return 0;}
6
7uint test(uint x)
8{
9    uint y = 0;
10    // With two stage parsing, we should be able to disambiguate this
11    // from a generic function call.
12    uint surround_mask = x +
13        y<3?1:x>(X_SIZE) // generic call or comparison?
14        ? 5 : 0;
15    return surround_mask;
16}
17
18//TEST_INPUT: set outputBuffer = out ubuffer(data=[0 0 0 0], stride=4)
19RWStructuredBuffer<uint> outputBuffer;
20
21[numthreads(1,1,1)]
22void computeMain()
23{
24    // CHECK: 1
25    outputBuffer[0] = test(1);
26    // CHECK: 5
27    outputBuffer[1] = test(33);
28}