blob: ed4f5722d16462d65846263ea92e7dd7ebd40d6c (
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
RWStructuredBuffer<float> outputBuffer;
interface IFoo
{
float sample();
}
//TEST_INPUT: type_conformance Bar:IBar = 0
[anyValueSize(64)]
interface IBar
{
float sample();
}
//TEST_INPUT: type_conformance Foo:IFoo = 0
struct Foo : IFoo
{
float3 albedo;
float sample()
{
return albedo.x;
}
}
struct Bar : IBar
{
IFoo foo;
float sample()
{
return foo.sample();
}
}
struct AnyVal
{
uint data[16];
}
[numthreads(4, 1, 1)]
void computeMain(int3 dispatchThreadID: SV_DispatchThreadID)
{
int index = dispatchThreadID.x;
Foo f;
f.albedo = float3(1.0);
Bar bar;
bar.foo = f;
AnyVal data = reinterpret<AnyVal>(bar);
IBar dynBar = createDynamicObject<IBar>(0, data);
outputBuffer[index] = dynBar.sample();
}
|