[Mesa-dev] [PATCH 21/25] anv/blorp: Break the guts of alloc_binding_table into a shared helper

Jason Ekstrand jason at jlekstrand.net
Sat Oct 22 17:50:52 UTC 2016


---
 src/intel/vulkan/anv_blorp.c       | 24 ++++++++++++++++++++++++
 src/intel/vulkan/anv_private.h     |  5 +++++
 src/intel/vulkan/genX_blorp_exec.c | 18 ++----------------
 3 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
index 5361c4b..f495815 100644
--- a/src/intel/vulkan/anv_blorp.c
+++ b/src/intel/vulkan/anv_blorp.c
@@ -868,6 +868,30 @@ 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);
+   }
+}
+
 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 5664a6e..44fe606 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -1271,6 +1271,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);
 
 struct anv_fence {
diff --git a/src/intel/vulkan/genX_blorp_exec.c b/src/intel/vulkan/genX_blorp_exec.c
index 185aff6..a705de0 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.5.0.400.gff86faf



More information about the mesa-dev mailing list