summaryrefslogtreecommitdiffstats
path: root/tests/bugs/gh-3845-2.slang
blob: 06a3d1c999ade7cded8f6613d57d19145b5bb174 (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
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-shaderobj -output-using-type
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-shaderobj -vk -output-using-type

struct Foo {float v;};

namespace foo {
    typedef ::Foo Foo; // unexpected '::', expected identifier; works in dxc/hlsl

    float test(Foo f)
    {
        return f.v;
    }
}

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

[numthreads(4, 1, 1)]
[shader("compute")]
void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID)
{
    Foo f;
    f.v = 1.0;
    // CHECK: 1.0
    outputBuffer[0] = foo.test(f);
}