turnip: allow writes to draw_cs outside of render pass
authorJonathan Marek <jonathan@marek.ca>
Wed, 4 Dec 2019 19:29:58 +0000 (14:29 -0500)
committerJonathan Marek <jonathan@marek.ca>
Wed, 4 Dec 2019 22:35:18 +0000 (17:35 -0500)
This is for state commands like CmdSetViewport that can be used outside of
a renderpass. Accumulating those into draw_cs outside of the renderpass
should have the desired effect.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/freedreno/vulkan/tu_cmd_buffer.c

index 91baac6f7ec69b2d439f73ff9f244a2a253bc523..5e93395dff59967ebc0f19009bab152b50c86ea4 100644 (file)
@@ -1640,6 +1640,7 @@ tu_BeginCommandBuffer(VkCommandBuffer commandBuffer,
    cmd_buffer->usage_flags = pBeginInfo->flags;
 
    tu_cs_begin(&cmd_buffer->cs);
+   tu_cs_begin(&cmd_buffer->draw_cs);
 
    cmd_buffer->marker_seqno = 0;
    cmd_buffer->scratch_seqno = 0;
@@ -1788,6 +1789,7 @@ tu_EndCommandBuffer(VkCommandBuffer commandBuffer)
    }
 
    tu_cs_end(&cmd_buffer->cs);
+   tu_cs_end(&cmd_buffer->draw_cs);
 
    assert(!cmd_buffer->state.attachments);
 
@@ -2084,10 +2086,6 @@ tu_CmdBeginRenderPass(VkCommandBuffer commandBuffer,
    tu_cmd_update_tiling_config(cmd_buffer, &pRenderPassBegin->renderArea);
    tu_cmd_prepare_tile_load_ib(cmd_buffer);
    tu_cmd_prepare_tile_store_ib(cmd_buffer);
-
-   /* draw_cs should contain entries only for this render pass */
-   assert(!cmd_buffer->draw_cs.entry_count);
-   tu_cs_begin(&cmd_buffer->draw_cs);
 }
 
 void
@@ -2988,6 +2986,7 @@ tu_CmdEndRenderPass(VkCommandBuffer commandBuffer)
 
    /* discard draw_cs entries now that the tiles are rendered */
    tu_cs_discard_entries(&cmd_buffer->draw_cs);
+   tu_cs_begin(&cmd_buffer->draw_cs);
 
    vk_free(&cmd_buffer->pool->alloc, cmd_buffer->state.attachments);
    cmd_buffer->state.attachments = NULL;