i965: Don't rebase the index buffer to min 0 if any arrays are in VBOs.

There was a check to only do the rebase if we didn't have everything
in VBOs, but nexuiz apparently hands us a mix of VBOs and arrays,
resulting in blocking on the GPU to do a rebase.

Improves nexuiz 800x600, high-settings performance on my Ironlake 41%
(+/- 1.3%), from 14.0fps to 19.7fps.
This commit is contained in:
Eric Anholt 2010-10-12 14:39:12 -07:00
parent 3316a54205
commit 43873b53c4
4 changed files with 15 additions and 11 deletions

View File

@ -441,7 +441,7 @@ void brw_draw_prims( GLcontext *ctx,
/* Decide if we want to rebase. If so we end up recursing once
* only into this function.
*/
if (min_index != 0) {
if (min_index != 0 && !vbo_any_varyings_in_vbos(arrays)) {
vbo_rebase_prims(ctx, arrays,
prim, nr_prims,
ib, min_index, max_index,

View File

@ -383,7 +383,7 @@ static void brw_prepare_vertices(struct brw_context *brw)
*/
assert(input->offset < input->bo->size);
} else {
input->count = input->glarray->StrideB ? max_index + 1 - min_index : 1;
input->count = input->glarray->StrideB ? max_index + 1 : 1;
if (input->bo != NULL) {
/* Already-uploaded vertex data is present from a previous
* prepare_vertices, but we had to re-validate state due to
@ -414,15 +414,6 @@ static void brw_prepare_vertices(struct brw_context *brw)
}
upload[nr_uploads++] = input;
/* 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);
}
}

View File

@ -106,6 +106,7 @@ void vbo_split_prims( GLcontext *ctx,
/* Helpers for dealing translating away non-zero min_index.
*/
GLboolean vbo_all_varyings_in_vbos( const struct gl_client_array *arrays[] );
GLboolean vbo_any_varyings_in_vbos( const struct gl_client_array *arrays[] );
void vbo_rebase_prims( GLcontext *ctx,
const struct gl_client_array *arrays[],

View File

@ -85,6 +85,18 @@ GLboolean vbo_all_varyings_in_vbos( const struct gl_client_array *arrays[] )
return GL_TRUE;
}
GLboolean vbo_any_varyings_in_vbos( const struct gl_client_array *arrays[] )
{
GLuint i;
for (i = 0; i < VERT_ATTRIB_MAX; i++)
if (arrays[i]->StrideB &&
arrays[i]->BufferObj->Name != 0)
return GL_TRUE;
return GL_FALSE;
}
/* Adjust primitives, indices and vertex definitions so that min_index
* becomes zero. There are lots of reasons for wanting to do this, eg:
*