layers: Add textureCompressionBC feature check
authorMark Lobodzinski <mark@lunarg.com>
Wed, 1 Mar 2017 23:19:36 +0000 (16:19 -0700)
committerMark Lobodzinski <mark@lunarg.com>
Mon, 13 Mar 2017 22:02:59 +0000 (16:02 -0600)
Change-Id: I4eca8c73a1cc2549402b436f8634fa9e72b9b9ce

layers/parameter_validation.cpp

index 76c69cd2c28671caa4ccc5832828ecfd10d0d103..3ff9659f615539462727d55c3615eb5c4404e16e 100644 (file)
@@ -2561,6 +2561,15 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateImage(VkDevice device, const VkImageCreateI
                         string_VkFormat(pCreateInfo->format));
         }
 
+        if ((device_data->physical_device_features.textureCompressionBC == false) &&
+            vk_format_is_compressed_BC(pCreateInfo->format)) {
+            skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__,
+                            DEVICE_FEATURE, LayerName,
+                            "vkCreateImage(): Attempting to create VkImage with format %s. The textureCompressionBC feature is "
+                            "not enabled: BC compressed formats cannot be used to create images.",
+                            string_VkFormat(pCreateInfo->format));
+        }
+
         // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml
         if (pCreateInfo->sharingMode == VK_SHARING_MODE_CONCURRENT) {
             // If sharingMode is VK_SHARING_MODE_CONCURRENT, queueFamilyIndexCount must be greater than 1