Add image format support check in sparse render target tests
authorziga-lunarg <ziga@lunarg.com>
Sat, 17 Sep 2022 22:07:41 +0000 (00:07 +0200)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Thu, 6 Oct 2022 21:07:09 +0000 (21:07 +0000)
Check if format is supported for the test

Components: Vulkan

VK-GL-CTS issue: 3961

Affected tests:
dEQP-VK.*.suballocation.sparserendertarget.*

Change-Id: I9878d04465839ce73f9f6661e263a114c01037fb

external/vulkancts/modules/vulkan/renderpass/vktRenderPassSparseRenderTargetTests.cpp

index 39f319d..d168e2c 100644 (file)
@@ -702,6 +702,14 @@ void checkSupport(Context& context, TestConfigType config)
 
        if (config.renderingType == RENDERING_TYPE_DYNAMIC_RENDERING)
                context.requireDeviceFunctionality("VK_KHR_dynamic_rendering");
+
+       const auto& vki = context.getInstanceInterface();
+       const auto& physicalDevice = context.getPhysicalDevice();
+       VkImageFormatProperties formatProperties;
+       const auto result = vki.getPhysicalDeviceImageFormatProperties(physicalDevice, config.format, VK_IMAGE_TYPE_2D, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT, 0u, &formatProperties);
+       if (result == VK_ERROR_FORMAT_NOT_SUPPORTED) {
+               TCU_THROW(NotSupportedError, "Image format not supported");
+       }
 }
 
 void initTests (tcu::TestCaseGroup* group, const RenderingType renderingType)