diff options
| author | kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> | 2024-09-11 18:48:25 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-11 18:48:25 -0500 |
| commit | 003df7e9993cdcceebf508ee4bfd846292263caf (patch) | |
| tree | e4d94ccc77d96052fbfdc72387a37bd5d26e52a8 /tests/bugs | |
| parent | 9fd53811651004903eaf0cbcae712a70304ea0b1 (diff) | |
Fix the issue in resolving the overload functions (#5060)
Diffstat (limited to 'tests/bugs')
| -rw-r--r-- | tests/bugs/overload-ambiguous.slang | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/bugs/overload-ambiguous.slang b/tests/bugs/overload-ambiguous.slang new file mode 100644 index 000000000..1b74cb68c --- /dev/null +++ b/tests/bugs/overload-ambiguous.slang @@ -0,0 +1,48 @@ +// 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], stride=4):out,name=outputBuffer +RWStructuredBuffer<uint> outputBuffer; + + +uint getData() +{ + return 1u; +} + +struct DataObtainer +{ + uint data; + uint getData() + { + return data; + } + + uint getValue() + { + return getData(); // will call DataObtainer::getData() + } + + uint getValue2() + { + return ::getData(); // will call global getData() + } +} + +RWStructuredBuffer<uint> output; + +[numthreads(1, 1, 1)] +[shader("compute")] +void computeMain(uint3 threadID: SV_DispatchThreadID) +{ + DataObtainer obtainer = {2u}; + outputBuffer[0] = obtainer.getValue(); + outputBuffer[1] = obtainer.getValue2(); + // BUF: 2 + // BUF-NEXT: 1 +} |
