summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-04-22 16:36:38 +0200
committerMarek Olšák <[email protected]>2012-04-23 22:58:02 +0200
commit6fc565a94bc0de7ad617c28db7b8b6dfa4102d49 (patch)
treee016ddfbac52b8e8002e8ad0d48da02434da1d53
parentedec3fa8120b2ba20ae0a709058b2d97d00eb2d3 (diff)
vbo: do FLUSH_CURRENT before validating and updating state
This fixes an assertion failure since: commit 81afdd20f3f574ce29559d8ad77df5c77652009e vbo: don't check twice whether it's valid to render FLUSH_CURRENT may set _NEW_CURRENT_ATTRIB. Reviewed-by: Brian Paul <[email protected]>
-rw-r--r--src/mesa/vbo/vbo_exec_array.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index f95e062fb4a..28019afeb81 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -640,11 +640,11 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count)
_mesa_debug(ctx, "glDrawArrays(%s, %d, %d)\n",
_mesa_lookup_enum_by_nr(mode), start, count);
+ FLUSH_CURRENT(ctx, 0);
+
if (!_mesa_validate_DrawArrays( ctx, mode, start, count ))
return;
- FLUSH_CURRENT( ctx, 0 );
-
if (0)
check_draw_arrays_data(ctx, start, count);
@@ -669,11 +669,11 @@ vbo_exec_DrawArraysInstanced(GLenum mode, GLint start, GLsizei count,
_mesa_debug(ctx, "glDrawArraysInstanced(%s, %d, %d, %d)\n",
_mesa_lookup_enum_by_nr(mode), start, count, numInstances);
+ FLUSH_CURRENT(ctx, 0);
+
if (!_mesa_validate_DrawArraysInstanced(ctx, mode, start, count, numInstances))
return;
- FLUSH_CURRENT( ctx, 0 );
-
if (0)
check_draw_arrays_data(ctx, start, count);
@@ -761,8 +761,6 @@ vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode,
struct _mesa_index_buffer ib;
struct _mesa_prim prim[1];
- FLUSH_CURRENT( ctx, 0 );
-
vbo_bind_arrays(ctx);
ib.count = count;
@@ -838,6 +836,8 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
_mesa_lookup_enum_by_nr(mode), start, end, count,
_mesa_lookup_enum_by_nr(type), indices, basevertex);
+ FLUSH_CURRENT(ctx, 0);
+
if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count,
type, indices, basevertex ))
return;
@@ -936,6 +936,8 @@ vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type,
_mesa_lookup_enum_by_nr(mode), count,
_mesa_lookup_enum_by_nr(type), indices);
+ FLUSH_CURRENT(ctx, 0);
+
if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices, 0 ))
return;
@@ -958,6 +960,8 @@ vbo_exec_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
_mesa_lookup_enum_by_nr(mode), count,
_mesa_lookup_enum_by_nr(type), indices, basevertex);
+ FLUSH_CURRENT(ctx, 0);
+
if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices,
basevertex ))
return;
@@ -981,6 +985,8 @@ vbo_exec_DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type,
_mesa_lookup_enum_by_nr(mode), count,
_mesa_lookup_enum_by_nr(type), indices, numInstances);
+ FLUSH_CURRENT(ctx, 0);
+
if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices,
numInstances, 0))
return;
@@ -1005,6 +1011,8 @@ vbo_exec_DrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type
_mesa_lookup_enum_by_nr(type), indices,
numInstances, basevertex);
+ FLUSH_CURRENT(ctx, 0);
+
if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices,
numInstances, basevertex))
return;
@@ -1037,8 +1045,6 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
if (primcount == 0)
return;
- FLUSH_CURRENT( ctx, 0 );
-
prim = calloc(1, primcount * sizeof(*prim));
if (prim == NULL) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glMultiDrawElements");
@@ -1226,12 +1232,12 @@ vbo_exec_DrawTransformFeedback(GLenum mode, GLuint name)
_mesa_debug(ctx, "glDrawTransformFeedback(%s, %d)\n",
_mesa_lookup_enum_by_nr(mode), name);
+ FLUSH_CURRENT(ctx, 0);
+
if (!_mesa_validate_DrawTransformFeedback(ctx, mode, obj)) {
return;
}
- FLUSH_CURRENT(ctx, 0);
-
vbo_draw_transform_feedback(ctx, mode, obj, 1);
}