summaryrefslogtreecommitdiffstats
path: root/tests/compute/buffer-type-splitting.slang
blob: 0ccad15de3221a5021610926f40439ec1206572f (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
//TEST(compute):COMPARE_COMPUTE:-cpu
//TEST(compute):COMPARE_COMPUTE: -shaderobj

//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
//TEST_INPUT:ubuffer(data=[0 2 3 3]):name=s[0].a
//TEST_INPUT:ubuffer(data=[4 5 6 7]):name=s[1].a
//TEST_INPUT:ubuffer(data=[8 9 10 11]):name=s[0].b
//TEST_INPUT:ubuffer(data=[12 13 14 15]):name=s[1].b

RWStructuredBuffer<int> outputBuffer;

struct S
{
	RWByteAddressBuffer a;
	RWByteAddressBuffer b;
};
S s[2];

[numthreads(4, 1, 1)]
void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
{
    int i = dispatchThreadID.x;

    int val = int(
          s[0].a.Load(i * 4)
        + s[1].a.Load(i * 4)*16
        + s[0].b.Load(i * 4)*256
        + s[1].b.Load(i * 4)*4096);

    outputBuffer[i] = val; 
}