forked from shader-slang/slang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoverload-ambiguous-1.slang
65 lines (55 loc) · 1.48 KB
/
overload-ambiguous-1.slang
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// https://github.com/shader-slang/slang/issues/4476
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-cuda -compute -shaderobj
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-cpu -compute -shaderobj
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-slang -compute -shaderobj
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-slang -compute -dx12 -shaderobj
//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-vk -compute -shaderobj
//TEST_INPUT:ubuffer(data=[0 0 0], stride=4):out,name=outputBuffer
RWStructuredBuffer<uint> outputBuffer;
namespace A1
{
uint func()
{
return 1u;
}
namespace A2
{
uint func()
{
return 2u;
}
namespace A3
{
uint func()
{
return 3u;
}
uint test2()
{
return func(); // choose A3::func()
}
}
namespace A4
{
uint test()
{
return func(); // choose A2::func()
}
}
}
}
[numthreads(1, 1, 1)]
[shader("compute")]
void computeMain(uint3 threadID: SV_DispatchThreadID)
{
using namespace A1;
using namespace A1::A2;
using namespace A1::A2::A3;
using namespace A1::A2::A4;
outputBuffer[0] = test();
// BUF: 2
outputBuffer[1] = func(); // choose the A1::func()
// BUF-NEXT: 1
outputBuffer[2] = test2();
// BUF-NEXT: 3
}