crocus: Avoid replacing backing storage for buffers with no contents
Ported 97e9de1795
from iris
We might get asked to pitch the storage on a buffer that already has
no meaningful contents. In this case, the existing buffer is as good
as a new one.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11567>
This commit is contained in:
@@ -1130,6 +1130,10 @@ crocus_invalidate_resource(struct pipe_context *ctx,
|
||||
if (resource->target != PIPE_BUFFER)
|
||||
return;
|
||||
|
||||
/* If it's already invalidated, don't bother doing anything. */
|
||||
if (res->valid_buffer_range.start > res->valid_buffer_range.end)
|
||||
return;
|
||||
|
||||
if (!resource_is_busy(ice, res)) {
|
||||
/* The resource is idle, so just mark that it contains no data and
|
||||
* keep using the same underlying buffer object.
|
||||
|
Reference in New Issue
Block a user