yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

skallweitNVenable more metal tests (#4326)712ce653d

master
948 B56 linesraw
1//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type
2
3//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
4RWStructuredBuffer<float> outputBuffer;
5
6interface IFoo
7{
8    float sample();
9}
10
11//TEST_INPUT: type_conformance Bar:IBar = 0
12[anyValueSize(64)]
13interface IBar
14{
15    float sample();
16}
17
18//TEST_INPUT: type_conformance Foo:IFoo = 0
19struct Foo : IFoo
20{
21    float3 albedo;
22    float sample()
23    {
24        return albedo.x;
25    }
26}
27
28struct Bar : IBar
29{
30    IFoo foo;
31    float sample()
32    {
33        return foo.sample();
34    }
35}
36
37struct AnyVal
38{
39    uint data[16];
40}
41
42[numthreads(4, 1, 1)]
43void computeMain(int3 dispatchThreadID: SV_DispatchThreadID)
44{
45    int index = dispatchThreadID.x;
46
47    Foo f;
48    f.albedo = float3(1.0);
49    Bar bar;
50    bar.foo = f;
51
52    AnyVal data = reinterpret<AnyVal>(bar);
53    IBar dynBar = createDynamicObject<IBar>(0, data);
54
55    outputBuffer[index] = dynBar.sample();
56}