From 8ceb3d60e04df988e54a330def06237c2bf7eaec Mon Sep 17 00:00:00 2001 From: Maciej Jesionowski Date: Mon, 21 Nov 2016 15:29:54 +0100 Subject: [PATCH] VK_KHR_maintenance1: check TRANSFER format feature flags Modified tests: - dEQP-VK.api.info.image_format_properties.* Issue #532 Change-Id: Ida862d7080ef279c0851d09a802aa6de84958bbe --- .../framework/vulkan/vkBasicTypes.inl | 2 ++ .../framework/vulkan/vkStrUtilImpl.inl | 2 ++ .../modules/vulkan/api/vktApiFeatureInfo.cpp | 33 ++++++++++++++++--- external/vulkancts/scripts/src/vulkan.h.in | 2 ++ 4 files changed, 34 insertions(+), 5 deletions(-) diff --git a/external/vulkancts/framework/vulkan/vkBasicTypes.inl b/external/vulkancts/framework/vulkan/vkBasicTypes.inl index a2bfd313a..5ffd61aba 100644 --- a/external/vulkancts/framework/vulkan/vkBasicTypes.inl +++ b/external/vulkancts/framework/vulkan/vkBasicTypes.inl @@ -840,6 +840,8 @@ enum VkFormatFeatureFlagBits VK_FORMAT_FEATURE_BLIT_DST_BIT = 0x00000800, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT = 0x00001000, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG = 0x00002000, + VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR = 0x00004000, + VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR = 0x00008000, }; typedef deUint32 VkFormatFeatureFlags; diff --git a/external/vulkancts/framework/vulkan/vkStrUtilImpl.inl b/external/vulkancts/framework/vulkan/vkStrUtilImpl.inl index 0ab564b89..ea03d3631 100644 --- a/external/vulkancts/framework/vulkan/vkStrUtilImpl.inl +++ b/external/vulkancts/framework/vulkan/vkStrUtilImpl.inl @@ -943,6 +943,8 @@ tcu::Format::Bitfield<32> getFormatFeatureFlagsStr (VkFormatFeatureFlags value) tcu::Format::BitDesc(VK_FORMAT_FEATURE_BLIT_DST_BIT, "VK_FORMAT_FEATURE_BLIT_DST_BIT"), tcu::Format::BitDesc(VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT, "VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT"), tcu::Format::BitDesc(VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG, "VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG"), + tcu::Format::BitDesc(VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR, "VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR"), + tcu::Format::BitDesc(VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR, "VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR"), }; return tcu::Format::Bitfield<32>(value, DE_ARRAY_BEGIN(s_desc), DE_ARRAY_END(s_desc)); } diff --git a/external/vulkancts/modules/vulkan/api/vktApiFeatureInfo.cpp b/external/vulkancts/modules/vulkan/api/vktApiFeatureInfo.cpp index eb1fcd537..4c9c20f1a 100644 --- a/external/vulkancts/modules/vulkan/api/vktApiFeatureInfo.cpp +++ b/external/vulkancts/modules/vulkan/api/vktApiFeatureInfo.cpp @@ -95,6 +95,11 @@ enum LimitType #define LIMIT(_X_) DE_OFFSET_OF(VkPhysicalDeviceLimits, _X_), (const char*)(#_X_) #define FEATURE(_X_) DE_OFFSET_OF(VkPhysicalDeviceFeatures, _X_) +inline bool isExtensionSupported (const vector& extensionStrings, const string& extensionName) +{ + return de::contains(extensionStrings.begin(), extensionStrings.end(), extensionName); +} + bool validateFeatureLimits(VkPhysicalDeviceProperties* properties, VkPhysicalDeviceFeatures* features, TestLog& log) { bool limitsOk = true; @@ -1771,13 +1776,24 @@ void createFormatTests (tcu::TestCaseGroup* testGroup) addFunctionCase(testGroup, "compressed_formats", "", testCompressedFormatsSupported); } -VkImageUsageFlags getValidImageUsageFlags (VkFormat, VkFormatFeatureFlags supportedFeatures) +VkImageUsageFlags getValidImageUsageFlags (const VkFormatFeatureFlags supportedFeatures, const bool useKhrMaintenance1Semantics) { VkImageUsageFlags flags = (VkImageUsageFlags)0; - // If format is supported at all, it must be valid transfer src+dst - if (supportedFeatures != 0) - flags |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT|VK_IMAGE_USAGE_TRANSFER_DST_BIT; + if (useKhrMaintenance1Semantics) + { + if ((supportedFeatures & VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR) != 0) + flags |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT; + + if ((supportedFeatures & VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR) != 0) + flags |= VK_IMAGE_USAGE_TRANSFER_DST_BIT; + } + else + { + // If format is supported at all, it must be valid transfer src+dst + if (supportedFeatures != 0) + flags |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT|VK_IMAGE_USAGE_TRANSFER_DST_BIT; + } if ((supportedFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) != 0) flags |= VK_IMAGE_USAGE_SAMPLED_BIT; @@ -2002,12 +2018,19 @@ tcu::TestStatus imageFormatProperties (Context& context, const VkFormat format, const VkPhysicalDeviceFeatures& deviceFeatures = context.getDeviceFeatures(); const VkPhysicalDeviceLimits& deviceLimits = context.getDeviceProperties().limits; const VkFormatProperties formatProperties = getPhysicalDeviceFormatProperties(context.getInstanceInterface(), context.getPhysicalDevice(), format); + const bool hasKhrMaintenance1 = isExtensionSupported(context.getDeviceExtensions(), "VK_KHR_maintenance1"); const VkFormatFeatureFlags supportedFeatures = tiling == VK_IMAGE_TILING_LINEAR ? formatProperties.linearTilingFeatures : formatProperties.optimalTilingFeatures; - const VkImageUsageFlags usageFlagSet = getValidImageUsageFlags(format, supportedFeatures); + const VkImageUsageFlags usageFlagSet = getValidImageUsageFlags(supportedFeatures, hasKhrMaintenance1); tcu::ResultCollector results (log, "ERROR: "); + if (hasKhrMaintenance1 && (supportedFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) != 0) + { + results.check((supportedFeatures & (VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR | VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR)) != 0, + "A sampled image format must have VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR and VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR format feature flags set"); + } + for (VkImageUsageFlags curUsageFlags = 0; curUsageFlags <= usageFlagSet; curUsageFlags++) { if ((curUsageFlags & ~usageFlagSet) != 0 || diff --git a/external/vulkancts/scripts/src/vulkan.h.in b/external/vulkancts/scripts/src/vulkan.h.in index f18de1f3d..03f0cf4c7 100644 --- a/external/vulkancts/scripts/src/vulkan.h.in +++ b/external/vulkancts/scripts/src/vulkan.h.in @@ -849,6 +849,8 @@ typedef enum VkFormatFeatureFlagBits { VK_FORMAT_FEATURE_BLIT_DST_BIT = 0x00000800, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT = 0x00001000, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG = 0x00002000, + VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR = 0x00004000, + VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR = 0x00008000, VK_FORMAT_FEATURE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkFormatFeatureFlagBits; typedef VkFlags VkFormatFeatureFlags; -- 2.34.1