summaryrefslogtreecommitdiffstats
path: root/tests/bugs
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2021-04-14 12:30:58 -0400
committerGitHub <noreply@github.com>2021-04-14 12:30:58 -0400
commit97f302eef584ac5c85baff74d8f453d0067705ae (patch)
tree1c7c57b9bd418aaa07fc6cf96c413c6b906be74f /tests/bugs
parent36b8217fcb4b8ea4566470635f492331171da7f3 (diff)
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.
Diffstat (limited to 'tests/bugs')
-rw-r--r--tests/bugs/vec-init.slang33
-rw-r--r--tests/bugs/vec-init.slang.expected.txt4
2 files changed, 37 insertions, 0 deletions
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<float> 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