diff options
| author | Tobin Ehlis <tobine@google.com> | 2016-05-12 08:31:32 -0600 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2016-05-16 08:28:48 -0600 |
| commit | e2c825e44fea236a602ed16dc6fe434ff33d9833 (patch) | |
| tree | 033bb06575e68fcfc26c167606ef2c07310f488c /layers/core_validation.cpp | |
| parent | 2c087866f3b24f6dd865a41221899185bb535ab1 (diff) | |
| download | usermoji-e2c825e44fea236a602ed16dc6fe434ff33d9833.tar.xz | |
layers: Fixes to memory mapping checks
MapMemory w/ size 0 is now invalid in the spec so remove comment and
change callback to ERROR.
Update some error messages for clarity.
Only update the mapped memory range state if MapMemory succeeds.
Diffstat (limited to 'layers/core_validation.cpp')
| -rw-r--r-- | layers/core_validation.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 0199a71d..d002ca5d 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -4665,8 +4665,7 @@ static bool validateMemRange(layer_data *my_data, VkDeviceMemory mem, VkDeviceSi bool skipCall = false; if (size == 0) { - // TODO: a size of 0 is not listed as an invalid use in the spec, should it be? - skipCall = log_msg(my_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT, + skipCall = log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT, (uint64_t)mem, __LINE__, MEMTRACK_INVALID_MAP, "MEM", "VkMapMemory: Attempting to map memory range of size zero"); } @@ -4685,14 +4684,14 @@ static bool validateMemRange(layer_data *my_data, VkDeviceMemory mem, VkDeviceSi if (offset >= mem_element->second.allocInfo.allocationSize) { skipCall = log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT, (uint64_t)mem, __LINE__, MEMTRACK_INVALID_MAP, - "MEM", "Mapping Memory from 0x%" PRIx64 " to 0x%" PRIx64 " with total array size 0x%" PRIx64, offset, + "MEM", "Mapping Memory from 0x%" PRIx64 " to 0x%" PRIx64 " with size of VK_WHOLE_SIZE oversteps total array size 0x%" PRIx64, offset, mem_element->second.allocInfo.allocationSize, mem_element->second.allocInfo.allocationSize); } } else { if ((offset + size) > mem_element->second.allocInfo.allocationSize) { skipCall = log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT, (uint64_t)mem, __LINE__, MEMTRACK_INVALID_MAP, - "MEM", "Mapping Memory from 0x%" PRIx64 " to 0x%" PRIx64 " with total array size 0x%" PRIx64, offset, + "MEM", "Mapping Memory from 0x%" PRIx64 " to 0x%" PRIx64 " oversteps total array size 0x%" PRIx64, offset, size + offset, mem_element->second.allocInfo.allocationSize); } } @@ -9429,18 +9428,20 @@ MapMemory(VkDevice device, VkDeviceMemory mem, VkDeviceSize offset, VkDeviceSize } } skip_call |= validateMemRange(dev_data, mem, offset, size); - storeMemRanges(dev_data, mem, offset, size); #endif skip_call |= ValidateMapImageLayouts(device, mem); lock.unlock(); if (!skip_call) { result = dev_data->device_dispatch_table->MapMemory(device, mem, offset, size, flags, ppData); + if (VK_SUCCESS == result) { #if MTMERGESOURCE - lock.lock(); - initializeAndTrackMemory(dev_data, mem, size, ppData); - lock.unlock(); + lock.lock(); + storeMemRanges(dev_data, mem, offset, size); + initializeAndTrackMemory(dev_data, mem, size, ppData); + lock.unlock(); #endif + } } return result; } |
