Skip to content

Instantly share code, notes, and snippets.

@anarsoul
Created January 22, 2024 19:20
Show Gist options
  • Save anarsoul/d99b3a3151c22810269e879305ea872f to your computer and use it in GitHub Desktop.
Save anarsoul/d99b3a3151c22810269e879305ea872f to your computer and use it in GitHub Desktop.
diff --git a/src/gallium/drivers/lima/lima_context.c b/src/gallium/drivers/lima/lima_context.c
index 802f308f48e..2275e5282f0 100644
--- a/src/gallium/drivers/lima/lima_context.c
+++ b/src/gallium/drivers/lima/lima_context.c
@@ -114,11 +114,23 @@ lima_invalidate_resource(struct pipe_context *pctx, struct pipe_resource *prsc)
return;
struct lima_job *job = entry->data;
- if (job->key.zsbuf && (job->key.zsbuf->texture == prsc))
+ bool has_draw_pending = lima_job_has_draw_pending(job);
+
+ if (job->key.zsbuf && (job->key.zsbuf->texture == prsc)) {
job->resolve &= ~(PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL);
+ if (!has_draw_pending) {
+ struct lima_surface *surf = lima_surface(job->key.zsbuf);
+ surf->reload &= ~(PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL);
+ }
+ }
- if (job->key.cbuf && (job->key.cbuf->texture == prsc))
+ if (job->key.cbuf && (job->key.cbuf->texture == prsc)) {
job->resolve &= ~PIPE_CLEAR_COLOR0;
+ if (!has_draw_pending) {
+ struct lima_surface *surf = lima_surface(job->key.cbuf);
+ surf->reload &= ~PIPE_CLEAR_COLOR0;
+ }
+ }
_mesa_hash_table_remove_key(ctx->write_jobs, prsc);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment