anv/batch_chain: Add a _alloc_binding_table function
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 22 Sep 2015 00:05:51 +0000 (17:05 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Mon, 28 Sep 2015 23:01:01 +0000 (16:01 -0700)
src/vulkan/anv_batch_chain.c
src/vulkan/anv_cmd_buffer.c
src/vulkan/anv_private.h

index aaf65c33f844e9936e62ffa51959694623140ef4..51ba7ef4a31d25399a98d67b92053fa25fa06399 100644 (file)
@@ -488,6 +488,13 @@ anv_cmd_buffer_alloc_surface_state(struct anv_cmd_buffer *cmd_buffer,
    return state;
 }
 
+struct anv_state
+anv_cmd_buffer_alloc_binding_table(struct anv_cmd_buffer *cmd_buffer,
+                                   uint32_t entries)
+{
+   return anv_cmd_buffer_alloc_surface_state(cmd_buffer, entries * 4, 32);
+}
+
 struct anv_state
 anv_cmd_buffer_alloc_dynamic_state(struct anv_cmd_buffer *cmd_buffer,
                                    uint32_t size, uint32_t alignment)
index 38d032b36612388a777ded28061cf81bfcb076d2..5dc338782b38d6e50665a6f300d866c3ee3189e5 100644 (file)
@@ -395,7 +395,7 @@ anv_cmd_buffer_emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
    struct anv_framebuffer *fb = cmd_buffer->state.framebuffer;
    struct anv_subpass *subpass = cmd_buffer->state.subpass;
    struct anv_pipeline_layout *layout;
-   uint32_t attachments, bias, size;
+   uint32_t attachments, bias;
 
    if (stage == VK_SHADER_STAGE_COMPUTE)
       layout = cmd_buffer->state.compute_pipeline->layout;
@@ -418,8 +418,8 @@ anv_cmd_buffer_emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
    if (attachments + surface_count == 0)
       return VK_SUCCESS;
 
-   size = (bias + surface_count) * sizeof(uint32_t);
-   *bt_state = anv_cmd_buffer_alloc_surface_state(cmd_buffer, size, 32);
+   *bt_state = anv_cmd_buffer_alloc_binding_table(cmd_buffer,
+                                                  bias + surface_count);
    uint32_t *bt_map = bt_state->map;
 
    if (bt_state->map == NULL)
index 8839e875656e0bfe47629808e98665f47f31481f..6b9b12fd8ecca42ef428d05c51fb06564efedffa 100644 (file)
@@ -933,6 +933,9 @@ struct anv_state
 anv_cmd_buffer_alloc_surface_state(struct anv_cmd_buffer *cmd_buffer,
                                    uint32_t size, uint32_t alignment);
 struct anv_state
+anv_cmd_buffer_alloc_binding_table(struct anv_cmd_buffer *cmd_buffer,
+                                   uint32_t entries);
+struct anv_state
 anv_cmd_buffer_alloc_dynamic_state(struct anv_cmd_buffer *cmd_buffer,
                                    uint32_t size, uint32_t alignment);