yum-mirror/slang

Making it easier to work with shaders

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

jsmall-nvidiaLanguage experiments (#2068)447b7e0e2

master
1003 B48 linesraw
1//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
2
3/* The test here uses struct inheritance but has a field with the same name in the derived type. 
4
5This error is for the MyStruct2 version. 
6
7.slang(20): error 39999: no overload for '==' applicable to arguments of type (overload group, overload group)
8    return a.a == b.a;
9
10No error/warning is given for the shadowing of MyStruct.a.
11 */
12
13//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
14RWStructuredBuffer<float> outputBuffer;
15
16struct MyStruct
17{
18    int a = 10;
19};
20
21struct MyStruct2 : MyStruct
22{
23    int a = 10;
24};
25
26bool isEqual(MyStruct a, MyStruct b)
27{
28    return a.a == b.a;
29}
30
31bool isEqual(MyStruct2 a, MyStruct2 b)
32{
33    return a.a == b.a;
34}
35             
36[numthreads(4, 1, 1)]
37void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
38{
39    int index = dispatchThreadID.x;
40
41    MyStruct a = { 1 };
42    MyStruct b = { 2 };
43    
44    bool res = isEqual(a, b);
45
46	outputBuffer[index] = 1 + int(res);
47}
48