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:
Erik Faye-Lund
2021-05-07 13:34:52 +02:00
committed by Marge Bot
parent 6012dec550
commit e10618f6f5
2 changed files with 14 additions and 6 deletions

View File

@@ -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;