radeonsi: add new depth_needs_decompression() helper
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 5 Apr 2017 22:07:33 +0000 (00:07 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 10 Apr 2017 21:05:32 +0000 (23:05 +0200)
v2: - rename to depth_needs_decompression() instead

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeonsi/si_descriptors.c

index 703a7cb1fa8501bc0b0a945609579d8ee7b0be41..47e455f9bc7bce9d7aaad17fcd9fc0546e089083 100644 (file)
@@ -559,6 +559,13 @@ static bool is_compressed_colortex(struct r600_texture *rtex)
               (rtex->dcc_offset && rtex->dirty_level_mask);
 }
 
+static bool depth_needs_decompression(struct r600_texture *rtex,
+                                     struct si_sampler_view *sview)
+{
+       return rtex->db_compatible &&
+              (!rtex->tc_compatible_htile || sview->is_stencil_sampler);
+}
+
 static void si_update_compressed_tex_shader_mask(struct si_context *sctx,
                                                 unsigned shader)
 {
@@ -602,8 +609,7 @@ static void si_set_sampler_views(struct pipe_context *ctx,
                                (struct r600_texture*)views[i]->texture;
                        struct si_sampler_view *rview = (struct si_sampler_view *)views[i];
 
-                       if (rtex->db_compatible &&
-                           (!rtex->tc_compatible_htile || rview->is_stencil_sampler)) {
+                       if (depth_needs_decompression(rtex, rview)) {
                                samplers->depth_texture_mask |= 1u << slot;
                        } else {
                                samplers->depth_texture_mask &= ~(1u << slot);