radeonsi: only decompress resident textures/images when used
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 16 May 2017 20:31:30 +0000 (22:31 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 14 Jun 2017 08:04:36 +0000 (10:04 +0200)
When the current bound shaders don't use any bindless textures
or images, it's useless to decompress the resident resources.

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

index 8fdc3f268b1ec347bf7b42d0a8658da8931b4c7c..9c38ae9edc8a24e9e16fad7c57714256ca343bec 100644 (file)
@@ -792,8 +792,17 @@ static void si_decompress_textures(struct si_context *sctx, unsigned shader_mask
                }
        }
 
-       si_decompress_resident_textures(sctx);
-       si_decompress_resident_images(sctx);
+       if (shader_mask & u_bit_consecutive(0, SI_NUM_GRAPHICS_SHADERS)) {
+               if (sctx->uses_bindless_samplers)
+                       si_decompress_resident_textures(sctx);
+               if (sctx->uses_bindless_images)
+                       si_decompress_resident_images(sctx);
+       } else if (shader_mask & (1 << PIPE_SHADER_COMPUTE)) {
+               if (sctx->cs_shader_state.program->uses_bindless_samplers)
+                       si_decompress_resident_textures(sctx);
+               if (sctx->cs_shader_state.program->uses_bindless_images)
+                       si_decompress_resident_images(sctx);
+       }
 
        si_check_render_feedback(sctx);
 }