diff options
| author | kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> | 2025-06-25 12:01:54 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-25 10:01:54 -0700 |
| commit | d48f050cb0209a4ba9819a094ffd1e7a7c2524ee (patch) | |
| tree | a2ab97ad7c5df7d05f0a91f6c272bf25396754c0 /tests/library | |
| parent | 7e8c85e85440c1fea42236a8ef8286e1ce1638ce (diff) | |
Fix ambiguous reference for 'extern' and 'export' (#7515)
Close #7509.
When there are both `export` and `extern` decls in lookup result,
we should remove all `extern` decls.
Diffstat (limited to 'tests/library')
| -rw-r--r-- | tests/library/ambiguous-extern-export-entry.slang | 32 | ||||
| -rw-r--r-- | tests/library/ambiguous-extern-export-lib1.slang | 13 | ||||
| -rw-r--r-- | tests/library/ambiguous-extern-export-lib2.slang | 15 |
3 files changed, 60 insertions, 0 deletions
diff --git a/tests/library/ambiguous-extern-export-entry.slang b/tests/library/ambiguous-extern-export-entry.slang new file mode 100644 index 000000000..afa0ed8c9 --- /dev/null +++ b/tests/library/ambiguous-extern-export-entry.slang @@ -0,0 +1,32 @@ +//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUFFER):-slang -compute -shaderobj +//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUFFER):-slang -compute -dx12 -shaderobj +//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUFFER):-vk -compute -shaderobj +//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUFFER):-cpu -compute -shaderobj + +import "ambiguous-extern-export-lib1.slang"; +import "ambiguous-extern-export-lib2.slang"; + +export static const int call_data_len = 6; +export static const int call_group_vector[call_data_len] = {1,2,3,4,5,6}; + +//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer<int> outputBuffer; + +[shader("compute")] +[numthreads(1, 1, 1)] +void computeMain() +{ + initCallId1(); + initCallId2(); + + for (int i = 0; i < call_data_len; i++) + { + outputBuffer[i] = call_id_1[i] + call_id_2[i]; + } + // BUFFER: 2 + // BUFFER-NEXT: 4 + // BUFFER-NEXT: 6 + // BUFFER-NEXT: 8 + // BUFFER-NEXT: A + // BUFFER-NEXT: C +} diff --git a/tests/library/ambiguous-extern-export-lib1.slang b/tests/library/ambiguous-extern-export-lib1.slang new file mode 100644 index 000000000..17dc0734c --- /dev/null +++ b/tests/library/ambiguous-extern-export-lib1.slang @@ -0,0 +1,13 @@ +module "ambiguous-extern-export-lib1.slang"; + +public extern static const int call_data_len; +public extern static const int[call_data_len] call_group_vector; +public static int[call_data_len] call_id_1 = {}; + +public void initCallId1() +{ + for (int i = 0; i < call_data_len; i++) + { + call_id_1[i] = call_group_vector[i]; + } +} diff --git a/tests/library/ambiguous-extern-export-lib2.slang b/tests/library/ambiguous-extern-export-lib2.slang new file mode 100644 index 000000000..08d01fb04 --- /dev/null +++ b/tests/library/ambiguous-extern-export-lib2.slang @@ -0,0 +1,15 @@ + +module "ambiguous-extern-export-lib2.slang"; + +public extern static const int call_data_len; +public extern static const int[call_data_len] call_group_vector; + +public static int[call_data_len] call_id_2 = {}; + +public void initCallId2() +{ + for (int i = 0; i < call_data_len; i++) + { + call_id_2[i] = call_group_vector[i]; + } +} |
