Check compressed 3D format support in PipelineImageSamplingInstance
authorPyry Haulos <phaulos@google.com>
Fri, 22 Jan 2016 21:27:31 +0000 (13:27 -0800)
committerPyry Haulos <phaulos@google.com>
Fri, 22 Jan 2016 21:44:17 +0000 (13:44 -0800)
Fixes #238

Change-Id: I7496a27b445e98b341bdc10c9da76aff5ad996cd

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

index 35f9167..3783907 100644 (file)
@@ -377,6 +377,30 @@ ImageSamplingInstance::ImageSamplingInstance (Context&                                                     context,
                !isLinearFilteringSupported(context.getInstanceInterface(), context.getPhysicalDevice(), imageFormat, VK_IMAGE_TILING_OPTIMAL))
                throw tcu::NotSupportedError(std::string("Unsupported format for linear filtering: ") + getFormatName(imageFormat));
 
+       if (isCompressedFormat(imageFormat) && imageViewType == VK_IMAGE_VIEW_TYPE_3D)
+       {
+               // \todo [2016-01-22 pyry] Mandate VK_ERROR_FORMAT_NOT_SUPPORTED
+               try
+               {
+                       const VkImageFormatProperties   formatProperties        = getPhysicalDeviceImageFormatProperties(context.getInstanceInterface(),
+                                                                                                                                                                                                                context.getPhysicalDevice(),
+                                                                                                                                                                                                                imageFormat,
+                                                                                                                                                                                                                VK_IMAGE_TYPE_3D,
+                                                                                                                                                                                                                VK_IMAGE_TILING_OPTIMAL,
+                                                                                                                                                                                                                VK_IMAGE_USAGE_SAMPLED_BIT,
+                                                                                                                                                                                                                (VkImageCreateFlags)0);
+
+                       if (formatProperties.maxExtent.width == 0 &&
+                               formatProperties.maxExtent.height == 0 &&
+                               formatProperties.maxExtent.depth == 0)
+                               TCU_THROW(NotSupportedError, "3D compressed format not supported");
+               }
+               catch (const Error&)
+               {
+                       TCU_THROW(NotSupportedError, "3D compressed format not supported");
+               }
+       }
+
        // Create texture image, view and sampler
        {
                VkImageCreateFlags                      imageFlags                      = 0u;