<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 6, 2016 at 12:30 PM, Nanley Chery <span dir="ltr"><<a href="mailto:nanleychery@gmail.com" target="_blank">nanleychery@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Wed, Oct 05, 2016 at 05:36:43PM -0700, Jason Ekstrand wrote:<br>
> Initially, we had intended set_subpass to be an interesting function that<br>
> did whatever (presumably a lot) setup we needed for a subpass. In reality,<br>
> it just sets a pointer and a dirty bit and then emits depth and stencil<br>
> state. When we call BeginCommandBuffer on a secondary, all of the dirty<br>
> bits are already set and there's no point in setting depth and stencil<br>
> state since it will already be set by the primary. Instead, the only thing<br>
> we need to do at the start of a secondary is set the subpass pointer.<br>
><br>
> Signed-off-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
> ---<br>
> src/intel/vulkan/anv_cmd_<wbr>buffer.c | 39 +-----------------------------<wbr>--------<br>
> src/intel/vulkan/anv_genX.h | 3 ---<br>
> src/intel/vulkan/anv_private.h | 3 ---<br>
> src/intel/vulkan/genX_cmd_<wbr>buffer.c | 5 +----<br>
> 4 files changed, 2 insertions(+), 48 deletions(-)<br>
><br>
> diff --git a/src/intel/vulkan/anv_cmd_<wbr>buffer.c b/src/intel/vulkan/anv_cmd_<wbr>buffer.c<br>
> index 9dedde8..ef13dfc 100644<br>
> --- a/src/intel/vulkan/anv_cmd_<wbr>buffer.c<br>
> +++ b/src/intel/vulkan/anv_cmd_<wbr>buffer.c<br>
> @@ -407,10 +407,8 @@ VkResult anv_BeginCommandBuffer(<br>
> cmd_buffer->state.pass =<br>
> anv_render_pass_from_handle(<wbr>pBeginInfo->pInheritanceInfo-><wbr>renderPass);<br>
><br>
> - struct anv_subpass *subpass =<br>
> + cmd_buffer->state.subpass =<br>
> &cmd_buffer->state.pass-><wbr>subpasses[pBeginInfo-><wbr>pInheritanceInfo->subpass];<br>
> -<br>
> - anv_cmd_buffer_set_subpass(<wbr>cmd_buffer, subpass);<br>
<br>
</div></div>I'm not sure why we always set the fragment descriptor bit in<br>
set_subpass, but it seems like we need to do it here as well to keep<br>
the logic the same. I don't see where we set the dirty bits on a<br>
secondary command buffer at BeginCommandBuffer. Aside from that, this<br>
patch looks good.<br></blockquote><div><br></div><div>Initially, I think we did it to ensure that binding tables got re-emitted. However, we're now also re-emitting binding tables on pipeline changes and you have a pipeline change at the top of every subpass, so it shouldn't be needed either place.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
-Nanley<br>
<div><div class="h5"><br>
> }<br>
><br>
> return VK_SUCCESS;<br>
> @@ -1050,41 +1048,6 @@ anv_cmd_buffer_merge_dynamic(<wbr>struct anv_cmd_buffer *cmd_buffer,<br>
> return state;<br>
> }<br>
><br>
> -/**<br>
> - * @brief Setup the command buffer for recording commands inside the given<br>
> - * subpass.<br>
> - *<br>
> - * This does not record all commands needed for starting the subpass.<br>
> - * Starting the subpass may require additional commands.<br>
> - *<br>
> - * Note that vkCmdBeginRenderPass, vkCmdNextSubpass, and vkBeginCommandBuffer<br>
> - * with VK_COMMAND_BUFFER_USAGE_<wbr>RENDER_PASS_CONTINUE_BIT, all setup the<br>
> - * command buffer for recording commands for some subpass. But only the first<br>
> - * two, vkCmdBeginRenderPass and vkCmdNextSubpass, can start a subpass.<br>
> - */<br>
> -void<br>
> -anv_cmd_buffer_set_subpass(<wbr>struct anv_cmd_buffer *cmd_buffer,<br>
> - struct anv_subpass *subpass)<br>
> -{<br>
> - switch (cmd_buffer->device->info.gen) {<br>
> - case 7:<br>
> - if (cmd_buffer->device->info.is_<wbr>haswell) {<br>
> - gen75_cmd_buffer_set_subpass(<wbr>cmd_buffer, subpass);<br>
> - } else {<br>
> - gen7_cmd_buffer_set_subpass(<wbr>cmd_buffer, subpass);<br>
> - }<br>
> - break;<br>
> - case 8:<br>
> - gen8_cmd_buffer_set_subpass(<wbr>cmd_buffer, subpass);<br>
> - break;<br>
> - case 9:<br>
> - gen9_cmd_buffer_set_subpass(<wbr>cmd_buffer, subpass);<br>
> - break;<br>
> - default:<br>
> - unreachable("unsupported gen\n");<br>
> - }<br>
> -}<br>
> -<br>
> struct anv_state<br>
> anv_cmd_buffer_push_constants(<wbr>struct anv_cmd_buffer *cmd_buffer,<br>
> gl_shader_stage stage)<br>
> diff --git a/src/intel/vulkan/anv_genX.h b/src/intel/vulkan/anv_genX.h<br>
> index 02e79c2..dc2dd5d 100644<br>
> --- a/src/intel/vulkan/anv_genX.h<br>
> +++ b/src/intel/vulkan/anv_genX.h<br>
> @@ -36,9 +36,6 @@ struct anv_state<br>
> genX(cmd_buffer_alloc_null_<wbr>surface_state)(struct anv_cmd_buffer *cmd_buffer,<br>
> struct anv_framebuffer *fb);<br>
><br>
> -void genX(cmd_buffer_set_subpass)(<wbr>struct anv_cmd_buffer *cmd_buffer,<br>
> - struct anv_subpass *subpass);<br>
> -<br>
> void genX(cmd_buffer_apply_pipe_<wbr>flushes)(struct anv_cmd_buffer *cmd_buffer);<br>
><br>
> void genX(flush_pipeline_select_3d)<wbr>(struct anv_cmd_buffer *cmd_buffer);<br>
> diff --git a/src/intel/vulkan/anv_<wbr>private.h b/src/intel/vulkan/anv_<wbr>private.h<br>
> index 443c31f..4fa403f 100644<br>
> --- a/src/intel/vulkan/anv_<wbr>private.h<br>
> +++ b/src/intel/vulkan/anv_<wbr>private.h<br>
> @@ -1394,9 +1394,6 @@ void anv_cmd_buffer_emit_state_<wbr>base_address(struct anv_cmd_buffer *cmd_buffer);<br>
> void anv_cmd_state_setup_<wbr>attachments(struct anv_cmd_buffer *cmd_buffer,<br>
> const VkRenderPassBeginInfo *info);<br>
><br>
> -void anv_cmd_buffer_set_subpass(<wbr>struct anv_cmd_buffer *cmd_buffer,<br>
> - struct anv_subpass *subpass);<br>
> -<br>
> struct anv_state<br>
> anv_cmd_buffer_push_constants(<wbr>struct anv_cmd_buffer *cmd_buffer,<br>
> gl_shader_stage stage);<br>
> diff --git a/src/intel/vulkan/genX_cmd_<wbr>buffer.c b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> index 6a84383..1dff6a1 100644<br>
> --- a/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> +++ b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> @@ -1292,10 +1292,7 @@ cmd_buffer_emit_depth_stencil(<wbr>struct anv_cmd_buffer *cmd_buffer)<br>
> anv_batch_emit(&cmd_buffer-><wbr>batch, GENX(3DSTATE_CLEAR_PARAMS), cp);<br>
> }<br>
><br>
> -/**<br>
> - * @see anv_cmd_buffer_set_subpass()<br>
> - */<br>
> -void<br>
> +static void<br>
> genX(cmd_buffer_set_subpass)(<wbr>struct anv_cmd_buffer *cmd_buffer,<br>
> struct anv_subpass *subpass)<br>
> {<br>
> --<br>
> 2.5.0.400.gff86faf<br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</blockquote></div><br></div></div>