summaryrefslogtreecommitdiffstats
path: root/tests/experiments/generic/interface.slang
blob: d1d8c60abed6bd6bffb8b981528e3b5a81c2d098 (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
//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj

/* Tests around interface/generics

.slang(7): error 20001: unexpected '<', expected '{'
interface IThing<T>
*/

// Docs say this should work...
// https://github.com/shader-slang/slang/blob/master/docs/language-reference/07-declarations.md

interface IThing<T>
{
    T get();
};

struct X : IThing<int>
{
    int get() { return 10; }
};

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

    X x;
    IThing<int> i = x;
    
	outputBuffer[index] = i.get();
}