summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw_upload.c11
-rw-r--r--src/mesa/vbo/vbo.h1
-rw-r--r--src/mesa/vbo/vbo_rebase.c12
4 files changed, 15 insertions, 11 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
index 6a4dda2a40f..af5c37583b5 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -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,
diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index 249e874ab1a..f24c4146adb 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -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);
}
}
diff --git a/src/mesa/vbo/vbo.h b/src/mesa/vbo/vbo.h
index 07d31f6ce36..30b1448b8a4 100644
--- a/src/mesa/vbo/vbo.h
+++ b/src/mesa/vbo/vbo.h
@@ -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[],
diff --git a/src/mesa/vbo/vbo_rebase.c b/src/mesa/vbo/vbo_rebase.c
index ff7c7a6b0d5..e75253f8626 100644
--- a/src/mesa/vbo/vbo_rebase.c
+++ b/src/mesa/vbo/vbo_rebase.c
@@ -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:
*