layers: Update ValidateMemIsMapped error enums
authorMark Lobodzinski <mark@lunarg.com>
Tue, 15 Nov 2016 15:56:03 +0000 (08:56 -0700)
committerMark Lobodzinski <mark@lunarg.com>
Wed, 16 Nov 2016 20:07:55 +0000 (13:07 -0700)
Plumbed in VU error enums, updated tests and database.

Change-Id: I114d269c686cddd6b1d3acb098d0b2f5fe4fdc17

layers/core_validation.cpp
layers/vk_validation_error_database.txt

index 2a8f382..aceb326 100644 (file)
@@ -11181,26 +11181,32 @@ static bool validateMemoryIsMapped(layer_data *dev_data, const char *funcName, u
     for (uint32_t i = 0; i < memRangeCount; ++i) {
         auto mem_info = getMemObjInfo(dev_data, pMemRanges[i].memory);
         if (mem_info) {
-            if (mem_info->mem_range.offset > pMemRanges[i].offset) {
-                skip_call |=
-                    log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT,
-                            (uint64_t)pMemRanges[i].memory, __LINE__, MEMTRACK_INVALID_MAP, "MEM",
-                            "%s: Flush/Invalidate offset (" PRINTF_SIZE_T_SPECIFIER ") is less than Memory Object's offset "
-                            "(" PRINTF_SIZE_T_SPECIFIER ").",
-                            funcName, static_cast<size_t>(pMemRanges[i].offset), static_cast<size_t>(mem_info->mem_range.offset));
-            }
-
-            const uint64_t dev_dataTerminus = (mem_info->mem_range.size == VK_WHOLE_SIZE)
-                                                  ? mem_info->alloc_info.allocationSize
-                                                  : (mem_info->mem_range.offset + mem_info->mem_range.size);
-            if (pMemRanges[i].size != VK_WHOLE_SIZE && (dev_dataTerminus < (pMemRanges[i].offset + pMemRanges[i].size))) {
-                skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
-                                     VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT, (uint64_t)pMemRanges[i].memory, __LINE__,
-                                     MEMTRACK_INVALID_MAP, "MEM", "%s: Flush/Invalidate upper-bound (" PRINTF_SIZE_T_SPECIFIER
-                                                                  ") exceeds the Memory Object's upper-bound "
-                                                                  "(" PRINTF_SIZE_T_SPECIFIER ").",
-                                     funcName, static_cast<size_t>(pMemRanges[i].offset + pMemRanges[i].size),
-                                     static_cast<size_t>(dev_dataTerminus));
+            if (pMemRanges[i].size == VK_WHOLE_SIZE) {
+                if (mem_info->mem_range.offset > pMemRanges[i].offset) {
+                    skip_call |=
+                        log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT,
+                                (uint64_t)pMemRanges[i].memory, __LINE__, VALIDATION_ERROR_00643, "MEM",
+                                "%s: Flush/Invalidate offset (" PRINTF_SIZE_T_SPECIFIER ") is less than Memory Object's offset "
+                                "(" PRINTF_SIZE_T_SPECIFIER "). %s",
+                                funcName, static_cast<size_t>(pMemRanges[i].offset),
+                                static_cast<size_t>(mem_info->mem_range.offset), validation_error_map[VALIDATION_ERROR_00643]);
+                }
+            } else {
+                const uint64_t data_end = (mem_info->mem_range.size == VK_WHOLE_SIZE)
+                                              ? mem_info->alloc_info.allocationSize
+                                              : (mem_info->mem_range.offset + mem_info->mem_range.size);
+                if ((mem_info->mem_range.offset > pMemRanges[i].offset) ||
+                    (data_end < (pMemRanges[i].offset + pMemRanges[i].size))) {
+                    skip_call |=
+                        log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT,
+                                (uint64_t)pMemRanges[i].memory, __LINE__, VALIDATION_ERROR_00642, "MEM",
+                                "%s: Flush/Invalidate size or offset (" PRINTF_SIZE_T_SPECIFIER ", " PRINTF_SIZE_T_SPECIFIER
+                                ") exceed the Memory Object's upper-bound "
+                                "(" PRINTF_SIZE_T_SPECIFIER "). %s",
+                                funcName, static_cast<size_t>(pMemRanges[i].offset + pMemRanges[i].size),
+                                static_cast<size_t>(pMemRanges[i].offset), static_cast<size_t>(data_end),
+                                validation_error_map[VALIDATION_ERROR_00642]);
+                }
             }
         }
     }
index b988e3b..f1e08ff 100644 (file)
@@ -632,8 +632,8 @@ VALIDATION_ERROR_00638~^~Y~^~Unknown~^~vkInvalidateMappedMemoryRanges~^~For more
 VALIDATION_ERROR_00639~^~Y~^~Unknown~^~vkInvalidateMappedMemoryRanges~^~For more information refer to Vulkan Spec Section '10.2.1. Host Access to Device Memory Objects' which states 'pMemoryRanges must be a pointer to an array of memoryRangeCount valid VkMappedMemoryRange structures' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkInvalidateMappedMemoryRanges)~^~
 VALIDATION_ERROR_00640~^~U~^~Unknown~^~vkInvalidateMappedMemoryRanges~^~For more information refer to Vulkan Spec Section '10.2.1. Host Access to Device Memory Objects' which states 'memoryRangeCount must be greater than 0' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkInvalidateMappedMemoryRanges)~^~
 VALIDATION_ERROR_00641~^~U~^~Unknown~^~vkInvalidateMappedMemoryRanges~^~For more information refer to Vulkan Spec Section '10.2.1. Host Access to Device Memory Objects' which states 'memory must currently be mapped' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkMappedMemoryRange)~^~
-VALIDATION_ERROR_00642~^~U~^~Unknown~^~vkInvalidateMappedMemoryRanges~^~For more information refer to Vulkan Spec Section '10.2.1. Host Access to Device Memory Objects' which states 'If size is not equal to VK_WHOLE_SIZE, offset and size must specify a range contained within the currently mapped range of memory' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkMappedMemoryRange)~^~
-VALIDATION_ERROR_00643~^~U~^~Unknown~^~vkInvalidateMappedMemoryRanges~^~For more information refer to Vulkan Spec Section '10.2.1. Host Access to Device Memory Objects' which states 'If size is equal to VK_WHOLE_SIZE, offset must be within the currently mapped range of memory' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkMappedMemoryRange)~^~
+VALIDATION_ERROR_00642~^~Y~^~InvalidMemoryMapping~^~vkInvalidateMappedMemoryRanges~^~For more information refer to Vulkan Spec Section '10.2.1. Host Access to Device Memory Objects' which states 'If size is not equal to VK_WHOLE_SIZE, offset and size must specify a range contained within the currently mapped range of memory' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkMappedMemoryRange)~^~
+VALIDATION_ERROR_00643~^~Y~^~InvalidMemoryMapping~^~vkInvalidateMappedMemoryRanges~^~For more information refer to Vulkan Spec Section '10.2.1. Host Access to Device Memory Objects' which states 'If size is equal to VK_WHOLE_SIZE, offset must be within the currently mapped range of memory' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkMappedMemoryRange)~^~
 VALIDATION_ERROR_00644~^~U~^~Unknown~^~vkInvalidateMappedMemoryRanges~^~For more information refer to Vulkan Spec Section '10.2.1. Host Access to Device Memory Objects' which states 'offset must be a multiple of VkPhysicalDeviceLimits::nonCoherentAtomSize' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkMappedMemoryRange)~^~
 VALIDATION_ERROR_00645~^~U~^~Unknown~^~vkInvalidateMappedMemoryRanges~^~For more information refer to Vulkan Spec Section '10.2.1. Host Access to Device Memory Objects' which states 'If size is not equal to VK_WHOLE_SIZE, size must be a multiple of VkPhysicalDeviceLimits::nonCoherentAtomSize' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkMappedMemoryRange)~^~
 VALIDATION_ERROR_00646~^~N~^~Unknown~^~vkInvalidateMappedMemoryRanges~^~For more information refer to Vulkan Spec Section '10.2.1. Host Access to Device Memory Objects' which states 'sType must be VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkMappedMemoryRange)~^~TBD in parameter validation layer.