From e371850d94cf8cf9df678233d64411c783d95668 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 21 Oct 2016 17:01:17 -0700 Subject: [PATCH] anv/blorp: Break the guts of alloc_binding_table into a shared helper Signed-off-by: Jason Ekstrand Reviewed-by: Topi Pohjolainen --- src/intel/vulkan/anv_blorp.c | 26 ++++++++++++++++++++++++++ src/intel/vulkan/anv_private.h | 5 +++++ src/intel/vulkan/genX_blorp_exec.c | 18 ++---------------- 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c index d59c1a73aed..3c415902aa4 100644 --- a/src/intel/vulkan/anv_blorp.c +++ b/src/intel/vulkan/anv_blorp.c @@ -883,6 +883,32 @@ void anv_CmdClearDepthStencilImage( blorp_batch_finish(&batch); } +struct anv_state +anv_cmd_buffer_alloc_blorp_binding_table(struct anv_cmd_buffer *cmd_buffer, + uint32_t num_entries, + uint32_t *state_offset) +{ + struct anv_state bt_state = + anv_cmd_buffer_alloc_binding_table(cmd_buffer, num_entries, + state_offset); + if (bt_state.map == NULL) { + /* We ran out of space. Grab a new binding table block. */ + VkResult result = anv_cmd_buffer_new_binding_table_block(cmd_buffer); + assert(result == VK_SUCCESS); + + /* Re-emit state base addresses so we get the new surface state base + * address before we start emitting binding tables etc. + */ + anv_cmd_buffer_emit_state_base_address(cmd_buffer); + + bt_state = anv_cmd_buffer_alloc_binding_table(cmd_buffer, num_entries, + state_offset); + assert(bt_state.map != NULL); + } + + return bt_state; +} + static void clear_color_attachment(struct anv_cmd_buffer *cmd_buffer, struct blorp_batch *batch, diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 84fbbcf068a..ae438b6d6af 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1283,6 +1283,11 @@ void anv_cmd_buffer_resolve_subpass(struct anv_cmd_buffer *cmd_buffer); const struct anv_image_view * anv_cmd_buffer_get_depth_stencil_view(const struct anv_cmd_buffer *cmd_buffer); +struct anv_state +anv_cmd_buffer_alloc_blorp_binding_table(struct anv_cmd_buffer *cmd_buffer, + uint32_t num_entries, + uint32_t *state_offset); + void anv_cmd_buffer_dump(struct anv_cmd_buffer *cmd_buffer); enum anv_fence_state { diff --git a/src/intel/vulkan/genX_blorp_exec.c b/src/intel/vulkan/genX_blorp_exec.c index 185aff6b589..a705de0d345 100644 --- a/src/intel/vulkan/genX_blorp_exec.c +++ b/src/intel/vulkan/genX_blorp_exec.c @@ -87,22 +87,8 @@ blorp_alloc_binding_table(struct blorp_batch *batch, unsigned num_entries, uint32_t state_offset; struct anv_state bt_state = - anv_cmd_buffer_alloc_binding_table(cmd_buffer, num_entries, - &state_offset); - if (bt_state.map == NULL) { - /* We ran out of space. Grab a new binding table block. */ - VkResult result = anv_cmd_buffer_new_binding_table_block(cmd_buffer); - assert(result == VK_SUCCESS); - - /* Re-emit state base addresses so we get the new surface state base - * address before we start emitting binding tables etc. - */ - genX(cmd_buffer_emit_state_base_address)(cmd_buffer); - - bt_state = anv_cmd_buffer_alloc_binding_table(cmd_buffer, num_entries, - &state_offset); - assert(bt_state.map != NULL); - } + anv_cmd_buffer_alloc_blorp_binding_table(cmd_buffer, num_entries, + &state_offset); uint32_t *bt_map = bt_state.map; *bt_offset = bt_state.offset; -- 2.30.2