summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>2021-06-22 21:36:41 +0300
committerMarge Bot <eric+marge@anholt.net>2021-06-23 08:16:57 +0000
commit9b7cba7724f5cc407a889a1feeccf7c9fb105f50 (patch)
tree1c313a03a1adb40d80a3b2370077dd3332d878f7
parent4dc42843423aa6b0771f863c3359c44810424d63 (diff)
anv: bound checks buffer memory binding in debug builds
Validation layers should warn you about this (VUID-VkBindBufferMemoryInfo-size-01037) but this would be useful for zink debugging. Requested by Zmike. v2: Also check memoryOffset (Jason) Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11542>
-rw-r--r--src/intel/vulkan/anv_device.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 8943097c08f..5597b065467 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -4333,6 +4333,8 @@ anv_bind_buffer_memory(const VkBindBufferMemoryInfo *pBindInfo)
assert(pBindInfo->sType == VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO);
if (mem) {
+ assert(pBindInfo->memoryOffset < mem->bo->size);
+ assert(mem->bo->size - pBindInfo->memoryOffset >= buffer->size);
buffer->address = (struct anv_address) {
.bo = mem->bo,
.offset = pBindInfo->memoryOffset,