From 0669dca9c00261849cee14d69fdea0a5e323c7f7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 30 Mar 2018 22:15:52 -0400 Subject: [PATCH] radeonsi: skip DCC render feedback checking if color writes are disabled --- src/gallium/drivers/radeonsi/si_blit.c | 5 +++++ src/gallium/drivers/radeonsi/si_pipe.h | 17 +++++++++++++++++ src/gallium/drivers/radeonsi/si_state_shaders.c | 6 +----- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_blit.c b/src/gallium/drivers/radeonsi/si_blit.c index d9d489825f8..22916b6c73b 100644 --- a/src/gallium/drivers/radeonsi/si_blit.c +++ b/src/gallium/drivers/radeonsi/si_blit.c @@ -713,6 +713,11 @@ static void si_check_render_feedback_resident_images(struct si_context *sctx) static void si_check_render_feedback(struct si_context *sctx) { + /* There is no render feedback if color writes are disabled. + * (e.g. a pixel shader with image stores) + */ + if (!si_get_total_colormask(sctx)) + return; if (!sctx->need_check_render_feedback) return; diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index e3d45ef6c3b..e65c946d186 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -940,4 +940,21 @@ static inline unsigned si_get_ps_iter_samples(struct si_context *sctx) return sctx->ps_iter_samples; } +static inline unsigned si_get_total_colormask(struct si_context *sctx) +{ + if (sctx->queued.named.rasterizer->rasterizer_discard) + return 0; + + struct si_shader_selector *ps = sctx->ps_shader.cso; + unsigned colormask = sctx->framebuffer.colorbuf_enabled_4bit & + sctx->queued.named.blend->cb_target_mask; + + if (!ps->info.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS]) + colormask &= ps->colors_written_4bit; + else if (!ps->colors_written_4bit) + colormask = 0; /* color0 writes all cbufs, but it's not written */ + + return colormask; +} + #endif diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index d7742eafb04..f2d29e40744 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -1215,11 +1215,7 @@ static void si_shader_selector_key_hw_vs(struct si_context *sctx, ps->info.writes_samplemask || alpha_to_coverage || si_get_alpha_test_func(sctx) != PIPE_FUNC_ALWAYS; - - unsigned ps_colormask = sctx->framebuffer.colorbuf_enabled_4bit & - sctx->queued.named.blend->cb_target_mask; - if (!ps->info.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS]) - ps_colormask &= ps->colors_written_4bit; + unsigned ps_colormask = si_get_total_colormask(sctx); ps_disabled = sctx->queued.named.rasterizer->rasterizer_discard || (!ps_colormask && -- 2.30.2