summaryrefslogtreecommitdiffstats
path: root/tests/metal/empty-struct-remove.slang
blob: 0ea9269539d5a4652609db4cc547646f62e5da58 (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
31
32
33
34
35
36
//TEST:SIMPLE(filecheck=LIB):-target metallib -entry computeMain -stage compute
//TEST:SIMPLE(filecheck=METAL):-target metal -entry computeMain -stage compute
//TEST(compute, metal):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-metal -compute -output-using-type
//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-vk -compute -output-using-type

// METAL-NOT: struct emptyStruct
struct emptyStruct
{
    void set(RWStructuredBuffer<int> buffer, int value) {buffer[0] = value;}
}


struct MyStruct
{
    RWStructuredBuffer<int> buffer;
    int value;
    void set()
    {
        e.set(buffer, value);
    }
    emptyStruct e;
}

//TEST_INPUT: set param = new MyStruct{ out ubuffer(data=[0]), 5, {}}
ParameterBlock<MyStruct> param;

// LIB: @computeMain
[shader("compute")]
[numthreads(1, 1, 1)]
void computeMain(
    uint tid: SV_DispatchThreadID,
)
{
    // BUF: 5
    param.set();
}