diff options
author | Christian Gmeiner <[email protected]> | 2019-09-13 08:33:38 +0200 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-03-25 20:49:32 +0000 |
commit | 8cdace95acdf83bdab3d1f1a55e77aec1dfdb39e (patch) | |
tree | 8f016edf67a4505f8967726b1bb669e5d83b5b0a | |
parent | 061b262a0c2482e10286c4ecc96a81b47546100a (diff) |
freedreno: ssbo: mark resource read or written depending on usage
Signed-off-by: Christian Gmeiner <[email protected]>
Reviewed-by: Rob Clark <[email protected]>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1963>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1963>
-rw-r--r-- | src/gallium/drivers/freedreno/freedreno_draw.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c index 94e2aae9e68..cbbd82b7a23 100644 --- a/src/gallium/drivers/freedreno/freedreno_draw.c +++ b/src/gallium/drivers/freedreno/freedreno_draw.c @@ -185,12 +185,15 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info) resource_written(batch, pfb->cbufs[i]->texture); } - /* Mark SSBOs as being written.. we don't actually know which ones are - * read vs written, so just assume the worst - */ + /* Mark SSBOs */ if (ctx->dirty_shader[PIPE_SHADER_FRAGMENT] & FD_DIRTY_SHADER_SSBO) { - foreach_bit(i, ctx->shaderbuf[PIPE_SHADER_FRAGMENT].enabled_mask) - resource_written(batch, ctx->shaderbuf[PIPE_SHADER_FRAGMENT].sb[i].buffer); + const struct fd_shaderbuf_stateobj *so = &ctx->shaderbuf[PIPE_SHADER_FRAGMENT]; + + foreach_bit (i, so->enabled_mask & so->writable_mask) + resource_written(batch, so->sb[i].buffer); + + foreach_bit (i, so->enabled_mask & ~so->writable_mask) + resource_read(batch, so->sb[i].buffer); } if (ctx->dirty_shader[PIPE_SHADER_FRAGMENT] & FD_DIRTY_SHADER_IMAGE) { @@ -417,6 +420,7 @@ static void fd_launch_grid(struct pipe_context *pctx, const struct pipe_grid_info *info) { struct fd_context *ctx = fd_context(pctx); + const struct fd_shaderbuf_stateobj *so = &ctx->shaderbuf[PIPE_SHADER_COMPUTE]; struct fd_batch *batch, *save_batch = NULL; unsigned i; @@ -427,11 +431,12 @@ fd_launch_grid(struct pipe_context *pctx, const struct pipe_grid_info *info) mtx_lock(&ctx->screen->lock); - /* Mark SSBOs as being written.. we don't actually know which ones are - * read vs written, so just assume the worst - */ - foreach_bit(i, ctx->shaderbuf[PIPE_SHADER_COMPUTE].enabled_mask) - resource_written(batch, ctx->shaderbuf[PIPE_SHADER_COMPUTE].sb[i].buffer); + /* Mark SSBOs */ + foreach_bit (i, so->enabled_mask & so->writable_mask) + resource_written(batch, so->sb[i].buffer); + + foreach_bit (i, so->enabled_mask & ~so->writable_mask) + resource_read(batch, so->sb[i].buffer); foreach_bit(i, ctx->shaderimg[PIPE_SHADER_COMPUTE].enabled_mask) { struct pipe_image_view *img = |