Make checkSupportImageSamplingInstance loop through pNexts
authorJoshua Ashton <joshua@froggi.es>
Fri, 17 Apr 2020 02:51:34 +0000 (03:51 +0100)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 1 May 2020 08:46:36 +0000 (04:46 -0400)
We need this to support multiple potential pNexts in the future.

Affected tests:
dEQP-VK.pipeline.sampler.*

Components: Vulkan
VK-GL-CTS issue: 2331

Change-Id: I076e864d4b842d3993fdfa9bbd5925765870f6f7

external/vulkancts/modules/vulkan/pipeline/vktPipelineImageSamplingInstance.cpp

index 5ae09af7bf842a2bb283f86a8ad82169c5f2c4ed..cb9bf32d68a66d9749fae63e2d61205cbb69528b 100644 (file)
@@ -254,16 +254,29 @@ void checkSupportImageSamplingInstance (Context& context, ImageSamplingInstanceP
                }
        }
 
-       if (params.samplerParams.pNext != DE_NULL)
+       void const* pNext = params.samplerParams.pNext;
+       while (pNext != DE_NULL)
        {
-               const VkStructureType nextType = *reinterpret_cast<const VkStructureType*>(params.samplerParams.pNext);
-
-               if (nextType == VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO_EXT)
+               const VkStructureType nextType = *reinterpret_cast<const VkStructureType*>(pNext);
+               switch (nextType)
                {
-                       context.requireDeviceFunctionality("VK_EXT_sampler_filter_minmax");
+                       case VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO_EXT:
+                       {
+                               context.requireDeviceFunctionality("VK_EXT_sampler_filter_minmax");
+
+                               if (!isMinMaxFilteringSupported(context.getInstanceInterface(), context.getPhysicalDevice(), params.imageFormat, VK_IMAGE_TILING_OPTIMAL))
+                                       throw tcu::NotSupportedError(std::string("Unsupported format for min/max filtering: ") + getFormatName(params.imageFormat));
 
-                       if (!isMinMaxFilteringSupported(context.getInstanceInterface(), context.getPhysicalDevice(), params.imageFormat, VK_IMAGE_TILING_OPTIMAL))
-                               throw tcu::NotSupportedError(std::string("Unsupported format for min/max filtering: ") + getFormatName(params.imageFormat));
+                               pNext = reinterpret_cast<const VkSamplerReductionModeCreateInfo*>(pNext)->pNext;
+                               break;
+                       }
+                       case VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO:
+                               context.requireDeviceFunctionality("VK_KHR_sampler_ycbcr_conversion");
+
+                               pNext = reinterpret_cast<const VkSamplerYcbcrConversionInfo*>(pNext)->pNext;
+                               break;
+                       default:
+                               TCU_FAIL("Unrecognized sType in chained sampler create info");
                }
        }