summaryrefslogtreecommitdiff
path: root/tests/bugs/gh-566.slang
blob: f1e53ba9ace600e0771fa8ad2ab2ada5aeca8f5f (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
// legalize-struct-init.slang

//TEST(compute):COMPARE_COMPUTE: -shaderobj
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
//TEST_INPUT:ubuffer(data=[4 3 2 1], stride=4):name inputBuffer


RWStructuredBuffer<uint> outputBuffer;
RWStructuredBuffer<uint> inputBuffer;

struct Helper
{
    RWStructuredBuffer<uint> o;
    RWStructuredBuffer<uint> i;
    uint                    t;  
};

void test(Helper h)
{
    h.o[h.t] = h.i[h.t] * 16 + h.t;    
}

void test(uint t)
{
    Helper h = { outputBuffer, inputBuffer, t };
    test(h);
}

[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
    uint tid = dispatchThreadID.x;
    test(tid);
}