iris: Insert buffer-local memory barriers for SSBO reads and writes.

Similar to what was previously done for vertex buffers, render
buffers, etc -- Insert memory barriers at resolves-and-flushes time
instead of relying on the history flush mechanism.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12691>
This commit is contained in:
Francisco Jerez 2020-05-29 16:12:34 -07:00 committed by Marge Bot
parent 8e49d4809e
commit 077af5c928
2 changed files with 17 additions and 0 deletions

View file

@ -152,6 +152,20 @@ resolve_image_views(struct iris_context *ice,
}
static void
flush_ssbos(struct iris_batch *batch,
struct iris_shader_state *shs)
{
uint32_t ssbos = shs->bound_ssbos;
while (ssbos) {
const int i = u_bit_scan(&ssbos);
struct pipe_shader_buffer *ssbo = &shs->ssbo[i];
struct iris_resource *res = (void *)ssbo->buffer;
iris_emit_buffer_barrier_for(batch, res->bo, IRIS_DOMAIN_DATA_WRITE);
}
}
/**
* \brief Resolve buffers before drawing.
*
@ -176,6 +190,7 @@ iris_predraw_resolve_inputs(struct iris_context *ice,
consider_framebuffer);
resolve_image_views(ice, batch, shs, info, draw_aux_buffer_disabled,
consider_framebuffer);
flush_ssbos(batch, shs);
}
}

View file

@ -3400,6 +3400,8 @@ iris_set_shader_buffers(struct pipe_context *ctx,
}
}
ice->state.dirty |= (IRIS_DIRTY_RENDER_RESOLVES_AND_FLUSHES |
IRIS_DIRTY_COMPUTE_RESOLVES_AND_FLUSHES);
ice->state.stage_dirty |= IRIS_STAGE_DIRTY_BINDINGS_VS << stage;
}