blob: a7e49e5b5c9159ceb754cc9379b73894de28228a (
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
39
|
// out-opaque-type-in-struct.slang
// Test that a function/method can have an `out` parameter of
// aggregate type that includes an opaque type
//TEST(compute):COMPARE_COMPUTE:
//TEST(compute):COMPARE_COMPUTE:-slang -shaderobj -mtl
struct Things
{
int first;
RWStructuredBuffer<int> rest;
}
//TEST_INPUT:set gThings = new Things { 1, ubuffer(data=[2 3 4 5], stride=4) }
ConstantBuffer<Things> gThings;
void getThings(out Things outThings)
{
outThings = gThings;
}
int test(int val)
{
Things things;
getThings(things);
return things.first * (16 << val) + things.rest[val];
}
//TEST_INPUT:set gOutput = out ubuffer(data=[0 0 0 0], stride=4)
RWStructuredBuffer<int> gOutput;
[numthreads(4, 1, 1)]
void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
{
int tid = dispatchThreadID.x;
int inVal = tid;
int outVal = test(inVal);
gOutput[tid] = outVal;
}
|