anv: Add a couple more checks in MapMemory
Reviwed-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13610>
This commit is contained in:
parent
0967584549
commit
f9b69e43a5
|
@ -4033,11 +4033,20 @@ VkResult anv_MapMemory(
|
||||||
assert(size > 0);
|
assert(size > 0);
|
||||||
assert(offset + size <= mem->bo->size);
|
assert(offset + size <= mem->bo->size);
|
||||||
|
|
||||||
/* FIXME: Is this supposed to be thread safe? Since vkUnmapMemory() only
|
if (size != (size_t)size) {
|
||||||
* takes a VkDeviceMemory pointer, it seems like only one map of the memory
|
return vk_errorf(device, VK_ERROR_MEMORY_MAP_FAILED,
|
||||||
* at a time is valid. We could just mmap up front and return an offset
|
"requested size 0x%"PRIx64" does not fit in %u bits",
|
||||||
* pointer here, but that may exhaust virtual memory on 32 bit
|
size, (unsigned)(sizeof(size_t) * 8));
|
||||||
* userspace. */
|
}
|
||||||
|
|
||||||
|
/* From the Vulkan 1.2.194 spec:
|
||||||
|
*
|
||||||
|
* "memory must not be currently host mapped"
|
||||||
|
*/
|
||||||
|
if (mem->bo->map != NULL) {
|
||||||
|
return vk_errorf(device, VK_ERROR_MEMORY_MAP_FAILED,
|
||||||
|
"Memory object already mapped.");
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t gem_flags = 0;
|
uint32_t gem_flags = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue