diff options
author | Keith Whitwell <[email protected]> | 2008-03-10 19:44:54 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2008-03-10 23:31:50 +0000 |
commit | d08cd68d3f5456b69ad504ede2b090c0bb6474db (patch) | |
tree | ad7ba188a0d912d222519de6bda4242139f8a36f | |
parent | 7375369fb32e203023fbacf948169aad3f4c3a1d (diff) |
mesa: fast-track glColor and similar calls when not immediate mode rendering
Often these are mixed in with draw arrays calls, etc. Try not to get
the whole immediate rendering state machine going when we receive one
of these on their own.
-rw-r--r-- | src/mesa/vbo/vbo_exec_api.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index b7f4d8a3075..35dc0e768f5 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -309,16 +309,23 @@ static void vbo_exec_fixup_vertex( GLcontext *ctx, GLuint attr, GLuint sz ) { struct vbo_exec_context *exec = &vbo_context(ctx)->exec; + static const GLfloat id[4] = { 0, 0, 0, 1 }; int i; - if (sz > exec->vtx.attrsz[attr]) { + if (exec->vtx.prim_count == 0) { + GLfloat *current = (GLfloat *)vbo_context(ctx)->currval[attr].Ptr; + exec->vtx.attrptr[attr] = current; + memcpy(current, id, sizeof(id)); + ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; + return; + } + else if (sz > exec->vtx.attrsz[attr]) { /* New size is larger. Need to flush existing vertices and get * an enlarged vertex format. */ vbo_exec_wrap_upgrade_vertex( exec, attr, sz ); } else if (sz < exec->vtx.active_sz[attr]) { - static const GLfloat id[4] = { 0, 0, 0, 1 }; /* New size is smaller - just need to fill in some * zeros. Don't need to flush or wrap. |