radeonsi: Reorder checks in si_check_render_feedback
authorJan Vesely <jan.vesely@rutgers.edu>
Thu, 5 Apr 2018 20:34:00 +0000 (16:34 -0400)
committerJan Vesely <jan.vesely@rutgers.edu>
Thu, 5 Apr 2018 21:11:18 +0000 (17:11 -0400)
si_get_total_colormask accesses NULL pointer on compute shaders
Fixes crashes on clover
Fixes: 0669dca9c00261849cee14d69fdea0a5e323c7f7 ("radeonsi: skip DCC render feedback checking if color writes are disabled")
CC: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeonsi/si_blit.c

index 40f512a682dcf764fced8d35234c1b4011220715..35506dd74b3dab83d0cb183f3046c5a2b9f64248 100644 (file)
@@ -710,15 +710,15 @@ static void si_check_render_feedback_resident_images(struct si_context *sctx)
 
 static void si_check_render_feedback(struct si_context *sctx)
 {
+       if (!sctx->need_check_render_feedback)
+               return;
+
        /* 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;
-
        for (int i = 0; i < SI_NUM_SHADERS; ++i) {
                si_check_render_feedback_images(sctx, &sctx->images[i]);
                si_check_render_feedback_textures(sctx, &sctx->samplers[i]);