yum-mirror/slang

Making it easier to work with shaders

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

Ellie HermaszewskaTake into account existing initializer list type when performing coercions (#2641)94b2c6766

master
613 B30 linesraw
1// https://github.com/shader-slang/slang/issues/2189
2// See also ./c-style-cast-coerce.slang which represents the essence of this bug
3
4//TEST(compute):COMPARE_COMPUTE: -shaderobj
5//TEST(compute):COMPARE_COMPUTE: -shaderobj -vulkan
6
7//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
8RWStructuredBuffer<int> outputBuffer;
9
10struct S {};
11
12int f(S)
13{
14    return 1;
15}
16
17int f(float)
18{
19    return 2;
20}
21
22[shader("compute")]
23[numthreads(1,1,1)]
24void computeMain()
25{
26    outputBuffer[0] = f(float(0));
27    outputBuffer[1] = f((float)1);
28    outputBuffer[2] = f((float)0);
29    outputBuffer[3] = f((S)0);
30}