From 97f302eef584ac5c85baff74d8f453d0067705ae Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 14 Apr 2021 12:30:58 -0400 Subject: Fix for vector initialization combinations (#1794) * #include an absolute path didn't work - because paths were taken to always be relative. * Made vector init combinations explicit. * Add test for vector initialization. * Small comment change - really just to retrigger TC. --- tests/bugs/vec-init.slang | 33 +++++++++++++++++++++++++++++++++ tests/bugs/vec-init.slang.expected.txt | 4 ++++ 2 files changed, 37 insertions(+) create mode 100644 tests/bugs/vec-init.slang create mode 100644 tests/bugs/vec-init.slang.expected.txt (limited to 'tests') diff --git a/tests/bugs/vec-init.slang b/tests/bugs/vec-init.slang new file mode 100644 index 000000000..155073ac2 --- /dev/null +++ b/tests/bugs/vec-init.slang @@ -0,0 +1,33 @@ +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -shaderobj +//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer +RWStructuredBuffer outputBuffer; + +[numthreads(4,1,1)] +void computeMain(uint2 dispatchID : SV_DispatchThreadID) +{ + float a = dispatchID.x * 0.5f; + float b = dispatchID.x + 1.0f; + + float2 c2_0 = float2( a, b); + + float3 c3_0 = float3( a, b, a); + float3 c3_1 = float3( float2(a, b), a); + float3 c3_2 = float3( b, float2(a, b)); + + float4 c4_0 = float4(a, b, a, b); + float4 c4_1 = float4(float2(a, b), a, b); + float4 c4_2 = float4(a, float2(b, a), b); + float4 c4_3 = float4(a, b, float2(a, b)); + float4 c4_4 = float4(float2(a, b), float2(a, b)); + float4 c4_5 = float4(float3(a, b, a), a); + float4 c4_6 = float4(a, float3(a, b, a)); + + float r = c2_0.x + + c3_0.y + c3_1.z + c3_2.x + + c4_0.x + c4_1.x + c4_2.x + c4_3.x + c4_4.x + c4_5.x + c4_6.x; + + outputBuffer[dispatchID.x] = r; +} \ No newline at end of file diff --git a/tests/bugs/vec-init.slang.expected.txt b/tests/bugs/vec-init.slang.expected.txt new file mode 100644 index 000000000..a8dfa1453 --- /dev/null +++ b/tests/bugs/vec-init.slang.expected.txt @@ -0,0 +1,4 @@ +40000000 +41080000 +41700000 +41AC0000 -- cgit v1.2.3