From: Marek Olšák Date: Tue, 8 Feb 2011 15:34:22 +0000 (+0100) Subject: r300g: use the same upload buffer for vertices and indices X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b541a3c4c0a125087fa9e1e0d35db019c36fb0e9;p=mesa.git r300g: use the same upload buffer for vertices and indices --- diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 7e0c068ff3e..c6e03050fc7 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -104,8 +104,6 @@ static void r300_destroy_context(struct pipe_context* context) if (r300->vbuf_mgr) u_vbuf_mgr_destroy(r300->vbuf_mgr); - if (r300->upload_ib) - u_upload_destroy(r300->upload_ib); /* XXX: This function assumes r300->query_list was initialized */ r300_release_referenced_objects(r300); @@ -434,8 +432,9 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300_init_resource_functions(r300); r300->vbuf_mgr = u_vbuf_mgr_create(&r300->context, 1024 * 1024, 16, - PIPE_BIND_VERTEX_BUFFER, - U_VERTEX_FETCH_DWORD_ALIGNED); + PIPE_BIND_VERTEX_BUFFER | + PIPE_BIND_INDEX_BUFFER, + U_VERTEX_FETCH_DWORD_ALIGNED); if (!r300->vbuf_mgr) goto fail; @@ -453,13 +452,6 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, if (!r300_hyperz_init_mm(r300)) goto fail; - r300->upload_ib = u_upload_create(&r300->context, - 64 * 1024, 16, - PIPE_BIND_INDEX_BUFFER); - - if (r300->upload_ib == NULL) - goto fail; - r300_init_states(&r300->context); /* The KIL opcode needs the first texture unit to be enabled diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 9d2a0b290ae..1737dafc6ac 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -579,9 +579,6 @@ struct r300_context { /* two mem block managers for hiz/zmask ram space */ struct mem_block *hiz_mm; - /* upload manager */ - struct u_upload_mgr *upload_ib; - struct u_vbuf_mgr *vbuf_mgr; struct util_slab_mempool pool_transfers; diff --git a/src/gallium/drivers/r300/r300_render_translate.c b/src/gallium/drivers/r300/r300_render_translate.c index 76d012d81e6..dbc64ebf827 100644 --- a/src/gallium/drivers/r300/r300_render_translate.c +++ b/src/gallium/drivers/r300/r300_render_translate.c @@ -37,7 +37,7 @@ void r300_translate_index_buffer(struct r300_context *r300, switch (*index_size) { case 1: - u_upload_alloc(r300->upload_ib, 0, count * 2, + u_upload_alloc(r300->vbuf_mgr->uploader, 0, count * 2, &out_offset, &out_buffer, &flushed, &ptr); util_shorten_ubyte_elts_to_userptr( @@ -52,7 +52,7 @@ void r300_translate_index_buffer(struct r300_context *r300, case 2: if (index_offset) { - u_upload_alloc(r300->upload_ib, 0, count * 2, + u_upload_alloc(r300->vbuf_mgr->uploader, 0, count * 2, &out_offset, &out_buffer, &flushed, &ptr); util_rebuild_ushort_elts_to_userptr(&r300->context, *index_buffer, @@ -67,7 +67,7 @@ void r300_translate_index_buffer(struct r300_context *r300, case 4: if (index_offset) { - u_upload_alloc(r300->upload_ib, 0, count * 4, + u_upload_alloc(r300->vbuf_mgr->uploader, 0, count * 4, &out_offset, &out_buffer, &flushed, &ptr); util_rebuild_uint_elts_to_userptr(&r300->context, *index_buffer, diff --git a/src/gallium/drivers/r300/r300_screen_buffer.c b/src/gallium/drivers/r300/r300_screen_buffer.c index d76524d261d..4a3cc7a3f41 100644 --- a/src/gallium/drivers/r300/r300_screen_buffer.c +++ b/src/gallium/drivers/r300/r300_screen_buffer.c @@ -67,7 +67,7 @@ void r300_upload_index_buffer(struct r300_context *r300, *index_buffer = NULL; - u_upload_data(r300->upload_ib, + u_upload_data(r300->vbuf_mgr->uploader, 0, count * index_size, ptr + (*start * index_size), &index_offset,