From 9fae6ee02659463259e9d7d90a2edf5261887503 Mon Sep 17 00:00:00 2001 From: Nanley Chery Date: Tue, 29 Mar 2016 13:31:30 -0700 Subject: [PATCH] anv/meta: Don't set the dynamic state for disabled operations MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Kristian Høgsberg Kristensen --- src/intel/vulkan/anv_meta_blit.c | 13 +------------ src/intel/vulkan/anv_meta_blit2d.c | 14 +------------- src/intel/vulkan/anv_meta_clear.c | 29 ----------------------------- src/intel/vulkan/anv_meta_resolve.c | 29 +---------------------------- 4 files changed, 3 insertions(+), 82 deletions(-) diff --git a/src/intel/vulkan/anv_meta_blit.c b/src/intel/vulkan/anv_meta_blit.c index 24e47142a5c..72eb0d1b15a 100644 --- a/src/intel/vulkan/anv_meta_blit.c +++ b/src/intel/vulkan/anv_meta_blit.c @@ -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, diff --git a/src/intel/vulkan/anv_meta_blit2d.c b/src/intel/vulkan/anv_meta_blit2d.c index a7405e00810..1bde38785db 100644 --- a/src/intel/vulkan/anv_meta_blit2d.c +++ b/src/intel/vulkan/anv_meta_blit2d.c @@ -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 diff --git a/src/intel/vulkan/anv_meta_clear.c b/src/intel/vulkan/anv_meta_clear.c index 50085894b9c..7512afeb584 100644 --- a/src/intel/vulkan/anv_meta_clear.c +++ b/src/intel/vulkan/anv_meta_clear.c @@ -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); diff --git a/src/intel/vulkan/anv_meta_resolve.c b/src/intel/vulkan/anv_meta_resolve.c index 8c1bdc06f84..87ebcaad215 100644 --- a/src/intel/vulkan/anv_meta_resolve.c +++ b/src/intel/vulkan/anv_meta_resolve.c @@ -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); -- 2.30.2