From f875d3f5ba9c1ddc6aa9a0960efd5ab27ae4e4c9 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 9 Aug 2023 20:11:09 -0700 Subject: Support implciit casted swizzled lvalue. (#3077) * Support implciit casted swizzled lvalue. * Fix warnings. * Fix. * fix comment. * Prefer mangled linkage name for global params. * Update tests. --------- Co-authored-by: Yong He --- tests/bugs/gh-3075.slang | 15 +++++++++++++++ tests/bugs/gh-3075.slang.expected.txt | 2 ++ tests/bugs/implicit-cast.slang | 18 ++++++++++++++++++ tests/bugs/implicit-cast.slang.expected.txt | 1 + 4 files changed, 36 insertions(+) create mode 100644 tests/bugs/gh-3075.slang create mode 100644 tests/bugs/gh-3075.slang.expected.txt create mode 100644 tests/bugs/implicit-cast.slang create mode 100644 tests/bugs/implicit-cast.slang.expected.txt (limited to 'tests/bugs') diff --git a/tests/bugs/gh-3075.slang b/tests/bugs/gh-3075.slang new file mode 100644 index 000000000..098d5b9ac --- /dev/null +++ b/tests/bugs/gh-3075.slang @@ -0,0 +1,15 @@ +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -profile sm_6_0 -use-dxil -output-using-type +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx11 -profile sm_5_0 -output-using-type + +//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -output-using-type +//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer + +RWStructuredBuffer outputBuffer; + +[numthreads(1, 1, 1)] +void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID) +{ + uint3 vLookup = 3; + vLookup.yx += int2(1, 2); // calling += (inout int2, int2). + outputBuffer[dispatchThreadID.x] = vLookup.x; // expect 5 +} diff --git a/tests/bugs/gh-3075.slang.expected.txt b/tests/bugs/gh-3075.slang.expected.txt new file mode 100644 index 000000000..65942e5f5 --- /dev/null +++ b/tests/bugs/gh-3075.slang.expected.txt @@ -0,0 +1,2 @@ +type: int32_t +5 \ No newline at end of file diff --git a/tests/bugs/implicit-cast.slang b/tests/bugs/implicit-cast.slang new file mode 100644 index 000000000..2ee62cc87 --- /dev/null +++ b/tests/bugs/implicit-cast.slang @@ -0,0 +1,18 @@ +//TEST(compute):COMPARE_COMPUTE:-vk -shaderobj + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name gBuffer +RWStructuredBuffer gBuffer; + +int getX(int4 v) { return v.x; } + +[numthreads(1, 1, 1)] +void computeMain(uint3 tid: SV_DispatchThreadID, uint GI: SV_GroupIndex) +{ + if (GI< 1) + { + uint LdsCoord = GI; + uint a = gBuffer[LdsCoord]; + LdsCoord += 1; + gBuffer[LdsCoord] = 1; + } +} diff --git a/tests/bugs/implicit-cast.slang.expected.txt b/tests/bugs/implicit-cast.slang.expected.txt new file mode 100644 index 000000000..d8263ee98 --- /dev/null +++ b/tests/bugs/implicit-cast.slang.expected.txt @@ -0,0 +1 @@ +2 \ No newline at end of file -- cgit v1.2.3