blob: 593ee81f15c722d174dad235de38432cad801d62 (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
/* The test here uses struct inheritance but has a field with the same name in the derived type.
This error is for the MyStruct2 version.
.slang(20): error 39999: no overload for '==' applicable to arguments of type (overload group, overload group)
return a.a == b.a;
No error/warning is given for the shadowing of MyStruct.a.
*/
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
RWStructuredBuffer<float> outputBuffer;
struct MyStruct
{
int a = 10;
};
struct MyStruct2 : MyStruct
{
int a = 10;
};
bool isEqual(MyStruct a, MyStruct b)
{
return a.a == b.a;
}
bool isEqual(MyStruct2 a, MyStruct2 b)
{
return a.a == b.a;
}
[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
int index = dispatchThreadID.x;
MyStruct a = { 1 };
MyStruct b = { 2 };
bool res = isEqual(a, b);
outputBuffer[index] = 1 + int(res);
}
|