Check whether the underlying format is supported in format_reinterpret tests
authorChris Forbes <chrisforbes@google.com>
Thu, 29 Aug 2019 18:22:26 +0000 (11:22 -0700)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Wed, 11 Sep 2019 08:09:05 +0000 (04:09 -0400)
Affects: dEQP-VK.image.*
VK-GL-CTS Issue: 1969

Change-Id: I4e78351aa8746ebd2f2ea69980f747ded508802b

external/vulkancts/modules/vulkan/image/vktImageLoadStoreTests.cpp

index 9f8b99e..56ef508 100644 (file)
@@ -939,6 +939,9 @@ void LoadStoreTest::checkSupport (Context& context) const
        const vk::VkFormatProperties    formatProperties        (vk::getPhysicalDeviceFormatProperties(context.getInstanceInterface(),
                                                                                                                                                                                           context.getPhysicalDevice(),
                                                                                                                                                                                           m_format));
+       const vk::VkFormatProperties imageFormatProperties  (vk::getPhysicalDeviceFormatProperties(context.getInstanceInterface(),
+                                                                                                                                                                                          context.getPhysicalDevice(),
+                                                                                                                                                                                          m_imageFormat));
 
        if (!m_declareImageFormatInShader && !features.shaderStorageImageReadWithoutFormat)
                TCU_THROW(NotSupportedError, "shaderStorageImageReadWithoutFormat feature not supported");
@@ -951,6 +954,12 @@ void LoadStoreTest::checkSupport (Context& context) const
 
        if (m_texture.type() == IMAGE_TYPE_BUFFER && !(formatProperties.bufferFeatures & VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT))
                TCU_THROW(NotSupportedError, "Format not supported for storage texel buffers");
+
+       if ((m_texture.type() != IMAGE_TYPE_BUFFER) && !(imageFormatProperties.optimalTilingFeatures))
+               TCU_THROW(NotSupportedError, "Underlying format not supported at all for images");
+
+       if ((m_texture.type() == IMAGE_TYPE_BUFFER) && !(imageFormatProperties.bufferFeatures))
+               TCU_THROW(NotSupportedError, "Underlying format not supported at all for buffers");
 }
 
 void LoadStoreTest::initPrograms (SourceCollections& programCollection) const