Add writing to invalid multisample indices tests
authorJuha Heiskanen <juha.heiskanen@siru.fi>
Tue, 11 May 2021 13:02:55 +0000 (16:02 +0300)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 28 May 2021 08:28:22 +0000 (08:28 +0000)
In these new tests, we check that writes to invalid sample indices are
correctly discarded.

Components: Vulkan

VK-GL-CTS Issue: 2310

New tests:
dEQP-VK.texture.multisample.invalid_sample_index.*

Change-Id: I1feb6f8d44c6cdc526eb5b3ab1d045cd3a181b17

android/cts/master/vk-master-2021-03-01/texture.txt
android/cts/master/vk-master/texture.txt
external/vulkancts/data/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_16.amber [new file with mode: 0644]
external/vulkancts/data/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_2.amber [new file with mode: 0644]
external/vulkancts/data/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_32.amber [new file with mode: 0644]
external/vulkancts/data/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_4.amber [new file with mode: 0644]
external/vulkancts/data/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_64.amber [new file with mode: 0644]
external/vulkancts/data/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_8.amber [new file with mode: 0644]
external/vulkancts/modules/vulkan/texture/vktTextureMultisampleTests.cpp
external/vulkancts/mustpass/master/vk-default/texture.txt

index 08ad010..e0d71d9 100644 (file)
@@ -3990,4 +3990,10 @@ dEQP-VK.texture.texel_buffer.uniform.snorm.r8g8b8-snorm
 dEQP-VK.texture.texel_buffer.uniform.snorm.r8g8b8a8-snorm
 dEQP-VK.texture.multisample.atomic.storage_image_r32i
 dEQP-VK.texture.multisample.atomic.storage_image_r32ui
+dEQP-VK.texture.multisample.invalid_sample_index.sample_count_2
+dEQP-VK.texture.multisample.invalid_sample_index.sample_count_4
+dEQP-VK.texture.multisample.invalid_sample_index.sample_count_8
+dEQP-VK.texture.multisample.invalid_sample_index.sample_count_16
+dEQP-VK.texture.multisample.invalid_sample_index.sample_count_32
+dEQP-VK.texture.multisample.invalid_sample_index.sample_count_64
 dEQP-VK.texture.texel_offset.texel_offset
index 280e57f..31e6e4e 100644 (file)
@@ -13245,4 +13245,10 @@ dEQP-VK.texture.texel_buffer.uniform.snorm.r8g8b8-snorm
 dEQP-VK.texture.texel_buffer.uniform.snorm.r8g8b8a8-snorm
 dEQP-VK.texture.multisample.atomic.storage_image_r32i
 dEQP-VK.texture.multisample.atomic.storage_image_r32ui
+dEQP-VK.texture.multisample.invalid_sample_index.sample_count_2
+dEQP-VK.texture.multisample.invalid_sample_index.sample_count_4
+dEQP-VK.texture.multisample.invalid_sample_index.sample_count_8
+dEQP-VK.texture.multisample.invalid_sample_index.sample_count_16
+dEQP-VK.texture.multisample.invalid_sample_index.sample_count_32
+dEQP-VK.texture.multisample.invalid_sample_index.sample_count_64
 dEQP-VK.texture.texel_offset.texel_offset
diff --git a/external/vulkancts/data/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_16.amber b/external/vulkancts/data/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_16.amber
new file mode 100644 (file)
index 0000000..85052ba
--- /dev/null
@@ -0,0 +1,89 @@
+#!amber
+# Copyright 2021 Google LLC.
+# Copyright 2021 The Khronos Group Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Write to an invalid sample index test
+# Sample Count:             16
+# Tested Sample Min:        -256
+# Tested Sample Max:        256
+# Description:              All writes to invalid sample numbers should be discarded.
+
+DEVICE_FEATURE shaderStorageImageMultisample
+
+SHADER compute compute_shader GLSL
+#version 430
+
+layout(local_size_x = 16, local_size_y = 16) in;
+
+uniform layout(set=0, binding=0, rgba8) image2DMS texture;
+uniform layout(set=0, binding=1, rgba8) image2D result;
+
+
+void main()
+{
+    int numSamples = 16;
+    int distortion = 256;
+    vec4 ndxColors[4];
+
+    ndxColors[0] = vec4(1.0, 0.0, 0.0, 1.0);
+    ndxColors[1] = vec4(0.0, 1.0, 0.0, 1.0);
+    ndxColors[2] = vec4(0.0, 0.0, 1.0, 1.0);
+    ndxColors[3] = vec4(0.0, 1.0, 1.0, 1.0);
+
+    ivec2 uv = ivec2(gl_GlobalInvocationID.xy);
+
+    // Initialize texture
+    for (int s = -distortion; s < distortion; s++)
+    {
+        vec4 color = vec4(1);
+
+        if (s >= 0 && s < numSamples) color = ndxColors[s % 4];
+
+        imageStore(texture, uv, s, color);
+    }
+
+    memoryBarrierImage();
+    barrier();
+
+    // Verification
+    bool imageOk = true;
+
+    for (int s = 0; s < numSamples; s++)
+    {
+        vec4 color = vec4(1);
+
+        if (s >= 0 && s < numSamples) color = ndxColors[s % 4];
+
+        if (imageLoad(texture, uv, s) != color)
+            imageOk = false;
+    }
+
+    vec4 resultColor = imageOk ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1);
+    imageStore(result, uv, resultColor);
+}
+END
+
+IMAGE texture FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 16 HEIGHT 16 SAMPLES 16
+IMAGE result FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 16 HEIGHT 16 FILL 0
+
+PIPELINE compute pipeline
+  ATTACH compute_shader
+  BIND BUFFER texture AS storage_image DESCRIPTOR_SET 0 BINDING 0
+  BIND BUFFER result AS storage_image DESCRIPTOR_SET 0 BINDING 1
+END
+
+RUN pipeline 1 1 1
+
+EXPECT result IDX 0 0 SIZE 16 16 EQ_RGBA 0 255 0 255
diff --git a/external/vulkancts/data/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_2.amber b/external/vulkancts/data/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_2.amber
new file mode 100644 (file)
index 0000000..0de9d9f
--- /dev/null
@@ -0,0 +1,87 @@
+#!amber
+# Copyright 2021 Google LLC.
+# Copyright 2021 The Khronos Group Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Write to an invalid sample index test
+# Sample Count:             2
+# Tested Sample Min:        -256
+# Tested Sample Max:        256
+# Description:              All writes to invalid sample numbers should be discarded.
+
+DEVICE_FEATURE shaderStorageImageMultisample
+
+SHADER compute compute_shader GLSL
+#version 430
+
+layout(local_size_x = 16, local_size_y = 16) in;
+
+uniform layout(set=0, binding=0, rgba8) image2DMS texture;
+uniform layout(set=0, binding=1, rgba8) image2D result;
+
+
+void main()
+{
+    int numSamples = 2;
+    int distortion = 256;
+    vec4 ndxColors[2];
+
+    ndxColors[0] = vec4(1.0, 0.0, 1.0, 1.0);
+    ndxColors[1] = vec4(0.0, 1.0, 1.0, 1.0);
+
+    ivec2 uv = ivec2(gl_GlobalInvocationID.xy);
+
+    // Initialize texture
+    for (int s = -distortion; s < distortion; s++)
+    {
+        vec4 color = vec4(1);
+
+        if (s >= 0 && s < numSamples) color = ndxColors[s % 2];
+
+        imageStore(texture, uv, s, color);
+    }
+
+    memoryBarrierImage();
+    barrier();
+
+    // Verification
+    bool imageOk = true;
+
+    for (int s = 0; s < numSamples; s++)
+    {
+        vec4 color = vec4(1);
+
+        if (s >= 0 && s < numSamples) color = ndxColors[s % 2];
+
+        if (imageLoad(texture, uv, s) != color)
+            imageOk = false;
+    }
+
+    vec4 resultColor = imageOk ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1);
+    imageStore(result, uv, resultColor);
+}
+END
+
+IMAGE texture FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 16 HEIGHT 16 SAMPLES 2
+IMAGE result FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 16 HEIGHT 16 FILL 0
+
+PIPELINE compute pipeline
+  ATTACH compute_shader
+  BIND BUFFER texture AS storage_image DESCRIPTOR_SET 0 BINDING 0
+  BIND BUFFER result AS storage_image DESCRIPTOR_SET 0 BINDING 1
+END
+
+RUN pipeline 1 1 1
+
+EXPECT result IDX 0 0 SIZE 16 16 EQ_RGBA 0 255 0 255
diff --git a/external/vulkancts/data/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_32.amber b/external/vulkancts/data/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_32.amber
new file mode 100644 (file)
index 0000000..a13b112
--- /dev/null
@@ -0,0 +1,89 @@
+#!amber
+# Copyright 2021 Google LLC.
+# Copyright 2021 The Khronos Group Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Write to an invalid sample number test
+# Sample Count:             32
+# Tested Sample Min:        -256
+# Tested Sample Max:        256
+# Description:              All writes to invalid sample numbers should be discarded.
+
+DEVICE_FEATURE shaderStorageImageMultisample
+
+SHADER compute compute_shader GLSL
+#version 430
+
+layout(local_size_x = 16, local_size_y = 16) in;
+
+uniform layout(set=0, binding=0, rgba8) image2DMS texture;
+uniform layout(set=0, binding=1, rgba8) image2D result;
+
+
+void main()
+{
+    int numSamples = 32;
+    int distortion = 256;
+    vec4 ndxColors[4];
+
+    ndxColors[0] = vec4(1.0, 0.0, 0.0, 1.0);
+    ndxColors[1] = vec4(0.0, 1.0, 0.0, 1.0);
+    ndxColors[2] = vec4(0.0, 0.0, 1.0, 1.0);
+    ndxColors[3] = vec4(0.0, 1.0, 1.0, 1.0);
+
+    ivec2 uv = ivec2(gl_GlobalInvocationID.xy);
+
+    // Initialize texture
+    for (int s = -distortion; s < distortion; s++)
+    {
+        vec4 color = vec4(1);
+
+        if (s >= 0 && s < numSamples) color = ndxColors[s % 4];
+
+        imageStore(texture, uv, s, color);
+    }
+
+    memoryBarrierImage();
+    barrier();
+
+    // Verification
+    bool imageOk = true;
+
+    for (int s = 0; s < numSamples; s++)
+    {
+        vec4 color = vec4(1);
+
+        if (s >= 0 && s < numSamples) color = ndxColors[s % 4];
+
+        if (imageLoad(texture, uv, s) != color)
+            imageOk = false;
+    }
+
+    vec4 resultColor = imageOk ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1);
+    imageStore(result, uv, resultColor);
+}
+END
+
+IMAGE texture FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 16 HEIGHT 16 SAMPLES 32
+IMAGE result FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 16 HEIGHT 16 FILL 0
+
+PIPELINE compute pipeline
+  ATTACH compute_shader
+  BIND BUFFER texture AS storage_image DESCRIPTOR_SET 0 BINDING 0
+  BIND BUFFER result AS storage_image DESCRIPTOR_SET 0 BINDING 1
+END
+
+RUN pipeline 1 1 1
+
+EXPECT result IDX 0 0 SIZE 16 16 EQ_RGBA 0 255 0 255
diff --git a/external/vulkancts/data/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_4.amber b/external/vulkancts/data/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_4.amber
new file mode 100644 (file)
index 0000000..c89f2fe
--- /dev/null
@@ -0,0 +1,89 @@
+#!amber
+# Copyright 2021 Google LLC.
+# Copyright 2021 The Khronos Group Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Write to an invalid sample index test
+# Sample Count:             4
+# Tested Sample Min:        -256
+# Tested Sample Max:        256
+# Description:              All writes to invalid sample numbers should be discarded.
+
+DEVICE_FEATURE shaderStorageImageMultisample
+
+SHADER compute compute_shader GLSL
+#version 430
+
+layout(local_size_x = 16, local_size_y = 16) in;
+
+uniform layout(set=0, binding=0, rgba8) image2DMS texture;
+uniform layout(set=0, binding=1, rgba8) image2D result;
+
+
+void main()
+{
+    int numSamples = 4;
+    int distortion = 256;
+    vec4 ndxColors[4];
+
+    ndxColors[0] = vec4(1.0, 0.0, 0.0, 1.0);
+    ndxColors[1] = vec4(0.0, 1.0, 0.0, 1.0);
+    ndxColors[2] = vec4(0.0, 0.0, 1.0, 1.0);
+    ndxColors[3] = vec4(0.0, 1.0, 1.0, 1.0);
+
+    ivec2 uv = ivec2(gl_GlobalInvocationID.xy);
+
+    // Initialize texture
+    for (int s = -distortion; s < distortion; s++)
+    {
+        vec4 color = vec4(1);
+
+        if (s >= 0 && s < numSamples) color = ndxColors[s % 4];
+
+        imageStore(texture, uv, s, color);
+    }
+
+    memoryBarrierImage();
+    barrier();
+
+    // Verification
+    bool imageOk = true;
+
+    for (int s = 0; s < numSamples; s++)
+    {
+        vec4 color = vec4(1);
+
+        if (s >= 0 && s < numSamples) color = ndxColors[s % 4];
+
+        if (imageLoad(texture, uv, s) != color)
+            imageOk = false;
+    }
+
+    vec4 resultColor = imageOk ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1);
+    imageStore(result, uv, resultColor);
+}
+END
+
+IMAGE texture FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 16 HEIGHT 16 SAMPLES 4
+IMAGE result FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 16 HEIGHT 16 FILL 0
+
+PIPELINE compute pipeline
+  ATTACH compute_shader
+  BIND BUFFER texture AS storage_image DESCRIPTOR_SET 0 BINDING 0
+  BIND BUFFER result AS storage_image DESCRIPTOR_SET 0 BINDING 1
+END
+
+RUN pipeline 1 1 1
+
+EXPECT result IDX 0 0 SIZE 16 16 EQ_RGBA 0 255 0 255
diff --git a/external/vulkancts/data/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_64.amber b/external/vulkancts/data/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_64.amber
new file mode 100644 (file)
index 0000000..cdb5649
--- /dev/null
@@ -0,0 +1,89 @@
+#!amber
+# Copyright 2021 Google LLC.
+# Copyright 2021 The Khronos Group Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Write to an invalid sample number test
+# Sample Count:             64
+# Tested Sample Min:        -256
+# Tested Sample Max:        256
+# Description:              All writes to invalid sample numbers should be discarded.
+
+DEVICE_FEATURE shaderStorageImageMultisample
+
+SHADER compute compute_shader GLSL
+#version 430
+
+layout(local_size_x = 16, local_size_y = 16) in;
+
+uniform layout(set=0, binding=0, rgba8) image2DMS texture;
+uniform layout(set=0, binding=1, rgba8) image2D result;
+
+
+void main()
+{
+    int numSamples = 64;
+    int distortion = 256;
+    vec4 ndxColors[4];
+
+    ndxColors[0] = vec4(1.0, 0.0, 0.0, 1.0);
+    ndxColors[1] = vec4(0.0, 1.0, 0.0, 1.0);
+    ndxColors[2] = vec4(0.0, 0.0, 1.0, 1.0);
+    ndxColors[3] = vec4(0.0, 1.0, 1.0, 1.0);
+
+    ivec2 uv = ivec2(gl_GlobalInvocationID.xy);
+
+    // Initialize texture
+    for (int s = -distortion; s < distortion; s++)
+    {
+        vec4 color = vec4(1);
+
+        if (s >= 0 && s < numSamples) color = ndxColors[s % 4];
+
+        imageStore(texture, uv, s, color);
+    }
+
+    memoryBarrierImage();
+    barrier();
+
+    // Verification
+    bool imageOk = true;
+
+    for (int s = 0; s < numSamples; s++)
+    {
+        vec4 color = vec4(1);
+
+        if (s >= 0 && s < numSamples) color = ndxColors[s % 4];
+
+        if (imageLoad(texture, uv, s) != color)
+            imageOk = false;
+    }
+
+    vec4 resultColor = imageOk ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1);
+    imageStore(result, uv, resultColor);
+}
+END
+
+IMAGE texture FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 16 HEIGHT 16 SAMPLES 64
+IMAGE result FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 16 HEIGHT 16 FILL 0
+
+PIPELINE compute pipeline
+  ATTACH compute_shader
+  BIND BUFFER texture AS storage_image DESCRIPTOR_SET 0 BINDING 0
+  BIND BUFFER result AS storage_image DESCRIPTOR_SET 0 BINDING 1
+END
+
+RUN pipeline 1 1 1
+
+EXPECT result IDX 0 0 SIZE 16 16 EQ_RGBA 0 255 0 255
diff --git a/external/vulkancts/data/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_8.amber b/external/vulkancts/data/vulkan/amber/texture/multisample/invalidsampleindex/sample_count_8.amber
new file mode 100644 (file)
index 0000000..ea99bb6
--- /dev/null
@@ -0,0 +1,89 @@
+#!amber
+# Copyright 2021 Google LLC.
+# Copyright 2021 The Khronos Group Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Write to an invalid sample index test
+# Sample Count:             8
+# Tested Sample Min:        -256
+# Tested Sample Max:        256
+# Description:              All writes to invalid sample numbers should be discarded.
+
+DEVICE_FEATURE shaderStorageImageMultisample
+
+SHADER compute compute_shader GLSL
+#version 430
+
+layout(local_size_x = 16, local_size_y = 16) in;
+
+uniform layout(set=0, binding=0, rgba8) image2DMS texture;
+uniform layout(set=0, binding=1, rgba8) image2D result;
+
+
+void main()
+{
+    int numSamples = 8;
+    int distortion = 256;
+    vec4 ndxColors[4];
+
+    ndxColors[0] = vec4(1.0, 0.0, 0.0, 1.0);
+    ndxColors[1] = vec4(0.0, 1.0, 0.0, 1.0);
+    ndxColors[2] = vec4(0.0, 0.0, 1.0, 1.0);
+    ndxColors[3] = vec4(0.0, 1.0, 1.0, 1.0);
+
+    ivec2 uv = ivec2(gl_GlobalInvocationID.xy);
+
+    // Initialize texture
+    for (int s = -distortion; s < distortion; s++)
+    {
+        vec4 color = vec4(1);
+
+        if (s >= 0 && s < numSamples) color = ndxColors[s % 4];
+
+        imageStore(texture, uv, s, color);
+    }
+
+    memoryBarrierImage();
+    barrier();
+
+    // Verification
+    bool imageOk = true;
+
+    for (int s = 0; s < numSamples; s++)
+    {
+        vec4 color = vec4(1);
+
+        if (s >= 0 && s < numSamples) color = ndxColors[s % 4];
+
+        if (imageLoad(texture, uv, s) != color)
+            imageOk = false;
+    }
+
+    vec4 resultColor = imageOk ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1);
+    imageStore(result, uv, resultColor);
+}
+END
+
+IMAGE texture FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 16 HEIGHT 16 SAMPLES 8
+IMAGE result FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 16 HEIGHT 16 FILL 0
+
+PIPELINE compute pipeline
+  ATTACH compute_shader
+  BIND BUFFER texture AS storage_image DESCRIPTOR_SET 0 BINDING 0
+  BIND BUFFER result AS storage_image DESCRIPTOR_SET 0 BINDING 1
+END
+
+RUN pipeline 1 1 1
+
+EXPECT result IDX 0 0 SIZE 16 16 EQ_RGBA 0 255 0 255
index eeb919c..960b463 100644 (file)
@@ -61,6 +61,52 @@ tcu::TestCaseGroup* createAtomicTests (tcu::TestContext& testCtx)
        return atomic.release();
 }
 
+tcu::TestCaseGroup* createInvalidSampleIndexTests(tcu::TestContext& testCtx)
+{
+       std::pair <std::string, VkSampleCountFlagBits>  cases[]                 =
+       {
+               { "sample_count_2",             VK_SAMPLE_COUNT_2_BIT   },
+               { "sample_count_4",             VK_SAMPLE_COUNT_4_BIT   },
+               { "sample_count_8",             VK_SAMPLE_COUNT_8_BIT   },
+               { "sample_count_16",    VK_SAMPLE_COUNT_16_BIT  },
+               { "sample_count_32",    VK_SAMPLE_COUNT_32_BIT  },
+               { "sample_count_64",    VK_SAMPLE_COUNT_64_BIT  }
+       };
+
+       de::MovePtr<tcu::TestCaseGroup>                                 invalidWrites   (new tcu::TestCaseGroup(testCtx, "invalid_sample_index", "Writes to invalid sample indices should be discarded."));
+       static const char                                                               dataDir[]               = "texture/multisample/invalidsampleindex";
+       std::vector<std::string>                                                requirements    = { "Features.shaderStorageImageMultisample" };
+
+       for (const auto& testCase : cases)
+       {
+               const VkImageCreateInfo                 vkImageCreateInfo       =
+               {
+                       VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,    // sType
+                       DE_NULL,                                                                // pNext
+                       0,                                                                              // flags
+                       VK_IMAGE_TYPE_2D,                                               // imageType
+                       VK_FORMAT_R8G8B8A8_UNORM,                               // format
+                       { 16, 16, 1 },                                                  // extent
+                       1,                                                                              // mipLevels
+                       1,                                                                              // arrayLayers
+                       testCase.second,                                                // samples
+                       VK_IMAGE_TILING_OPTIMAL,                                // tiling
+                       VK_IMAGE_USAGE_SAMPLED_BIT,                             // usage
+                       VK_SHARING_MODE_EXCLUSIVE,                              // sharingMode
+                       0,                                                                              // queueFamilyIndexCount
+                       DE_NULL,                                                                // pQueueFamilyIndices
+                       VK_IMAGE_LAYOUT_UNDEFINED,                              // initialLayout
+               };
+
+               std::vector<VkImageCreateInfo>  imageRequirements       = { vkImageCreateInfo };
+               const std::string                               fileName                        = testCase.first + ".amber";
+
+               invalidWrites->addChild(cts_amber::createAmberTestCase(testCtx, testCase.first.c_str(), "", dataDir, fileName, requirements, imageRequirements));
+       }
+
+       return invalidWrites.release();
+}
+
 } // anonymous
 
 tcu::TestCaseGroup* createTextureMultisampleTests (tcu::TestContext& testCtx)
@@ -68,6 +114,7 @@ tcu::TestCaseGroup* createTextureMultisampleTests (tcu::TestContext& testCtx)
        de::MovePtr<tcu::TestCaseGroup> multisample (new tcu::TestCaseGroup(testCtx, "multisample", "Multisample texture tests"));
 
        multisample->addChild(createAtomicTests(testCtx));
+       multisample->addChild(createInvalidSampleIndexTests(testCtx));
 
        return multisample.release();
 }
index 79e9945..03a36c1 100644 (file)
@@ -13435,4 +13435,10 @@ dEQP-VK.texture.texel_buffer.uniform.snorm.r8g8b8-snorm
 dEQP-VK.texture.texel_buffer.uniform.snorm.r8g8b8a8-snorm
 dEQP-VK.texture.multisample.atomic.storage_image_r32i
 dEQP-VK.texture.multisample.atomic.storage_image_r32ui
+dEQP-VK.texture.multisample.invalid_sample_index.sample_count_2
+dEQP-VK.texture.multisample.invalid_sample_index.sample_count_4
+dEQP-VK.texture.multisample.invalid_sample_index.sample_count_8
+dEQP-VK.texture.multisample.invalid_sample_index.sample_count_16
+dEQP-VK.texture.multisample.invalid_sample_index.sample_count_32
+dEQP-VK.texture.multisample.invalid_sample_index.sample_count_64
 dEQP-VK.texture.texel_offset.texel_offset