mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 17:58:26 +02:00
llvmpipe: misc fixes for sparse binding
This change:
1. Move size validation within sparse binding, but not escape to
non-sparse code path.
2. Error out if sparse is requested on unsupported platforms.
Fixes: d747c4a874 ("lavapipe: Implement sparse buffers and images")
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38074>
This commit is contained in:
parent
66414c6b70
commit
e0acc5c2b4
1 changed files with 8 additions and 2 deletions
|
|
@ -1598,9 +1598,13 @@ llvmpipe_resource_bind_backing(struct pipe_screen *pscreen,
|
|||
if (!lpr->backable)
|
||||
return false;
|
||||
|
||||
if ((lpr->base.flags & PIPE_RESOURCE_FLAG_SPARSE) && offset < lpr->size_required) {
|
||||
if (lpr->base.flags & PIPE_RESOURCE_FLAG_SPARSE) {
|
||||
#if DETECT_OS_LINUX
|
||||
struct llvmpipe_memory_allocation *mem = (struct llvmpipe_memory_allocation *)pmem;
|
||||
|
||||
if (offset >= lpr->size_required)
|
||||
return false;
|
||||
|
||||
if (mem) {
|
||||
if (llvmpipe_resource_is_texture(&lpr->base)) {
|
||||
mmap((char *)lpr->tex_data + offset, size, PROT_READ|PROT_WRITE,
|
||||
|
|
@ -1620,9 +1624,11 @@ llvmpipe_resource_bind_backing(struct pipe_screen *pscreen,
|
|||
MAP_SHARED|MAP_FIXED|MAP_ANONYMOUS, -1, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
addr = llvmpipe_map_memory(pscreen, pmem);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue