anv/meta: Don't set the dynamic state for disabled operations
authorNanley Chery <nanley.g.chery@intel.com>
Tue, 29 Mar 2016 20:31:30 +0000 (13:31 -0700)
committerNanley Chery <nanley.g.chery@intel.com>
Thu, 14 Apr 2016 00:52:20 +0000 (17:52 -0700)
CmdSet* functions dirty the CommandBuffer's dynamic state. This causes
the new state to be emitted when CmdDraw is called. Since we don't need
the state that would be emitted, don't call the CmdSet* functions.

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
src/intel/vulkan/anv_meta_blit.c
src/intel/vulkan/anv_meta_blit2d.c
src/intel/vulkan/anv_meta_clear.c
src/intel/vulkan/anv_meta_resolve.c

index 24e47142a5c4afb7d75232cc002f24beabbe19be..72eb0d1b15a8c47dc369a3dac27db6216a6e4601 100644 (file)
@@ -115,8 +115,7 @@ static void
 meta_prepare_blit(struct anv_cmd_buffer *cmd_buffer,
                   struct anv_meta_saved_state *saved_state)
 {
-   anv_meta_save(saved_state, cmd_buffer,
-                 (1 << VK_DYNAMIC_STATE_VIEWPORT));
+   anv_meta_save(saved_state, cmd_buffer, 0);
 }
 
 static void
@@ -306,16 +305,6 @@ meta_emit_blit(struct anv_cmd_buffer *cmd_buffer,
                           VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
    }
 
-   anv_CmdSetViewport(anv_cmd_buffer_to_handle(cmd_buffer), 0, 1,
-                      &(VkViewport) {
-                        .x = 0.0f,
-                        .y = 0.0f,
-                        .width = dest_iview->extent.width,
-                        .height = dest_iview->extent.height,
-                        .minDepth = 0.0f,
-                        .maxDepth = 1.0f,
-                      });
-
    anv_CmdBindDescriptorSets(anv_cmd_buffer_to_handle(cmd_buffer),
                              VK_PIPELINE_BIND_POINT_GRAPHICS,
                              device->meta_state.blit.pipeline_layout, 0, 1,
index a7405e00810ad02028118b86150757503559062d..1bde38785db93b1f0348a5b2b3067d790aac361b 100644 (file)
@@ -344,17 +344,6 @@ blit2d_bind_dst(struct anv_cmd_buffer *cmd_buffer,
          .height = height,
          .layers = 1
       }, &cmd_buffer->pool->alloc, &tmp->fb);
-
-
-   anv_CmdSetViewport(anv_cmd_buffer_to_handle(cmd_buffer), 0, 1,
-                      &(VkViewport) {
-                         .x = 0.0f,
-                         .y = 0.0f,
-                         .width = width,
-                         .height = height,
-                         .minDepth = 0.0f,
-                         .maxDepth = 1.0f,
-                      });
 }
 
 static void
@@ -377,8 +366,7 @@ void
 anv_meta_begin_blit2d(struct anv_cmd_buffer *cmd_buffer,
                       struct anv_meta_saved_state *save)
 {
-   anv_meta_save(save, cmd_buffer,
-                 (1 << VK_DYNAMIC_STATE_VIEWPORT));
+   anv_meta_save(save, cmd_buffer, 0);
 }
 
 static void
index 50085894b9c688831a9a82d2063b46486a9df333..7512afeb584fcee7ef6aef7b280ce51d6fc021da 100644 (file)
@@ -44,7 +44,6 @@ meta_clear_begin(struct anv_meta_saved_state *saved_state,
 {
    anv_meta_save(saved_state, cmd_buffer,
                  (1 << VK_DYNAMIC_STATE_VIEWPORT) |
-                 (1 << VK_DYNAMIC_STATE_SCISSOR) |
                  (1 << VK_DYNAMIC_STATE_STENCIL_REFERENCE) |
                  (1 << VK_DYNAMIC_STATE_STENCIL_WRITE_MASK));
 
@@ -397,26 +396,6 @@ emit_color_clear(struct anv_cmd_buffer *cmd_buffer,
       .offset = state.offset,
    };
 
-   ANV_CALL(CmdSetViewport)(cmd_buffer_h, 0, 1,
-      (VkViewport[]) {
-         {
-            .x = 0,
-            .y = 0,
-            .width = fb->width,
-            .height = fb->height,
-            .minDepth = 0.0,
-            .maxDepth = 1.0,
-         },
-      });
-
-   ANV_CALL(CmdSetScissor)(cmd_buffer_h, 0, 1,
-      (VkRect2D[]) {
-         {
-            .offset = { 0, 0 },
-            .extent = { fb->width, fb->height },
-         }
-      });
-
    ANV_CALL(CmdBindVertexBuffers)(cmd_buffer_h, 0, 1,
       (VkBuffer[]) { anv_buffer_to_handle(&vertex_buffer) },
       (VkDeviceSize[]) { 0 });
@@ -596,14 +575,6 @@ emit_depthstencil_clear(struct anv_cmd_buffer *cmd_buffer,
          },
       });
 
-   ANV_CALL(CmdSetScissor)(cmd_buffer_h, 0, 1,
-      (VkRect2D[]) {
-         {
-            .offset = { 0, 0 },
-            .extent = { fb->width, fb->height },
-         }
-      });
-
    if (aspects & VK_IMAGE_ASPECT_STENCIL_BIT) {
       ANV_CALL(CmdSetStencilReference)(cmd_buffer_h, VK_STENCIL_FACE_FRONT_BIT,
                                        clear_value.stencil);
index 8c1bdc06f8484c674bc68515137f8c1b3aa0e452..87ebcaad2154f5102fef33be7d20a5a5304b6677 100644 (file)
@@ -41,9 +41,7 @@ static void
 meta_resolve_save(struct anv_meta_saved_state *saved_state,
                   struct anv_cmd_buffer *cmd_buffer)
 {
-   anv_meta_save(saved_state, cmd_buffer,
-                 (1 << VK_DYNAMIC_STATE_VIEWPORT) |
-                 (1 << VK_DYNAMIC_STATE_SCISSOR));
+   anv_meta_save(saved_state, cmd_buffer, 0);
 
    cmd_buffer->state.dynamic.viewport.count = 0;
    cmd_buffer->state.dynamic.scissor.count = 0;
@@ -481,7 +479,6 @@ emit_resolve(struct anv_cmd_buffer *cmd_buffer,
    struct anv_device *device = cmd_buffer->device;
    VkDevice device_h = anv_device_to_handle(device);
    VkCommandBuffer cmd_buffer_h = anv_cmd_buffer_to_handle(cmd_buffer);
-   const struct anv_framebuffer *fb = cmd_buffer->state.framebuffer;
    const struct anv_image *src_image = src_iview->image;
 
    const struct vertex_attrs vertex_data[3] = {
@@ -609,30 +606,6 @@ emit_resolve(struct anv_cmd_buffer *cmd_buffer,
       /*copyCount*/ 0,
       /*copies */ NULL);
 
-   ANV_CALL(CmdSetViewport)(cmd_buffer_h,
-      /*firstViewport*/ 0,
-      /*viewportCount*/ 1,
-      (VkViewport[]) {
-         {
-            .x = 0,
-            .y = 0,
-            .width = fb->width,
-            .height = fb->height,
-            .minDepth = 0.0,
-            .maxDepth = 1.0,
-         },
-      });
-
-   ANV_CALL(CmdSetScissor)(cmd_buffer_h,
-      /*firstScissor*/ 0,
-      /*scissorCount*/ 1,
-      (VkRect2D[]) {
-         {
-            .offset = { 0, 0 },
-            .extent = (VkExtent2D) { fb->width, fb->height },
-         },
-      });
-
    VkPipeline pipeline_h = *get_pipeline_h(device, src_image->samples);
    ANV_FROM_HANDLE(anv_pipeline, pipeline, pipeline_h);