[Mesa-dev] [PATCH 05/11] gallium/primconvert: use the common uploader

Marek Olšák maraeo at gmail.com
Thu Feb 9 00:11:06 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
Tested-by: Edmondo Tommasina <edmondo.tommasina at gmail.com>
---
 src/gallium/auxiliary/indices/u_primconvert.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/src/gallium/auxiliary/indices/u_primconvert.c b/src/gallium/auxiliary/indices/u_primconvert.c
index 5effd88..2bdfade 100644
--- a/src/gallium/auxiliary/indices/u_primconvert.c
+++ b/src/gallium/auxiliary/indices/u_primconvert.c
@@ -49,40 +49,37 @@
 
 #include "indices/u_indices.h"
 #include "indices/u_primconvert.h"
 
 struct primconvert_context
 {
    struct pipe_context *pipe;
    struct pipe_index_buffer saved_ib;
    uint32_t primtypes_mask;
    unsigned api_pv;
-   struct u_upload_mgr *upload;
 };
 
 
 struct primconvert_context *
 util_primconvert_create(struct pipe_context *pipe, uint32_t primtypes_mask)
 {
    struct primconvert_context *pc = CALLOC_STRUCT(primconvert_context);
    if (!pc)
       return NULL;
    pc->pipe = pipe;
    pc->primtypes_mask = primtypes_mask;
    return pc;
 }
 
 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);
 }
 
 void
 util_primconvert_save_index_buffer(struct primconvert_context *pc,
                                    const struct pipe_index_buffer *ib)
 {
    if (ib) {
       pipe_resource_reference(&pc->saved_ib.buffer, ib->buffer);
@@ -145,39 +142,34 @@ util_primconvert_draw_vbo(struct primconvert_context *pc,
       src = (const uint8_t *)src + ib->offset;
    }
    else {
       u_index_generator(pc->primtypes_mask,
                         info->mode, info->start, info->count,
                         pc->api_pv, pc->api_pv,
                         &new_info.mode, &new_ib.index_size, &new_info.count,
                         &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) {
       trans_func(src, info->start, info->count, new_info.count, info->restart_index, dst);
    }
    else {
       gen_func(info->start, new_info.count, dst);
    }
 
    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);
 
    /* to the translated draw: */
    pc->pipe->draw_vbo(pc->pipe, &new_info);
 
    /* and then restore saved ib: */
    pc->pipe->set_index_buffer(pc->pipe, ib);
 
-- 
2.7.4



More information about the mesa-dev mailing list