anv/cmd_buffer: Don't call set_subpass in a secondary
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 5 Oct 2016 23:51:02 +0000 (16:51 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 6 Oct 2016 23:52:31 +0000 (16:52 -0700)
Initially, we had intended set_subpass to be an interesting function that
did whatever (presumably a lot) setup we needed for a subpass.  In reality,
it just sets a pointer and a dirty bit and then emits depth and stencil
state.  When we call BeginCommandBuffer on a secondary, there's no point in
setting depth and stencil state since it will already be set by the
primary.  Instead, the only thing we need to do at the start of a secondary
is set the subpass pointer and the dirty bit.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
src/intel/vulkan/anv_cmd_buffer.c
src/intel/vulkan/anv_genX.h
src/intel/vulkan/anv_private.h
src/intel/vulkan/genX_cmd_buffer.c

index 9dedde8f4e6e8fb7644534f54a96b686632b83ed..5bcd5e0fb8aaf6077ee1c812514f0dd568c27c48 100644 (file)
@@ -406,11 +406,10 @@ VkResult anv_BeginCommandBuffer(
          anv_framebuffer_from_handle(pBeginInfo->pInheritanceInfo->framebuffer);
       cmd_buffer->state.pass =
          anv_render_pass_from_handle(pBeginInfo->pInheritanceInfo->renderPass);
-
-      struct anv_subpass *subpass =
+      cmd_buffer->state.subpass =
          &cmd_buffer->state.pass->subpasses[pBeginInfo->pInheritanceInfo->subpass];
 
-      anv_cmd_buffer_set_subpass(cmd_buffer, subpass);
+      cmd_buffer->state.dirty |= ANV_CMD_DIRTY_RENDER_TARGETS;
    }
 
    return VK_SUCCESS;
@@ -1050,41 +1049,6 @@ anv_cmd_buffer_merge_dynamic(struct anv_cmd_buffer *cmd_buffer,
    return state;
 }
 
-/**
- * @brief Setup the command buffer for recording commands inside the given
- * subpass.
- *
- * This does not record all commands needed for starting the subpass.
- * Starting the subpass may require additional commands.
- *
- * Note that vkCmdBeginRenderPass, vkCmdNextSubpass, and vkBeginCommandBuffer
- * with VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT, all setup the
- * command buffer for recording commands for some subpass.  But only the first
- * two, vkCmdBeginRenderPass and vkCmdNextSubpass, can start a subpass.
- */
-void
-anv_cmd_buffer_set_subpass(struct anv_cmd_buffer *cmd_buffer,
-                           struct anv_subpass *subpass)
-{
-   switch (cmd_buffer->device->info.gen) {
-   case 7:
-      if (cmd_buffer->device->info.is_haswell) {
-         gen75_cmd_buffer_set_subpass(cmd_buffer, subpass);
-      } else {
-         gen7_cmd_buffer_set_subpass(cmd_buffer, subpass);
-      }
-      break;
-   case 8:
-      gen8_cmd_buffer_set_subpass(cmd_buffer, subpass);
-      break;
-   case 9:
-      gen9_cmd_buffer_set_subpass(cmd_buffer, subpass);
-      break;
-   default:
-      unreachable("unsupported gen\n");
-   }
-}
-
 struct anv_state
 anv_cmd_buffer_push_constants(struct anv_cmd_buffer *cmd_buffer,
                               gl_shader_stage stage)
index 02e79c2c07847d7d622625274df1ddee36776703..dc2dd5df6c84fb191a77e8217d1ff791a47ac492 100644 (file)
@@ -36,9 +36,6 @@ struct anv_state
 genX(cmd_buffer_alloc_null_surface_state)(struct anv_cmd_buffer *cmd_buffer,
                                           struct anv_framebuffer *fb);
 
-void genX(cmd_buffer_set_subpass)(struct anv_cmd_buffer *cmd_buffer,
-                                  struct anv_subpass *subpass);
-
 void genX(cmd_buffer_apply_pipe_flushes)(struct anv_cmd_buffer *cmd_buffer);
 
 void genX(flush_pipeline_select_3d)(struct anv_cmd_buffer *cmd_buffer);
index 443c31fdbbecb9a5595c0c833a83fb84159a9acf..4fa403ff18ded5fb7800c15ac651feda2fb641e1 100644 (file)
@@ -1394,9 +1394,6 @@ void anv_cmd_buffer_emit_state_base_address(struct anv_cmd_buffer *cmd_buffer);
 void anv_cmd_state_setup_attachments(struct anv_cmd_buffer *cmd_buffer,
                                      const VkRenderPassBeginInfo *info);
 
-void anv_cmd_buffer_set_subpass(struct anv_cmd_buffer *cmd_buffer,
-                                  struct anv_subpass *subpass);
-
 struct anv_state
 anv_cmd_buffer_push_constants(struct anv_cmd_buffer *cmd_buffer,
                               gl_shader_stage stage);
index 5fbf3a2d9203fef2daf365647acab23bfd0a3a69..02f81b192d4cdd5365d3e47ce693ae981f2cce0b 100644 (file)
@@ -1296,10 +1296,7 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer)
    anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_CLEAR_PARAMS), cp);
 }
 
-/**
- * @see anv_cmd_buffer_set_subpass()
- */
-void
+static void
 genX(cmd_buffer_set_subpass)(struct anv_cmd_buffer *cmd_buffer,
                              struct anv_subpass *subpass)
 {