summaryrefslogtreecommitdiffstats
path: root/tests/bugs/gh-7431.slang
blob: 6f1c1cb13b4752104677f9feacf4e2495b7f705d (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
37
38
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECKOUT):-vk -compute -output-using-type
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECKOUT):-hlsl -compute -output-using-type

// CHECKOUT:      10
// CHECKOUT-NEXT: 20
// CHECKOUT-NEXT: 30
// CHECKOUT-NEXT: 40

struct Test {
    int f_int;
};

ParameterBlock<Test> pb_struct;
uniform Test u_struct;
uniform Test u_struct_array[2];

RWStructuredBuffer<int> results;

//TEST_INPUT: set pb_struct = new Test{10};
//TEST_INPUT: uniform(data=[20 0 0 0]):name=u_struct.f_int
//TEST_INPUT: uniform(data=[30 0 0 0]):name=u_struct_array[0].f_int
//TEST_INPUT: uniform(data=[40 0 0 0]):name=u_struct_array[1].f_int

//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=results

[shader("compute")]
[numthreads(1, 1, 1)]
void computeMain(uint3 tid: SV_DispatchThreadID)
{
    if (any(tid != uint3(0)))
        return;

    results[0] = pb_struct.f_int;
    results[1] = u_struct.f_int;
    results[2] = u_struct_array[0].f_int;
    results[3] = u_struct_array[1].f_int;
}