summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2019-11-04 00:21:06 -0800
committerKenneth Graunke <[email protected]>2019-12-22 16:18:30 -0800
commit97e9de17952d1382512007e4745c25b9c9106a46 (patch)
treee7ef571c028a232bdf91c97554372fd56cb19469 /src/gallium
parentc96c1141fba7d94b4b3b048111d8858ecac7cf55 (diff)
iris: Avoid replacing backing storage for buffers with no contents
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.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/iris/iris_resource.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c
index ed24d629fe5..952d6615584 100644
--- a/src/gallium/drivers/iris/iris_resource.c
+++ b/src/gallium/drivers/iris/iris_resource.c
@@ -1240,6 +1240,10 @@ iris_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.