yum-mirror/slang

Making it easier to work with shaders

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

Yong HeAdd inherit interface test. (#2800)7f091478e

master
716 B38 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 IA
7{
8    int doThing(int a);
9};
10
11interface IB : IA
12{
13    int anotherThing(int a);
14};
15
16struct Struct : IB
17{
18    int doThing(int a) { return a + 1; }
19    int anotherThing(int a) { return a * a; }
20};
21
22int doThing<B : IB>(B b, int c)
23{
24    return b.doThing(c) + b.anotherThing(c);
25}
26
27[numthreads(4, 1, 1)]
28void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
29{
30	uint tid = dispatchThreadID.x;
31
32    Struct s;
33    int v = doThing(s, int(tid));
34    
35	float inVal = float(tid + v);
36
37	outputBuffer[tid] = inVal;
38}