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

/* It appears the use of a generic defined within a function appears to trigger a crash


```
void Type::accept(ITypeVisitor* visitor, void* extra)
```

As this is nullptr.
*/

RWStructuredBuffer<float> outputBuffer;

int doThing()
{    
	int getValue<let N : int>() { return N; }
    
    return getValue<10>();
}

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

	float inVal = float(tid);

	outputBuffer[tid] = doThing();
}