layers: Add sparseBinding device feature checks
authorMark Lobodzinski <mark@lunarg.com>
Mon, 13 Mar 2017 15:32:45 +0000 (09:32 -0600)
committerMark Lobodzinski <mark@lunarg.com>
Mon, 13 Mar 2017 22:02:59 +0000 (16:02 -0600)
Change-Id: If1145276554ad8dda2839aa5bfc0b3c796873482

layers/buffer_validation.cpp
layers/vk_validation_error_database.txt

index 9282ec7..a90ba50 100644 (file)
@@ -667,6 +667,14 @@ bool PreCallValidateCreateImage(layer_data *device_data, const VkImageCreateInfo
                              validation_error_map[VALIDATION_ERROR_00731]);
     }
 
+    if ((pCreateInfo->flags & VK_IMAGE_CREATE_SPARSE_BINDING_BIT) && (!GetEnabledFeatures(device_data)->sparseBinding)) {
+        skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__,
+                             VALIDATION_ERROR_02143, "DS",
+                             "vkCreateImage(): the sparseBinding device feature is disabled: Images cannot be created with the "
+                             "VK_IMAGE_CREATE_SPARSE_BINDING_BIT set. %s",
+                             validation_error_map[VALIDATION_ERROR_02143]);
+    }
+
     return skip_call;
 }
 
@@ -2168,11 +2176,20 @@ bool ValidateBufferUsageFlags(layer_data *device_data, BUFFER_STATE const *buffe
 
 bool PreCallValidateCreateBuffer(layer_data *device_data, const VkBufferCreateInfo *pCreateInfo) {
     bool skip = false;
+    const debug_report_data *report_data = core_validation::GetReportData(device_data);
+
     // TODO: Add check for VALIDATION_ERROR_00658
-    // TODO: Add check for VALIDATION_ERROR_00666
     // TODO: Add check for VALIDATION_ERROR_00667
     // TODO: Add check for VALIDATION_ERROR_00668
     // TODO: Add check for VALIDATION_ERROR_00669
+
+    if ((pCreateInfo->flags & VK_BUFFER_CREATE_SPARSE_BINDING_BIT) && (!GetEnabledFeatures(device_data)->sparseBinding)) {
+        skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__,
+                        VALIDATION_ERROR_00666, "DS",
+                        "vkCreateBuffer(): the sparseBinding device feature is disabled: Buffers cannot be created with the "
+                        "VK_BUFFER_CREATE_SPARSE_BINDING_BIT set. %s",
+                        validation_error_map[VALIDATION_ERROR_00666]);
+    }
     return skip;
 }
 
index f9bb9c5..8d1b59c 100644 (file)
@@ -654,7 +654,7 @@ VALIDATION_ERROR_00662~^~N~^~None~^~vkCreateBuffer~^~For more information refer
 VALIDATION_ERROR_00663~^~N~^~None~^~vkCreateBuffer~^~For more information refer to Vulkan Spec Section '11.1. Buffers' which states 'size must be greater than 0' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkBufferCreateFlagBits)~^~
 VALIDATION_ERROR_00664~^~Y~^~None~^~vkCreateBuffer~^~For more information refer to Vulkan Spec Section '11.1. Buffers' which states 'If sharingMode is VK_SHARING_MODE_CONCURRENT, pQueueFamilyIndices must be a pointer to an array of queueFamilyIndexCount uint32_t values' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkBufferCreateFlagBits)~^~
 VALIDATION_ERROR_00665~^~Y~^~None~^~vkCreateBuffer~^~For more information refer to Vulkan Spec Section '11.1. Buffers' which states 'If sharingMode is VK_SHARING_MODE_CONCURRENT, queueFamilyIndexCount must be greater than 1' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkBufferCreateFlagBits)~^~
-VALIDATION_ERROR_00666~^~N~^~None~^~vkCreateBuffer~^~For more information refer to Vulkan Spec Section '11.1. Buffers' which states 'If the sparse bindings feature is not enabled, flags must not contain VK_BUFFER_CREATE_SPARSE_BINDING_BIT' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkBufferCreateFlagBits)~^~
+VALIDATION_ERROR_00666~^~Y~^~None~^~vkCreateBuffer~^~For more information refer to Vulkan Spec Section '11.1. Buffers' which states 'If the sparse bindings feature is not enabled, flags must not contain VK_BUFFER_CREATE_SPARSE_BINDING_BIT' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkBufferCreateFlagBits)~^~
 VALIDATION_ERROR_00667~^~N~^~None~^~vkCreateBuffer~^~For more information refer to Vulkan Spec Section '11.1. Buffers' which states 'If the sparse buffer residency feature is not enabled, flags must not contain VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkBufferCreateFlagBits)~^~
 VALIDATION_ERROR_00668~^~N~^~None~^~vkCreateBuffer~^~For more information refer to Vulkan Spec Section '11.1. Buffers' which states 'If the sparse aliased residency feature is not enabled, flags must not contain VK_BUFFER_CREATE_SPARSE_ALIASED_BIT' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkBufferCreateFlagBits)~^~
 VALIDATION_ERROR_00669~^~Y~^~SparseBindingImageBufferCreate~^~vkCreateBuffer~^~For more information refer to Vulkan Spec Section '11.1. Buffers' which states 'If flags contains VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT or VK_BUFFER_CREATE_SPARSE_ALIASED_BIT, it must also contain VK_BUFFER_CREATE_SPARSE_BINDING_BIT' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkBufferCreateFlagBits)~^~
@@ -2070,7 +2070,7 @@ VALIDATION_ERROR_02139~^~N~^~Unknown~^~vkCreateImage~^~For more information refe
 VALIDATION_ERROR_02140~^~N~^~Unknown~^~vkCreateImage~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'If the ASTC LDR texture compression feature is not enabled, format must not be VK_FORMAT_ASTC_4x4_UNORM_BLOCK, VK_FORMAT_ASTC_4x4_SRGB_BLOCK, VK_FORMAT_ASTC_5x4_UNORM_BLOCK, VK_FORMAT_ASTC_5x4_SRGB_BLOCK, VK_FORMAT_ASTC_5x5_UNORM_BLOCK, VK_FORMAT_ASTC_5x5_SRGB_BLOCK, VK_FORMAT_ASTC_6x5_UNORM_BLOCK, VK_FORMAT_ASTC_6x5_SRGB_BLOCK, VK_FORMAT_ASTC_6x6_UNORM_BLOCK, VK_FORMAT_ASTC_6x6_SRGB_BLOCK, VK_FORMAT_ASTC_8x5_UNORM_BLOCK, VK_FORMAT_ASTC_8x5_SRGB_BLOCK, VK_FORMAT_ASTC_8x6_UNORM_BLOCK, VK_FORMAT_ASTC_8x6_SRGB_BLOCK, VK_FORMAT_ASTC_8x8_UNORM_BLOCK, VK_FORMAT_ASTC_8x8_SRGB_BLOCK, VK_FORMAT_ASTC_10x5_UNORM_BLOCK, VK_FORMAT_ASTC_10x5_SRGB_BLOCK, VK_FORMAT_ASTC_10x6_UNORM_BLOCK, VK_FORMAT_ASTC_10x6_SRGB_BLOCK, VK_FORMAT_ASTC_10x8_UNORM_BLOCK, VK_FORMAT_ASTC_10x8_SRGB_BLOCK, VK_FORMAT_ASTC_10x10_UNORM_BLOCK, VK_FORMAT_ASTC_10x10_SRGB_BLOCK, VK_FORMAT_ASTC_12x10_UNORM_BLOCK, VK_FORMAT_ASTC_12x10_SRGB_BLOCK, VK_FORMAT_ASTC_12x12_UNORM_BLOCK, or VK_FORMAT_ASTC_12x12_SRGB_BLOCK' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageCreateInfo)~^~
 VALIDATION_ERROR_02141~^~N~^~Unknown~^~vkCreateImage~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'If the BC texture compression feature is not enabled, format must not be VK_FORMAT_BC1_RGB_UNORM_BLOCK, VK_FORMAT_BC1_RGB_SRGB_BLOCK, VK_FORMAT_BC1_RGBA_UNORM_BLOCK, VK_FORMAT_BC1_RGBA_SRGB_BLOCK, VK_FORMAT_BC2_UNORM_BLOCK, VK_FORMAT_BC2_SRGB_BLOCK, VK_FORMAT_BC3_UNORM_BLOCK, VK_FORMAT_BC3_SRGB_BLOCK, VK_FORMAT_BC4_UNORM_BLOCK, VK_FORMAT_BC4_SNORM_BLOCK, VK_FORMAT_BC5_UNORM_BLOCK, VK_FORMAT_BC5_SNORM_BLOCK, VK_FORMAT_BC6H_UFLOAT_BLOCK, VK_FORMAT_BC6H_SFLOAT_BLOCK, VK_FORMAT_BC7_UNORM_BLOCK, or VK_FORMAT_BC7_SRGB_BLOCK' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageCreateInfo)~^~
 VALIDATION_ERROR_02142~^~N~^~Unknown~^~vkCreateImage~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'If the multisampled storage images feature is not enabled, and usage contains VK_IMAGE_USAGE_STORAGE_BIT, samples must be VK_SAMPLE_COUNT_1_BIT' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageCreateInfo)~^~
-VALIDATION_ERROR_02143~^~N~^~Unknown~^~vkCreateImage~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'If the sparse bindings feature is not enabled, flags must not contain VK_IMAGE_CREATE_SPARSE_BINDING_BIT' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageCreateInfo)~^~
+VALIDATION_ERROR_02143~^~Y~^~None~^~vkCreateImage~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'If the sparse bindings feature is not enabled, flags must not contain VK_IMAGE_CREATE_SPARSE_BINDING_BIT' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageCreateInfo)~^~
 VALIDATION_ERROR_02144~^~Y~^~SparseResidencyImageCreateUnsupportedTypes~^~vkCreateImage~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'If the sparse residency for 2D images feature is not enabled, and imageType is VK_IMAGE_TYPE_2D, flags must not contain VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageCreateInfo)~^~
 VALIDATION_ERROR_02145~^~Y~^~SparseResidencyImageCreateUnsupportedTypes~^~vkCreateImage~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'If the sparse residency for 3D images feature is not enabled, and imageType is VK_IMAGE_TYPE_3D, flags must not contain VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageCreateInfo)~^~
 VALIDATION_ERROR_02146~^~Y~^~SparseResidencyImageCreateUnsupportedSamples~^~vkCreateImage~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'If the sparse residency for images with 2 samples feature is not enabled, imageType is VK_IMAGE_TYPE_2D, and samples is VK_SAMPLE_COUNT_2_BIT, flags must not contain VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageCreateInfo)~^~