anv/blorp: Break the guts of alloc_binding_table into a shared helper
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 22 Oct 2016 00:01:17 +0000 (17:01 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 16 Nov 2016 18:11:29 +0000 (10:11 -0800)
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/intel/vulkan/anv_blorp.c
src/intel/vulkan/anv_private.h
src/intel/vulkan/genX_blorp_exec.c

index d59c1a73aed88fba874ece6c0939e4792170f60d..3c415902aa4323c21cc3b7a3fcef7b6c27ffe9b3 100644 (file)
@@ -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,
index 84fbbcf068ab60792419b590164d82a1ad1f9380..ae438b6d6afd4b7e45c30436c749b87529161854 100644 (file)
@@ -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 {
index 185aff6b589421ae7ba5014d571f0a2de3b0f5ec..a705de0d345f53f5d42d876de7669881f5c1ba91 100644 (file)
@@ -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;