Commit f3ae455e authored by Marek Olšák's avatar Marek Olšák

radeonsi: compute culling - flush CS to remove write references to buffers

Only read-only buffers can use compute culling.
Acked-by: default avatarNicolai Hähnle <nicolai.haehnle@amd.com>
parent 04122532
Pipeline #37298 passed with stages
in 9 minutes and 12 seconds
......@@ -1328,7 +1328,7 @@ si_all_vs_resources_read_only(struct si_context *sctx,
if (indexbuf &&
ws->cs_is_buffer_referenced(cs, si_resource(indexbuf)->buf,
RADEON_USAGE_WRITE))
return false;
goto has_write_reference;
/* Vertex buffers. */
struct si_vertex_elements *velems = sctx->vertex_elements;
......@@ -1345,7 +1345,7 @@ si_all_vs_resources_read_only(struct si_context *sctx,
if (ws->cs_is_buffer_referenced(cs, si_resource(res)->buf,
RADEON_USAGE_WRITE))
return false;
goto has_write_reference;
}
/* Constant and shader buffers. */
......@@ -1360,7 +1360,7 @@ si_all_vs_resources_read_only(struct si_context *sctx,
if (ws->cs_is_buffer_referenced(cs, si_resource(res)->buf,
RADEON_USAGE_WRITE))
return false;
goto has_write_reference;
}
/* Samplers. */
......@@ -1376,7 +1376,7 @@ si_all_vs_resources_read_only(struct si_context *sctx,
if (ws->cs_is_buffer_referenced(cs,
si_resource(view->texture)->buf,
RADEON_USAGE_WRITE))
return false;
goto has_write_reference;
}
}
......@@ -1391,11 +1391,22 @@ si_all_vs_resources_read_only(struct si_context *sctx,
if (ws->cs_is_buffer_referenced(cs, si_resource(res)->buf,
RADEON_USAGE_WRITE))
return false;
goto has_write_reference;
}
}
return true;
has_write_reference:
/* If the current gfx IB has enough packets, flush it to remove write
* references to buffers.
*/
if (cs->prev_dw + cs->current.cdw > 2048) {
si_flush_gfx_cs(sctx, RADEON_FLUSH_ASYNC_START_NEXT_GFX_IB_NOW, NULL);
assert(si_all_vs_resources_read_only(sctx, indexbuf));
return true;
}
return false;
}
static ALWAYS_INLINE bool pd_msg(const char *s)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment