yum-mirror/slang

Making it easier to work with shaders

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

Harsh Aggarwal (NVIDIA)Fix#8082: Batch-6: Enable cuda tests (#8266)53fa12e1b

master
816 B37 linesraw
1//TEST(compute):COMPARE_COMPUTE:-cpu -xslang -disable-specialization
2//TEST(compute):COMPARE_COMPUTE:-cuda -xslang -disable-specialization
3
4// Test basic dynamic dispatch code gen
5
6[anyValueSize(16)]
7interface IInterface
8{
9	static int Compute(int inVal);
10};
11
12int GenericCompute<T:IInterface>(int inVal)
13{
14	return T.Compute(inVal);
15}
16
17struct Impl : IInterface
18{
19	static int Compute(int inVal) { return inVal * inVal; }
20};
21
22int test(int inVal)
23{
24	return GenericCompute<Impl>(inVal);
25}
26
27//TEST_INPUT:ubuffer(data=[0 1 2 3], stride=4):out,name=outputBuffer
28RWStructuredBuffer<int> outputBuffer : register(u0);
29
30[numthreads(4, 1, 1)]
31void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
32{
33	uint tid = dispatchThreadID.x;
34	int inVal = outputBuffer[tid];
35	int outVal = test(inVal);
36	outputBuffer[tid] = outVal;
37}