summaryrefslogtreecommitdiffstats
path: root/tests/bugs/c-style-cast-overload.slang
blob: 0583942712d245e72921e80568b8faa9e2d0d78c (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
// https://github.com/shader-slang/slang/issues/2189
// See also ./c-style-cast-coerce.slang which represents the essence of this bug

//TEST(compute):COMPARE_COMPUTE: -shaderobj
//TEST(compute):COMPARE_COMPUTE: -shaderobj -vulkan

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

struct S {};

int f(S)
{
    return 1;
}

int f(float)
{
    return 2;
}

[shader("compute")]
[numthreads(1,1,1)]
void computeMain()
{
    outputBuffer[0] = f(float(0));
    outputBuffer[1] = f((float)1);
    outputBuffer[2] = f((float)0);
    outputBuffer[3] = f((S)0);
}