yum-mirror/slang

Making it easier to work with shaders

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

Tim FoleyConvert more tests to use shader objects (#1659)2a5d5b323

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