Use mandatory formats in stencil export tests
authorRicardo Garcia <rgarcia@igalia.com>
Mon, 6 Apr 2020 12:32:37 +0000 (14:32 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Wed, 29 Apr 2020 09:40:12 +0000 (05:40 -0400)
Stencil export tests were using VK_FORMAT_S8_UINT, which is not a
mandatory format. This commit adds more test variants using mandatory
stencil image formats for 2D images, guaranteeing these tests can run on
more implementations.

Existing tests have been renamed and other variants have been added.

Affected and new tests:
dEQP-VK.pipeline.shader_stencil_export.*

Components: Vulkan
VK-GL-CTS issue: 2292

Change-Id: Ied82c9958d3126fcb1b72716b3c4fdc109fe2e87

android/cts/master/src/vk-master-2019-03-01.txt
android/cts/master/vk-master-2019-03-01.txt
android/cts/master/vk-master-2020-03-01.txt
android/cts/master/vk-master.txt
external/vulkancts/modules/vulkan/pipeline/vktPipelineStencilExportTests.cpp
external/vulkancts/mustpass/master/vk-default.txt

index 8b45cae..45cb3be 100644 (file)
@@ -177008,7 +177008,7 @@ dEQP-VK.pipeline.framebuffer_attachment.diff_attachments_2d_32x32_64x64_ms
 dEQP-VK.pipeline.framebuffer_attachment.diff_attachments_2d_32x32_48x48_ms
 dEQP-VK.pipeline.framebuffer_attachment.diff_attachments_2d_32x32_39x41_ms
 dEQP-VK.pipeline.framebuffer_attachment.diff_attachments_2d_19x27_32x32_ms
-dEQP-VK.pipeline.shader_stencil_export.op_replace
+dEQP-VK.pipeline.shader_stencil_export.s8_uint.op_replace
 dEQP-VK.pipeline.derivative.compute.derivative_by_handle
 dEQP-VK.pipeline.derivative.compute.derivative_by_index
 dEQP-VK.binding_model.shader_access.primary_cmd_buf.sampler_mutable.no_access.single_descriptor.1d
index e17bb49..dfffe0a 100644 (file)
@@ -177008,7 +177008,7 @@ dEQP-VK.pipeline.framebuffer_attachment.diff_attachments_2d_32x32_64x64_ms
 dEQP-VK.pipeline.framebuffer_attachment.diff_attachments_2d_32x32_48x48_ms
 dEQP-VK.pipeline.framebuffer_attachment.diff_attachments_2d_32x32_39x41_ms
 dEQP-VK.pipeline.framebuffer_attachment.diff_attachments_2d_19x27_32x32_ms
-dEQP-VK.pipeline.shader_stencil_export.op_replace
+dEQP-VK.pipeline.shader_stencil_export.s8_uint.op_replace
 dEQP-VK.pipeline.derivative.compute.derivative_by_handle
 dEQP-VK.pipeline.derivative.compute.derivative_by_index
 dEQP-VK.binding_model.shader_access.primary_cmd_buf.sampler_mutable.no_access.single_descriptor.1d
index 0eaf7b3..89eedfb 100644 (file)
@@ -78414,6 +78414,8 @@ dEQP-VK.pipeline.render_to_image.dedicated_allocation.cube_array.mipmap.a1r5g5b5
 dEQP-VK.pipeline.render_to_image.dedicated_allocation.cube_array.mipmap.r5g6b5_unorm_pack16_d32_sfloat_s8_uint
 dEQP-VK.pipeline.render_to_image.dedicated_allocation.cube_array.mipmap.a2b10g10r10_uint_pack32_d32_sfloat_s8_uint
 dEQP-VK.pipeline.render_to_image.dedicated_allocation.cube_array.mipmap.a2b10g10r10_unorm_pack32_d32_sfloat_s8_uint
+dEQP-VK.pipeline.shader_stencil_export.d24_unorm_s8_uint.op_replace
+dEQP-VK.pipeline.shader_stencil_export.d32_sfloat_s8_uint.op_replace
 dEQP-VK.pipeline.creation_feedback.graphics_tests.vertex_stage_fragment_stage
 dEQP-VK.pipeline.creation_feedback.graphics_tests.vertex_stage_geometry_stage_fragment_stage
 dEQP-VK.pipeline.creation_feedback.graphics_tests.vertex_stage_tessellation_control_stage_tessellation_evaluation_stage_fragment_stage
index 4579dc0..e68697e 100644 (file)
@@ -255424,7 +255424,9 @@ dEQP-VK.pipeline.framebuffer_attachment.diff_attachments_2d_32x32_64x64_ms
 dEQP-VK.pipeline.framebuffer_attachment.diff_attachments_2d_32x32_48x48_ms
 dEQP-VK.pipeline.framebuffer_attachment.diff_attachments_2d_32x32_39x41_ms
 dEQP-VK.pipeline.framebuffer_attachment.diff_attachments_2d_19x27_32x32_ms
-dEQP-VK.pipeline.shader_stencil_export.op_replace
+dEQP-VK.pipeline.shader_stencil_export.s8_uint.op_replace
+dEQP-VK.pipeline.shader_stencil_export.d24_unorm_s8_uint.op_replace
+dEQP-VK.pipeline.shader_stencil_export.d32_sfloat_s8_uint.op_replace
 dEQP-VK.pipeline.derivative.compute.derivative_by_handle
 dEQP-VK.pipeline.derivative.compute.derivative_by_index
 dEQP-VK.pipeline.creation_feedback.graphics_tests.vertex_stage_fragment_stage
index 428c57a..710df99 100644 (file)
@@ -71,7 +71,7 @@ using de::SharedPtr;
 namespace
 {
 
-void initPrograms (SourceCollections& programCollection)
+void initPrograms (SourceCollections& programCollection, vk::VkFormat)
 {
        // Vertex shader.
        {
@@ -448,12 +448,10 @@ tcu::TextureLevel generateReferenceImage (const tcu::TextureFormat        format,
        return image;
 }
 
-tcu::TestStatus testStencilExportReplace (Context& context)
+tcu::TestStatus testStencilExportReplace (Context& context, vk::VkFormat stencilFormat)
 {
-       const VkFormat stencilFormat = VK_FORMAT_S8_UINT;
-
-       context.getTestContext().getLog()
-               << tcu::TestLog::Message << "Drawing to stencil using shader then using it for another draw." << tcu::TestLog::EndMessage;
+       auto& log = context.getTestContext().getLog();
+       log << tcu::TestLog::Message << "Drawing to stencil using shader then using it for another draw." << tcu::TestLog::EndMessage;
 
        const DeviceInterface&                  vk                                      = context.getDeviceInterface();
        const VkDevice                                  device                          = context.getDevice();
@@ -535,28 +533,43 @@ tcu::TestStatus testStencilExportReplace (Context& context)
 
                tcu::TextureLevel                                       referenceImage  = generateReferenceImage(mapVkFormat(colorFormat), renderSize, 1 << 4, clearColor, Vec4(0, 0, 1, 1));
 
-               if (!tcu::floatThresholdCompare(context.getTestContext().getLog(), "color", "Image compare", referenceImage.getAccess(), resultImage, Vec4(0.02f), tcu::COMPARE_LOG_RESULT))
+               if (!tcu::floatThresholdCompare(log, "color", "Image compare", referenceImage.getAccess(), resultImage, Vec4(0.02f), tcu::COMPARE_LOG_RESULT))
                        TCU_FAIL("Rendered image is not correct");
        }
 
        return tcu::TestStatus::pass("OK");
 }
 
-void checkSupport (Context& context)
+void checkSupport (Context& context, vk::VkFormat stencilFormat)
 {
        context.requireDeviceFunctionality("VK_EXT_shader_stencil_export");
 
-       const VkFormat stencilFormat = VK_FORMAT_S8_UINT;
        if (!isSupportedDepthStencilFormat(context.getInstanceInterface(), context.getPhysicalDevice(), stencilFormat))
-               throw tcu::NotSupportedError(std::string("Unsupported depth/stencil format: ") + getFormatName(stencilFormat));
+               TCU_THROW(NotSupportedError, "Image format not supported");
 }
 
 } // anonymous
 
 tcu::TestCaseGroup* createStencilExportTests (tcu::TestContext& testCtx)
 {
+       struct
+       {
+               const vk::VkFormat      format;
+               const std::string       name;
+       } kFormats[] =
+       {
+               { vk::VK_FORMAT_S8_UINT,                        "s8_uint"                               },
+               { vk::VK_FORMAT_D24_UNORM_S8_UINT,      "d24_unorm_s8_uint"             },
+               { vk::VK_FORMAT_D32_SFLOAT_S8_UINT,     "d32_sfloat_s8_uint"    },
+       };
+
        de::MovePtr<tcu::TestCaseGroup> group (new tcu::TestCaseGroup(testCtx, "shader_stencil_export", ""));
-       addFunctionCaseWithPrograms(group.get(), "op_replace", "", checkSupport, initPrograms, testStencilExportReplace);
+       for (int fmtIdx = 0; fmtIdx < DE_LENGTH_OF_ARRAY(kFormats); ++fmtIdx)
+       {
+               de::MovePtr<tcu::TestCaseGroup> formatGroup (new tcu::TestCaseGroup(testCtx, kFormats[fmtIdx].name.c_str(), ""));
+               addFunctionCaseWithPrograms<vk::VkFormat>(formatGroup.get(), "op_replace", "", checkSupport, initPrograms, testStencilExportReplace, kFormats[fmtIdx].format);
+               group->addChild(formatGroup.release());
+       }
        return group.release();
 }
 
index a5b0fa8..ec7e708 100644 (file)
@@ -255311,7 +255311,9 @@ dEQP-VK.pipeline.framebuffer_attachment.diff_attachments_2d_32x32_64x64_ms
 dEQP-VK.pipeline.framebuffer_attachment.diff_attachments_2d_32x32_48x48_ms
 dEQP-VK.pipeline.framebuffer_attachment.diff_attachments_2d_32x32_39x41_ms
 dEQP-VK.pipeline.framebuffer_attachment.diff_attachments_2d_19x27_32x32_ms
-dEQP-VK.pipeline.shader_stencil_export.op_replace
+dEQP-VK.pipeline.shader_stencil_export.s8_uint.op_replace
+dEQP-VK.pipeline.shader_stencil_export.d24_unorm_s8_uint.op_replace
+dEQP-VK.pipeline.shader_stencil_export.d32_sfloat_s8_uint.op_replace
 dEQP-VK.pipeline.derivative.compute.derivative_by_handle
 dEQP-VK.pipeline.derivative.compute.derivative_by_index
 dEQP-VK.pipeline.creation_feedback.graphics_tests.vertex_stage_fragment_stage