Fix checkImageSupport()
Use proper getPhysicalDeviceFeatures2() to detect
samplerYcbcrConversion support.
Component: Vulkan
VK-GL-CTS issue: 755
Affects: dEQP-VK.ycbcr.*
Change-Id: I5e25eae7a1c25340e56eabb1ab6ca3709eb15399
diff --git a/external/vulkancts/modules/vulkan/ycbcr/vktYCbCrUtil.cpp b/external/vulkancts/modules/vulkan/ycbcr/vktYCbCrUtil.cpp
index 5add903..1c6f17d 100644
--- a/external/vulkancts/modules/vulkan/ycbcr/vktYCbCrUtil.cpp
+++ b/external/vulkancts/modules/vulkan/ycbcr/vktYCbCrUtil.cpp
@@ -196,9 +196,8 @@
void checkImageSupport (Context& context, VkFormat format, VkImageCreateFlags createFlags, VkImageTiling tiling)
{
- const bool disjoint = (createFlags & VK_IMAGE_CREATE_DISJOINT_BIT) != 0;
- const VkPhysicalDeviceSamplerYcbcrConversionFeatures* features = findStructure<VkPhysicalDeviceSamplerYcbcrConversionFeatures>(context.getDeviceFeatures2().pNext);
- vector<string> reqExts;
+ const bool disjoint = (createFlags & VK_IMAGE_CREATE_DISJOINT_BIT) != 0;
+ vector<string> reqExts;
if (!isCoreDeviceExtension(context.getUsedApiVersion(), "VK_KHR_sampler_ycbcr_conversion"))
reqExts.push_back("VK_KHR_sampler_ycbcr_conversion");
@@ -213,12 +212,33 @@
for (vector<string>::const_iterator extIter = reqExts.begin(); extIter != reqExts.end(); ++extIter)
{
- if (!de::contains(context.getDeviceExtensions().begin(), context.getDeviceExtensions().end(), *extIter))
+ if (!isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), *extIter))
TCU_THROW(NotSupportedError, (*extIter + " is not supported").c_str());
}
- if (!features || features->samplerYcbcrConversion == VK_FALSE)
- TCU_THROW(NotSupportedError, "samplerYcbcrConversion is not supported");
+ {
+ vk::VkPhysicalDeviceSamplerYcbcrConversionFeatures ycbcrFeature =
+ {
+ vk::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES,
+ DE_NULL,
+ VK_FALSE
+ };
+
+ vk::VkPhysicalDeviceFeatures features;
+ deMemset(&features, 0, sizeof(vk::VkPhysicalDeviceFeatures));
+
+ vk::VkPhysicalDeviceFeatures2 featuresExt =
+ {
+ vk::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2,
+ &ycbcrFeature,
+ features
+ };
+
+ context.getInstanceInterface().getPhysicalDeviceFeatures2(context.getPhysicalDevice(), &featuresExt);
+
+ if (ycbcrFeature.samplerYcbcrConversion == VK_FALSE)
+ TCU_THROW(NotSupportedError, "samplerYcbcrConversion is not supported");
+ }
{
const VkFormatProperties formatProperties = getPhysicalDeviceFormatProperties(context.getInstanceInterface(),