lavapipe: report out-of-memory when binding
This isn't the perfect error-code, but we don't really have anything better, it seems. The ideal fix here would be to fix LLVMpipe to support larger textures, but this is probably as far as I'm interested in chasing down this path for now. Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10689>
This commit is contained in:

committed by
Marge Bot

parent
6012dec550
commit
e10618f6f5
@@ -852,10 +852,12 @@ static bool llvmpipe_resource_bind_backing(struct pipe_screen *screen,
|
||||
if (!lpr->backable)
|
||||
return FALSE;
|
||||
|
||||
if (llvmpipe_resource_is_texture(&lpr->base)) {
|
||||
if (lpr->size_required > LP_MAX_TEXTURE_SIZE)
|
||||
return FALSE;
|
||||
|
||||
if (llvmpipe_resource_is_texture(&lpr->base))
|
||||
lpr->tex_data = (char *)pmem + offset;
|
||||
else
|
||||
} else
|
||||
lpr->data = (char *)pmem + offset;
|
||||
lpr->backing_offset = offset;
|
||||
|
||||
|
@@ -1629,12 +1629,18 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_BindImageMemory2(VkDevice _device,
|
||||
}
|
||||
|
||||
if (!did_bind) {
|
||||
image->pmem = mem->pmem;
|
||||
image->memory_offset = bind_info->memoryOffset;
|
||||
device->pscreen->resource_bind_backing(device->pscreen,
|
||||
if (!device->pscreen->resource_bind_backing(device->pscreen,
|
||||
image->bo,
|
||||
mem->pmem,
|
||||
bind_info->memoryOffset);
|
||||
bind_info->memoryOffset)) {
|
||||
/* This is probably caused by the texture being too large, so let's
|
||||
* report this as the *closest* allowed error-code. It's not ideal,
|
||||
* but it's unlikely that anyone will care too much.
|
||||
*/
|
||||
return vk_error(device->instance, VK_ERROR_OUT_OF_DEVICE_MEMORY);
|
||||
}
|
||||
image->pmem = mem->pmem;
|
||||
image->memory_offset = bind_info->memoryOffset;
|
||||
}
|
||||
}
|
||||
return VK_SUCCESS;
|
||||
|
Reference in New Issue
Block a user