mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-02 04:30:25 +01:00
etnaviv: draw: only mark resources as read/written when the state changed
If the relevant state for a resource has not been dirtied between the last and the current draw, we don't need to mark the resource as read or written, as they are guaranteed to be marked already by the last draw. This saves quite a bit of hashset operations for the resource tracking in draw heavy workloads. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14791>
This commit is contained in:
parent
37989670b9
commit
a40a6e551e
1 changed files with 36 additions and 25 deletions
|
|
@ -342,42 +342,53 @@ etna_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info,
|
|||
/*
|
||||
* Figure out the buffers/features we need:
|
||||
*/
|
||||
if (etna_depth_enabled(ctx))
|
||||
resource_written(ctx, pfb->zsbuf->texture);
|
||||
if (ctx->dirty & ETNA_DIRTY_ZSA) {
|
||||
if (etna_depth_enabled(ctx))
|
||||
resource_written(ctx, pfb->zsbuf->texture);
|
||||
|
||||
if (etna_stencil_enabled(ctx))
|
||||
resource_written(ctx, pfb->zsbuf->texture);
|
||||
|
||||
for (i = 0; i < pfb->nr_cbufs; i++) {
|
||||
struct pipe_resource *surf;
|
||||
|
||||
if (!pfb->cbufs[i])
|
||||
continue;
|
||||
|
||||
surf = pfb->cbufs[i]->texture;
|
||||
resource_written(ctx, surf);
|
||||
if (etna_stencil_enabled(ctx))
|
||||
resource_written(ctx, pfb->zsbuf->texture);
|
||||
}
|
||||
|
||||
/* Mark constant buffers as being read */
|
||||
u_foreach_bit(i, ctx->constant_buffer[PIPE_SHADER_VERTEX].enabled_mask)
|
||||
resource_read(ctx, ctx->constant_buffer[PIPE_SHADER_VERTEX].cb[i].buffer);
|
||||
if (ctx->dirty & ETNA_DIRTY_FRAMEBUFFER) {
|
||||
for (i = 0; i < pfb->nr_cbufs; i++) {
|
||||
struct pipe_resource *surf;
|
||||
|
||||
u_foreach_bit(i, ctx->constant_buffer[PIPE_SHADER_FRAGMENT].enabled_mask)
|
||||
resource_read(ctx, ctx->constant_buffer[PIPE_SHADER_FRAGMENT].cb[i].buffer);
|
||||
if (!pfb->cbufs[i])
|
||||
continue;
|
||||
|
||||
/* Mark VBOs as being read */
|
||||
u_foreach_bit(i, ctx->vertex_buffer.enabled_mask) {
|
||||
assert(!ctx->vertex_buffer.vb[i].is_user_buffer);
|
||||
resource_read(ctx, ctx->vertex_buffer.vb[i].buffer.resource);
|
||||
surf = pfb->cbufs[i]->texture;
|
||||
resource_written(ctx, surf);
|
||||
}
|
||||
}
|
||||
|
||||
/* Mark index buffer as being read */
|
||||
resource_read(ctx, indexbuf);
|
||||
if (ctx->dirty & ETNA_DIRTY_SHADER) {
|
||||
/* Mark constant buffers as being read */
|
||||
u_foreach_bit(i, ctx->constant_buffer[PIPE_SHADER_VERTEX].enabled_mask)
|
||||
resource_read(ctx, ctx->constant_buffer[PIPE_SHADER_VERTEX].cb[i].buffer);
|
||||
|
||||
u_foreach_bit(i, ctx->constant_buffer[PIPE_SHADER_FRAGMENT].enabled_mask)
|
||||
resource_read(ctx, ctx->constant_buffer[PIPE_SHADER_FRAGMENT].cb[i].buffer);
|
||||
}
|
||||
|
||||
if (ctx->dirty & ETNA_DIRTY_VERTEX_BUFFERS) {
|
||||
/* Mark VBOs as being read */
|
||||
u_foreach_bit(i, ctx->vertex_buffer.enabled_mask) {
|
||||
assert(!ctx->vertex_buffer.vb[i].is_user_buffer);
|
||||
resource_read(ctx, ctx->vertex_buffer.vb[i].buffer.resource);
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx->dirty & ETNA_DIRTY_INDEX_BUFFER) {
|
||||
/* Mark index buffer as being read */
|
||||
resource_read(ctx, indexbuf);
|
||||
}
|
||||
|
||||
/* Mark textures as being read */
|
||||
for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
|
||||
if (ctx->sampler_view[i]) {
|
||||
resource_read(ctx, ctx->sampler_view[i]->texture);
|
||||
if (ctx->dirty & ETNA_DIRTY_SAMPLER_VIEWS)
|
||||
resource_read(ctx, ctx->sampler_view[i]->texture);
|
||||
|
||||
/* if texture was modified since the last update,
|
||||
* we need to clear the texture cache and possibly
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue