gallium/primconvert: use the common uploader
authorMarek Olšák <marek.olsak@amd.com>
Fri, 27 Jan 2017 01:01:38 +0000 (02:01 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 14 Feb 2017 20:46:16 +0000 (21:46 +0100)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Tested-by: Charmaine Lee <charmainel@vmware.com>
src/gallium/auxiliary/indices/u_primconvert.c

index 5effd883f67f544bea60f895b069dae4538a69ac..2bdfade8a5434a6466cfbc12a39f334130313c9b 100644 (file)
@@ -56,7 +56,6 @@ struct primconvert_context
    struct pipe_index_buffer saved_ib;
    uint32_t primtypes_mask;
    unsigned api_pv;
-   struct u_upload_mgr *upload;
 };
 
 
@@ -74,8 +73,6 @@ util_primconvert_create(struct pipe_context *pipe, uint32_t primtypes_mask)
 void
 util_primconvert_destroy(struct primconvert_context *pc)
 {
-   if (pc->upload)
-      u_upload_destroy(pc->upload);
    util_primconvert_save_index_buffer(pc, NULL);
    FREE(pc);
 }
@@ -152,12 +149,7 @@ util_primconvert_draw_vbo(struct primconvert_context *pc,
                         &gen_func);
    }
 
-   if (!pc->upload) {
-      pc->upload = u_upload_create(pc->pipe, 4096, PIPE_BIND_INDEX_BUFFER,
-                                   PIPE_USAGE_STREAM);
-   }
-
-   u_upload_alloc(pc->upload, 0, new_ib.index_size * new_info.count, 4,
+   u_upload_alloc(pc->pipe->stream_uploader, 0, new_ib.index_size * new_info.count, 4,
                   &new_ib.offset, &new_ib.buffer, &dst);
 
    if (info->indexed) {
@@ -170,7 +162,7 @@ util_primconvert_draw_vbo(struct primconvert_context *pc,
    if (src_transfer)
       pipe_buffer_unmap(pc->pipe, src_transfer);
 
-   u_upload_unmap(pc->upload);
+   u_upload_unmap(pc->pipe->stream_uploader);
 
    /* bind new index buffer: */
    pc->pipe->set_index_buffer(pc->pipe, &new_ib);