Missing format checks for vertex attribute and color attachments in input_ouput tests
authorSamuel Iglesias Gonsálvez <siglesias@igalia.com>
Fri, 5 Apr 2019 14:40:30 +0000 (16:40 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 11 Apr 2019 11:03:49 +0000 (07:03 -0400)
Input_output tests were not checking that the vertex attribute formats
were supported by the physical device. Added a similar check for the color
attachment.

Affects:

dEQP-VK.spirv_assembly.instruction.graphics.*input_output*

Components: Vulkan
VK-GL-CTS issue: 1726

Change-Id: I2987deeafc8d3cc119730993fcb30fb191be062c

external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmGraphicsShaderTestUtil.cpp

index 1cddef1..501e0e0 100644 (file)
@@ -2569,6 +2569,30 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
                        TCU_THROW(NotSupportedError, "Requested Float Controls features not supported");
        }
 
+       // Check Interface Input/Output formats are supported
+       if (needInterface)
+       {
+               VkFormatProperties formatProperties;
+               vkInstance.getPhysicalDeviceFormatProperties(vkPhysicalDevice, instance.interfaces.getInputType().getVkFormat(), &formatProperties);
+               if ((formatProperties.bufferFeatures & VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT) == 0)
+               {
+                       std::string     error                           = "Interface Input format (";
+                       const std::string formatName    = getFormatName(instance.interfaces.getInputType().getVkFormat());
+                       error += formatName + ") not supported";
+                       TCU_THROW(NotSupportedError, error.c_str());
+               }
+
+               vkInstance.getPhysicalDeviceFormatProperties(vkPhysicalDevice, instance.interfaces.getOutputType().getVkFormat(), &formatProperties);
+               if (((formatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) == 0) ||
+                       ((formatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_TRANSFER_SRC_BIT) == 0))
+               {
+                       std::string     error                           = "Interface Output format (";
+                       const std::string formatName    = getFormatName(instance.interfaces.getInputType().getVkFormat());
+                       error += formatName + ") not supported";
+                       TCU_THROW(NotSupportedError, error.c_str());
+               }
+       }
+
        de::Random(seed).shuffle(instance.inputColors, instance.inputColors+4);
        de::Random(seed).shuffle(instance.outputColors, instance.outputColors+4);
        const Vec4                                                              vertexData[]                    =