radv: move vertex binding out of cmd state.
authorDave Airlie <airlied@redhat.com>
Sun, 5 Nov 2017 23:17:09 +0000 (23:17 +0000)
committerDave Airlie <airlied@redhat.com>
Mon, 6 Nov 2017 01:10:56 +0000 (01:10 +0000)
This isn't required to be cleared, since buffers are only linked
by vertex elements, so if elements are clear then no buffers
should be referenced.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_cmd_buffer.c
src/amd/vulkan/radv_private.h

index 1e5c73ea588e7bdccc1f3d6f2a3737345a6845a7..d1cfe8ca0681cf82b17351ae59b86a9c0b1b9623 100644 (file)
@@ -1790,13 +1790,13 @@ radv_cmd_buffer_update_vertex_descriptors(struct radv_cmd_buffer *cmd_buffer, bo
                        uint32_t *desc = &((uint32_t *)vb_ptr)[i * 4];
                        uint32_t offset;
                        int vb = velems->binding[i];
-                       struct radv_buffer *buffer = cmd_buffer->state.vertex_bindings[vb].buffer;
+                       struct radv_buffer *buffer = cmd_buffer->vertex_bindings[vb].buffer;
                        uint32_t stride = cmd_buffer->state.pipeline->binding_stride[vb];
 
                        device->ws->cs_add_buffer(cmd_buffer->cs, buffer->bo, 8);
                        va = radv_buffer_get_va(buffer->bo);
 
-                       offset = cmd_buffer->state.vertex_bindings[vb].offset + velems->offset[i];
+                       offset = cmd_buffer->vertex_bindings[vb].offset + velems->offset[i];
                        va += offset + buffer->offset;
                        desc[0] = va;
                        desc[1] = S_008F04_BASE_ADDRESS_HI(va >> 32) | S_008F04_STRIDE(stride);
@@ -2256,7 +2256,7 @@ void radv_CmdBindVertexBuffers(
        const VkDeviceSize*                         pOffsets)
 {
        RADV_FROM_HANDLE(radv_cmd_buffer, cmd_buffer, commandBuffer);
-       struct radv_vertex_binding *vb = cmd_buffer->state.vertex_bindings;
+       struct radv_vertex_binding *vb = cmd_buffer->vertex_bindings;
        bool changed = false;
 
        /* We have to defer setting up vertex buffer since we need the buffer
index 15cd5eee7df43b72235c199181240d392e250f09..d236588621a125fc72b9589b0584b3e3f87e29dc 100644 (file)
@@ -822,7 +822,6 @@ struct radv_cmd_state {
        struct radv_render_pass *                     pass;
        const struct radv_subpass *                         subpass;
        struct radv_dynamic_state                     dynamic;
-       struct radv_vertex_binding                    vertex_bindings[MAX_VBS];
        struct radv_descriptor_set *                  descriptors[MAX_SETS];
        struct radv_attachment_state *                attachments;
        VkRect2D                                     render_area;
@@ -871,6 +870,7 @@ struct radv_cmd_buffer {
        VkCommandBufferLevel                         level;
        struct radeon_winsys_cs *cs;
        struct radv_cmd_state state;
+       struct radv_vertex_binding                   vertex_bindings[MAX_VBS];
        uint32_t queue_family_index;
 
        uint8_t push_constants[MAX_PUSH_CONSTANTS_SIZE];