diff options
| author | Tony Barbour <tony@LunarG.com> | 2018-04-19 11:41:36 -0600 |
|---|---|---|
| committer | Tony-LunarG <tony@lunarg.com> | 2018-04-20 10:14:20 -0600 |
| commit | 99b0d0c37e6e014272397756b1ae13034aa9fc0b (patch) | |
| tree | d91c6b2bae8e9c7167fc2e7d0ebacb6c892bed10 /layers/core_validation.cpp | |
| parent | ac70234a5e4d8299ed1c8a5bb90227b57675387d (diff) | |
| download | usermoji-99b0d0c37e6e014272397756b1ae13034aa9fc0b.tar.xz | |
layers: Validate against nonCoherentAtomSize
FlushMappedMemoryRanges and InvalidateMappedMemoryRanges check
size and offset against nonCoherentAtomSize.
Github issues 329 & 2584
Gitlab Issue 611
Change-Id: I4cbc6c21f6fe4b6187b381b2565a90c61417bee5
Diffstat (limited to 'layers/core_validation.cpp')
| -rw-r--r-- | layers/core_validation.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index a798cc62..30d6f3cb 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -9803,7 +9803,10 @@ static bool ValidateMappedMemoryRangeDeviceLimits(layer_data *dev_data, const ch ", which is not a multiple of VkPhysicalDeviceLimits::nonCoherentAtomSize (0x%" PRIxLEAST64 ").", func_name, i, mem_ranges[i].offset, atom_size); } - if ((mem_ranges[i].size != VK_WHOLE_SIZE) && (SafeModulo(mem_ranges[i].size, atom_size) != 0)) { + auto mem_info = GetMemObjInfo(dev_data, mem_ranges[i].memory); + if ((mem_ranges[i].size != VK_WHOLE_SIZE) && + (mem_ranges[i].size + mem_ranges[i].offset != mem_info->alloc_info.allocationSize) && + (SafeModulo(mem_ranges[i].size, atom_size) != 0)) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT, HandleToUint64(mem_ranges->memory), VALIDATION_ERROR_0c200adc, "%s: Size in pMemRanges[%d] is 0x%" PRIxLEAST64 @@ -9818,6 +9821,7 @@ static bool PreCallValidateFlushMappedMemoryRanges(layer_data *dev_data, uint32_ const VkMappedMemoryRange *mem_ranges) { bool skip = false; lock_guard_t lock(global_lock); + skip |= ValidateMappedMemoryRangeDeviceLimits(dev_data, "vkFlushMappedMemoryRanges", mem_range_count, mem_ranges); skip |= ValidateAndCopyNoncoherentMemoryToDriver(dev_data, mem_range_count, mem_ranges); skip |= validateMemoryIsMapped(dev_data, "vkFlushMappedMemoryRanges", mem_range_count, mem_ranges); return skip; @@ -9838,6 +9842,7 @@ static bool PreCallValidateInvalidateMappedMemoryRanges(layer_data *dev_data, ui const VkMappedMemoryRange *mem_ranges) { bool skip = false; lock_guard_t lock(global_lock); + skip |= ValidateMappedMemoryRangeDeviceLimits(dev_data, "vkInvalidateMappedMemoryRanges", mem_range_count, mem_ranges); skip |= validateMemoryIsMapped(dev_data, "vkInvalidateMappedMemoryRanges", mem_range_count, mem_ranges); return skip; } |
