radeonsi: skip DCC render feedback checking if color writes are disabled
authorMarek Olšák <marek.olsak@amd.com>
Sat, 31 Mar 2018 02:15:52 +0000 (22:15 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 5 Apr 2018 19:34:58 +0000 (15:34 -0400)
src/gallium/drivers/radeonsi/si_blit.c
src/gallium/drivers/radeonsi/si_pipe.h
src/gallium/drivers/radeonsi/si_state_shaders.c

index d9d489825f8eef63f0139d6ea9c9fe9993cbc5ed..22916b6c73b961aa84e612d8adcb0775b464b5a9 100644 (file)
@@ -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;
index e3d45ef6c3b2b45a4958fbd528b209a16ca24cc8..e65c946d1867166a8c436f09dd4e45013277d672 100644 (file)
@@ -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
index d7742eafb04eb9c697e8ec56b440c9ba7e2c2e34..f2d29e40744f69f3d63874bf633eabdd0c160564 100644 (file)
@@ -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 &&