From 0586a94929bb276c349220026cfac6267b776fb3 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 21 Sep 2012 07:50:05 +0200 Subject: [PATCH] i965: Remove broken non-interleaved-to-interleaved upload code. This failed when all the uploads to occur were uniform-type vertex data (like glColor4f being active across a DrawArrays), because it would upload 1 element instead of 1 element per vertex. There was no citation for how this code helped any particular application, and it breaks ETQW, so just remove it. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=47170 NOTE: This is a candidate for the 9.0 and 8.0 branches. Reviewed-and-tested-by: Kenneth Graunke (cherry picked from commit 0334e8dc25d09e3254e61d5d122b4fd7bfbd627a) --- src/mesa/drivers/dri/i965/brw_draw_upload.c | 52 ++--------------------------- 1 file changed, 2 insertions(+), 50 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index e40c7d5..c2564c9 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -357,11 +357,10 @@ static void brw_prepare_vertices(struct brw_context *brw) /* CACHE_NEW_VS_PROG */ GLbitfield64 vs_inputs = brw->vs.prog_data->inputs_read; const unsigned char *ptr = NULL; - GLuint interleaved = 0, total_size = 0; + GLuint interleaved = 0; unsigned int min_index = brw->vb.min_index; unsigned int max_index = brw->vb.max_index; int delta, i, j; - GLboolean can_merge_uploads = GL_TRUE; struct brw_vertex_element *upload[VERT_ATTRIB_MAX]; GLuint nr_uploads = 0; @@ -473,13 +472,6 @@ static void brw_prepare_vertices(struct brw_context *brw) } upload[nr_uploads++] = input; - - total_size = ALIGN(total_size, type_size); - total_size += input->element_size; - - if (glarray->InstanceDivisor != 0) { - can_merge_uploads = GL_FALSE; - } } } @@ -498,7 +490,7 @@ static void brw_prepare_vertices(struct brw_context *brw) /* Handle any arrays to be uploaded. */ if (nr_uploads > 1) { - if (interleaved && interleaved <= 2*total_size) { + if (interleaved) { struct brw_vertex_buffer *buffer = &brw->vb.buffers[j]; /* All uploads are interleaved, so upload the arrays together as * interleaved. First, upload the contents and set up upload[0]. @@ -517,46 +509,6 @@ static void brw_prepare_vertices(struct brw_context *brw) nr_uploads = 0; } - else if ((total_size < 2048) && can_merge_uploads) { - /* Upload non-interleaved arrays into a single interleaved array */ - struct brw_vertex_buffer *buffer; - int count = MAX2(max_index - min_index + 1, 1); - int offset; - char *map; - - map = intel_upload_map(&brw->intel, total_size * count, total_size); - for (i = offset = 0; i < nr_uploads; i++) { - const unsigned char *src = upload[i]->glarray->Ptr; - int size = upload[i]->element_size; - int stride = upload[i]->glarray->StrideB; - char *dst; - int n; - - offset = ALIGN(offset, get_size(upload[i]->glarray->Type)); - dst = map + offset; - src += min_index * stride; - - for (n = 0; n < count; n++) { - memcpy(dst, src, size); - src += stride; - dst += total_size; - } - - upload[i]->offset = offset; - upload[i]->buffer = j; - - offset += size; - } - assert(offset == total_size); - buffer = &brw->vb.buffers[j++]; - intel_upload_unmap(&brw->intel, map, offset * count, offset, - &buffer->bo, &buffer->offset); - buffer->stride = offset; - buffer->step_rate = 0; - buffer->offset -= delta * offset; - - nr_uploads = 0; - } } /* Upload non-interleaved arrays */ for (i = 0; i < nr_uploads; i++) { -- 2.7.4