yum-mirror/slang

Making it easier to work with shaders

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

RonanFixed name mangling of generic extensions (#6671)dbf05f8dc

master
724 B42 linesraw
1// Test that multiple functions from different extensions are properly linked.
2
3//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -shaderobj
4interface IValuable
5{
6	int getValue();
7};
8
9__generic <Int : __BuiltinIntegerType>
10extension Int : IValuable
11{
12	int getValue()
13	{
14		return 0;
15	}
16};
17
18__generic <Float : __BuiltinFloatingPointType>
19extension Float : IValuable
20{
21	int getValue()
22	{
23		return 1;
24	}
25};
26
27//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
28RWStructuredBuffer<int> outputBuffer;
29
30[shader("compute")]
31[numthreads(1, 1, 1)]
32void computeMain()
33{
34	uint i = 0;
35	float f = float(i) / float(10);	
36
37	// CHECK: 0
38	outputBuffer[0] = i.getValue();
39
40	// CHECK: 1
41	outputBuffer[1] = f.getValue();
42}