[Mesa-dev] [PATCH 1/2] anv/blorp: only clear enabled views when multiview is used

Iago Toral Quiroga itoral at igalia.com
Fri Jan 5 09:28:27 UTC 2018


---
 src/intel/vulkan/anv_blorp.c | 55 ++++++++++++++++++++++++++++++++------------
 1 file changed, 40 insertions(+), 15 deletions(-)

diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
index e244468e03..18fa4a4ae5 100644
--- a/src/intel/vulkan/anv_blorp.c
+++ b/src/intel/vulkan/anv_blorp.c
@@ -1203,25 +1203,50 @@ anv_cmd_buffer_clear_subpass(struct anv_cmd_buffer *cmd_buffer)
             ANV_PIPE_RENDER_TARGET_CACHE_FLUSH_BIT | ANV_PIPE_CS_STALL_BIT;
 
          assert(image->n_planes == 1);
-         blorp_fast_clear(&batch, &surf, iview->planes[0].isl.format,
-                          iview->planes[0].isl.base_level,
-                          iview->planes[0].isl.base_array_layer, fb->layers,
-                          render_area.offset.x, render_area.offset.y,
-                          render_area.offset.x + render_area.extent.width,
-                          render_area.offset.y + render_area.extent.height);
-
+         if (cmd_state->subpass->view_mask) {
+            uint32_t view_idx;
+            for_each_bit(view_idx, cmd_state->subpass->view_mask) {
+               blorp_fast_clear(&batch, &surf, iview->planes[0].isl.format,
+                                iview->planes[0].isl.base_level,
+                                view_idx, 1,
+                                render_area.offset.x, render_area.offset.y,
+                                render_area.offset.x + render_area.extent.width,
+                                render_area.offset.y + render_area.extent.height);
+            }
+         } else {
+            blorp_fast_clear(&batch, &surf, iview->planes[0].isl.format,
+                             iview->planes[0].isl.base_level,
+                             iview->planes[0].isl.base_array_layer, fb->layers,
+                             render_area.offset.x, render_area.offset.y,
+                             render_area.offset.x + render_area.extent.width,
+                             render_area.offset.y + render_area.extent.height);
+         }
          cmd_buffer->state.pending_pipe_bits |=
             ANV_PIPE_RENDER_TARGET_CACHE_FLUSH_BIT | ANV_PIPE_CS_STALL_BIT;
       } else {
          assert(image->n_planes == 1);
-         blorp_clear(&batch, &surf, iview->planes[0].isl.format,
-                     anv_swizzle_for_render(iview->planes[0].isl.swizzle),
-                     iview->planes[0].isl.base_level,
-                     iview->planes[0].isl.base_array_layer, fb->layers,
-                     render_area.offset.x, render_area.offset.y,
-                     render_area.offset.x + render_area.extent.width,
-                     render_area.offset.y + render_area.extent.height,
-                     vk_to_isl_color(att_state->clear_value.color), NULL);
+         if (cmd_state->subpass->view_mask) {
+            uint32_t view_idx;
+            for_each_bit(view_idx, cmd_state->subpass->view_mask) {
+               blorp_clear(&batch, &surf, iview->planes[0].isl.format,
+                           anv_swizzle_for_render(iview->planes[0].isl.swizzle),
+                           iview->planes[0].isl.base_level,
+                           view_idx, 1,
+                           render_area.offset.x, render_area.offset.y,
+                           render_area.offset.x + render_area.extent.width,
+                           render_area.offset.y + render_area.extent.height,
+                           vk_to_isl_color(att_state->clear_value.color), NULL);
+            }
+         } else {
+            blorp_clear(&batch, &surf, iview->planes[0].isl.format,
+                        anv_swizzle_for_render(iview->planes[0].isl.swizzle),
+                        iview->planes[0].isl.base_level,
+                        iview->planes[0].isl.base_array_layer, fb->layers,
+                        render_area.offset.x, render_area.offset.y,
+                        render_area.offset.x + render_area.extent.width,
+                        render_area.offset.y + render_area.extent.height,
+                        vk_to_isl_color(att_state->clear_value.color), NULL);
+         }
       }
 
       att_state->pending_clear_aspects = 0;
-- 
2.11.0



More information about the mesa-dev mailing list