diff options
author | Samuel Pitoiset <[email protected]> | 2017-04-06 00:07:35 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-04-10 23:05:41 +0200 |
commit | def02007cde536045db0b99c60ba020d6a0c9d88 (patch) | |
tree | d37a72afbac1a96c770ef2405ce41b9aa9f5c66e /src/gallium/drivers/radeonsi/si_blit.c | |
parent | fbcc8664fd423f54ac546566002e745331aa91a6 (diff) |
radeonsi: add new si_check_render_feedback_texture() helper
For bindless.
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_blit.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_blit.c | 89 |
1 files changed, 44 insertions, 45 deletions
diff --git a/src/gallium/drivers/radeonsi/si_blit.c b/src/gallium/drivers/radeonsi/si_blit.c index f690f3e2f30..998288dba2f 100644 --- a/src/gallium/drivers/radeonsi/si_blit.c +++ b/src/gallium/drivers/radeonsi/si_blit.c @@ -527,6 +527,40 @@ si_decompress_image_color_textures(struct si_context *sctx, } } +static void si_check_render_feedback_texture(struct si_context *sctx, + struct r600_texture *tex, + unsigned first_level, + unsigned last_level, + unsigned first_layer, + unsigned last_layer) +{ + bool render_feedback = false; + + if (!tex->dcc_offset) + return; + + for (unsigned j = 0; j < sctx->framebuffer.state.nr_cbufs; ++j) { + struct r600_surface * surf; + + if (!sctx->framebuffer.state.cbufs[j]) + continue; + + surf = (struct r600_surface*)sctx->framebuffer.state.cbufs[j]; + + if (tex == (struct r600_texture *)surf->base.texture && + surf->base.u.tex.level >= first_level && + surf->base.u.tex.level <= last_level && + surf->base.u.tex.first_layer <= last_layer && + surf->base.u.tex.last_layer >= first_layer) { + render_feedback = true; + break; + } + } + + if (render_feedback) + r600_texture_disable_dcc(&sctx->b, tex); +} + static void si_check_render_feedback_textures(struct si_context *sctx, struct si_textures_info *textures) { @@ -535,7 +569,6 @@ static void si_check_render_feedback_textures(struct si_context *sctx, while (mask) { const struct pipe_sampler_view *view; struct r600_texture *tex; - bool render_feedback = false; unsigned i = u_bit_scan(&mask); @@ -544,29 +577,12 @@ static void si_check_render_feedback_textures(struct si_context *sctx, continue; tex = (struct r600_texture *)view->texture; - if (!tex->dcc_offset) - continue; - for (unsigned j = 0; j < sctx->framebuffer.state.nr_cbufs; ++j) { - struct r600_surface * surf; - - if (!sctx->framebuffer.state.cbufs[j]) - continue; - - surf = (struct r600_surface*)sctx->framebuffer.state.cbufs[j]; - - if (tex == (struct r600_texture*)surf->base.texture && - surf->base.u.tex.level >= view->u.tex.first_level && - surf->base.u.tex.level <= view->u.tex.last_level && - surf->base.u.tex.first_layer <= view->u.tex.last_layer && - surf->base.u.tex.last_layer >= view->u.tex.first_layer) { - render_feedback = true; - break; - } - } - - if (render_feedback) - r600_texture_disable_dcc(&sctx->b, tex); + si_check_render_feedback_texture(sctx, tex, + view->u.tex.first_level, + view->u.tex.last_level, + view->u.tex.first_layer, + view->u.tex.last_layer); } } @@ -578,7 +594,6 @@ static void si_check_render_feedback_images(struct si_context *sctx, while (mask) { const struct pipe_image_view *view; struct r600_texture *tex; - bool render_feedback = false; unsigned i = u_bit_scan(&mask); @@ -587,28 +602,12 @@ static void si_check_render_feedback_images(struct si_context *sctx, continue; tex = (struct r600_texture *)view->resource; - if (!tex->dcc_offset) - continue; - - for (unsigned j = 0; j < sctx->framebuffer.state.nr_cbufs; ++j) { - struct r600_surface * surf; - - if (!sctx->framebuffer.state.cbufs[j]) - continue; - - surf = (struct r600_surface*)sctx->framebuffer.state.cbufs[j]; - - if (tex == (struct r600_texture*)surf->base.texture && - surf->base.u.tex.level == view->u.tex.level && - surf->base.u.tex.first_layer <= view->u.tex.last_layer && - surf->base.u.tex.last_layer >= view->u.tex.first_layer) { - render_feedback = true; - break; - } - } - if (render_feedback) - r600_texture_disable_dcc(&sctx->b, tex); + si_check_render_feedback_texture(sctx, tex, + view->u.tex.level, + view->u.tex.level, + view->u.tex.first_layer, + view->u.tex.last_layer); } } |