radeonsi: Lazily re-set sampler views after disabling DCC
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Thu, 10 Mar 2016 16:57:41 +0000 (17:57 +0100)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 11 Mar 2016 16:51:15 +0000 (11:51 -0500)
Clear DCC flags if necessary when binding a new sampler view.

v2: Do not reset DCC flags of bound sampler views.
v3: Check that we have a real texture (Nicolai)

Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeon/r600_texture.c
src/gallium/drivers/radeonsi/si_descriptors.c

index 6b2d9096525654a94da39fde873d695bcdadfb61..115c7289c4cf55c6b007e88f4c53be00f8919e9f 100644 (file)
@@ -311,8 +311,6 @@ static void r600_texture_disable_dcc(struct r600_common_screen *rscreen,
 
        /* Notify all contexts about the change. */
        r600_dirty_all_framebuffer_states(rscreen);
-
-       /* TODO: re-set all sampler views and images, but how? */
 }
 
 static boolean r600_texture_get_handle(struct pipe_screen* screen,
index 9aa487729754525b85259491ee43de9a5c28299a..11b902516e0eb883a12e6828406d422c7852376a 100644 (file)
@@ -185,12 +185,17 @@ static void si_set_sampler_view(struct si_context *sctx,
                                struct si_sampler_views *views,
                                unsigned slot, struct pipe_sampler_view *view)
 {
-       if (views->views[slot] == view)
+       struct si_sampler_view *rview = (struct si_sampler_view*)view;
+
+       if (view && view->texture && view->texture->target != PIPE_BUFFER &&
+           G_008F28_COMPRESSION_EN(rview->state[6]) &&
+           ((struct r600_texture*)view->texture)->dcc_offset == 0) {
+               rview->state[6] &= C_008F28_COMPRESSION_EN &
+                                  C_008F28_ALPHA_IS_ON_MSB;
+       } else if (views->views[slot] == view)
                return;
 
        if (view) {
-               struct si_sampler_view *rview =
-                       (struct si_sampler_view*)view;
                struct r600_texture *rtex = (struct r600_texture *)view->texture;
 
                si_sampler_view_add_buffer(sctx, view->texture);