Fix coherent memory allocation to use device
When allocating coherent memory (generally, suballocations) and looking up existing VkDeviceMemory entries, the device is critical to finding valid allocation blocks, otherwise allocations from other devices might be chosen, which invalidate things. This happens only in situations where a single process has multiple VkDevices, so it was rare enough not to be caught until now. Reviewed-by: Aaron Ruby <aruby@blackberry.com> Acked-by: Yonggang Luo <luoyonggang@gmail.com> Acked-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
This commit is contained in:
@@ -3155,6 +3155,8 @@ VkResult ResourceTracker::getCoherentMemory(const VkMemoryAllocateInfo* pAllocat
|
||||
{
|
||||
AutoLock<RecursiveLock> lock(mLock);
|
||||
for (const auto& [memory, info] : info_VkDeviceMemory) {
|
||||
if (info.device != device) continue;
|
||||
|
||||
if (info.memoryTypeIndex != pAllocateInfo->memoryTypeIndex) continue;
|
||||
|
||||
if (info.dedicated || dedicated) continue;
|
||||
|
||||
Reference in New Issue
Block a user