X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fdri%2Fi965%2Fbrw_draw_upload.c;h=6150cac4aa3b4d64e340f87e1627c9250e88798e;hb=58eac1bbf320b4104c3158aaeca4726f1a59daf9;hp=6968d745c1c9f9e555397299fedcaae51bea690e;hpb=893526b8a823fe1b88f2b46376155afb91c84016;p=mesa.git diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index 6968d745c1c..6150cac4aa3 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -408,9 +408,11 @@ GLboolean brw_upload_vertices( struct brw_context *brw, /* First build an array of pointers to ve's in vb.inputs_read */ + if (0) + _mesa_printf("%s %d..%d\n", __FUNCTION__, min_index, max_index); while (tmp) { - GLuint i = ffsll(tmp)-1; + GLuint i = _mesa_ffsll(tmp)-1; struct brw_vertex_element *input = &brw->vb.inputs[i]; tmp &= ~(1<index = i; input->element_size = get_size(input->glarray->Type) * input->glarray->Size; - input->count = input->glarray->StrideB ? max_index - min_index : 1; + input->count = input->glarray->StrideB ? max_index + 1 - min_index : 1; if (!input->glarray->BufferObj->Name) { if (i == 0) { @@ -437,7 +439,15 @@ GLboolean brw_upload_vertices( struct brw_context *brw, } upload[nr_uploads++] = input; - assert(min_index == 0); + + /* We rebase drawing to start at element zero only when + * varyings are not in vbos, which means we can end up + * uploading non-varying arrays (stride != 0) when min_index + * is zero. This doesn't matter as the amount to upload is + * the same for these arrays whether the draw call is rebased + * or not - we just have to upload the one element. + */ + assert(min_index == 0 || input->glarray->StrideB == 0); } }