Make ImageSamplingInstance loop over pNexts
authorJoshua Ashton <joshua@froggi.es>
Fri, 17 Apr 2020 03:17:07 +0000 (04:17 +0100)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 7 May 2020 12:49:09 +0000 (08:49 -0400)
We need this to potentially support multiple pNexts.

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

Components: Vulkan
VK-GL-CTS issue: 2331

Change-Id: Ia38f9a6f2a2ffafe1d71c8169bb8f20f8cde1da5

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

index cb9bf32..0a98211 100644 (file)
@@ -346,9 +346,10 @@ ImageSamplingInstance::ImageSamplingInstance (Context&                                             context,
        SimpleAllocator                                                 memAlloc                                (vk, vkDevice, getPhysicalDeviceMemoryProperties(context.getInstanceInterface(), context.getPhysicalDevice()));
        const VkComponentMapping                                componentMappingRGBA    = { VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_A };
 
-       if (m_samplerParams.pNext != DE_NULL)
+       void const* pNext = m_samplerParams.pNext;
+       while (pNext != DE_NULL)
        {
-               const VkStructureType nextType = *reinterpret_cast<const VkStructureType*>(m_samplerParams.pNext);
+               const VkStructureType nextType = *reinterpret_cast<const VkStructureType*>(pNext);
                switch (nextType)
                {
                        case VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO_EXT:
@@ -380,8 +381,12 @@ ImageSamplingInstance::ImageSamplingInstance (Context&                                             context,
                                                TCU_THROW(NotSupportedError, "filterMinmaxImageComponentMapping is not supported (R mapping is not IDENTITY)");
                                        }
                                }
+                               pNext = reinterpret_cast<const VkSamplerReductionModeCreateInfo*>(pNext)->pNext;
                        }
                        break;
+                       case VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO:
+                               pNext = reinterpret_cast<const VkSamplerYcbcrConversionInfo*>(pNext)->pNext;
+                               break;
                        default:
                                TCU_FAIL("Unrecognized sType in chained sampler create info");
                }