From d41f0578749db200124a933a0bc6ace35881d02d Mon Sep 17 00:00:00 2001 From: Andres Gomez Date: Thu, 8 Jun 2017 14:39:02 +0300 Subject: [PATCH] dEQP-VK: check against the proper VkFormatProperties member MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT and VK_FORMAT_FEATURE_TRANSFER_[SRC|DST]_BIT_KHR are flag values of the VkFormatFeatureFlagBits enum that can only be hold and checked against the linearTilingFeatures or optimalTilingFeatures members of the VkFormatProperties struct but not the bufferFeatures member. From the Vulkan® 1.0.51, with the VK_KHR_maintenance1 extension, section 32.3.2 docs for VkFormatProperties: "* linearTilingFeatures is a bitmask of VkFormatFeatureFlagBits specifying features supported by images created with a tiling parameter of VK_IMAGE_TILING_LINEAR. * optimalTilingFeatures is a bitmask of VkFormatFeatureFlagBits specifying features supported by images created with a tiling parameter of VK_IMAGE_TILING_OPTIMAL. * bufferFeatures is a bitmask of VkFormatFeatureFlagBits specifying features supported by buffers." ... Bits which can be set in the VkFormatProperties features linearTilingFeatures, optimalTilingFeatures, and bufferFeatures are: typedef enum VkFormatFeatureFlagBits { ... VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT = 0x00000080, ... VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR = 0x00004000, VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR = 0x00008000, ... } VkFormatFeatureFlagBits; ... The following bits may be set in linearTilingFeatures and optimalTilingFeatures, specifying that the features are supported by images or image views created with the queried vkGetPhysicalDeviceFormatProperties::format: ... * VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT specifies that an image view can be used as a framebuffer color attachment and as an input attachment." ... * VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR specifies that an image can be used as a source image for copy commands. * VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR specifies that an image can be used as a destination image for copy commands and clear commands." Affects: dEQP-VK.spirv_assembly.instruction.graphics.16bit_storage.input_output_* VK-GL-CTS issue: 483 Components: Vulkan Change-Id: I89d21dbba2794429973830b0368259cf0cc24312 --- .../vktSpvAsmGraphicsShaderTestUtil.cpp | 26 +++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmGraphicsShaderTestUtil.cpp b/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmGraphicsShaderTestUtil.cpp index a1092fb..8acc544 100644 --- a/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmGraphicsShaderTestUtil.cpp +++ b/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmGraphicsShaderTestUtil.cpp @@ -183,15 +183,31 @@ VkBufferUsageFlagBits getMatchingBufferUsageFlagBit(VkDescriptorType dType) return (VkBufferUsageFlagBits)0; } -static void requireFormatUsageSupport(const InstanceInterface& vki, VkPhysicalDevice physicalDevice, VkFormat format, VkImageUsageFlags requiredUsageFlags) +static void requireFormatUsageSupport(const InstanceInterface& vki, VkPhysicalDevice physicalDevice, VkFormat format, VkImageTiling imageTiling, VkImageUsageFlags requiredUsageFlags) { - VkFormatProperties properties; + VkFormatProperties properties; + VkFormatFeatureFlags tilingFeatures = 0; vki.getPhysicalDeviceFormatProperties(physicalDevice, format, &properties); + switch (imageTiling) + { + case VK_IMAGE_TILING_LINEAR: + tilingFeatures = properties.linearTilingFeatures; + break; + + case VK_IMAGE_TILING_OPTIMAL: + tilingFeatures = properties.optimalTilingFeatures; + break; + + default: + DE_ASSERT(false); + break; + } + if ((requiredUsageFlags & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) != 0) { - if ((properties.bufferFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) == 0) + if ((tilingFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) == 0) TCU_THROW(NotSupportedError, "Image format cannot be used as color attachment"); requiredUsageFlags ^= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; } @@ -199,7 +215,7 @@ static void requireFormatUsageSupport(const InstanceInterface& vki, VkPhysicalDe if ((requiredUsageFlags & VK_IMAGE_USAGE_TRANSFER_SRC_BIT) != 0) { - if ((properties.bufferFeatures & VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR) == 0) + if ((tilingFeatures & VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR) == 0) TCU_THROW(NotSupportedError, "Image format cannot be used as transfer source"); requiredUsageFlags ^= VK_IMAGE_USAGE_TRANSFER_SRC_BIT; } @@ -2320,7 +2336,7 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan imageParams.format = instance.interfaces.getOutputType().getVkFormat(); // Check the usage bits on the given image format are supported. - requireFormatUsageSupport(vkInstance, vkPhysicalDevice, imageParams.format, imageParams.usage); + requireFormatUsageSupport(vkInstance, vkPhysicalDevice, imageParams.format, imageParams.tiling, imageParams.usage); fragOutputImage = createImage(vk, *vkDevice, &imageParams); fragOutputImageMemory = allocator.allocate(getImageMemoryRequirements(vk, *vkDevice, *fragOutputImage), MemoryRequirement::Any); -- 2.7.4