summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2015-10-15 20:18:32 -0600
committerBrian Paul <[email protected]>2015-10-20 12:52:41 -0600
commitd24c3a680e9282c11bd411d0c4dbcff561c0f4ca (patch)
tree39c9264f7097d681fb85a46f7d210119c9428593
parent1637cec8f894f80937fe7c1b1f4fe4d245d6005b (diff)
vbo: simplify some code in vbo_exec_wrap_buffers()
Use a new 'last_prim' pointer to simplify things. v2: remove unneeded assert(exec->vtx.prim_count > 0) Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Sinclair Yeh <[email protected]>
-rw-r--r--src/mesa/vbo/vbo_exec_api.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c
index c1f2146aad8..f519f8a4e61 100644
--- a/src/mesa/vbo/vbo_exec_api.c
+++ b/src/mesa/vbo/vbo_exec_api.c
@@ -71,17 +71,15 @@ static void vbo_exec_wrap_buffers( struct vbo_exec_context *exec )
exec->vtx.buffer_ptr = exec->vtx.buffer_map;
}
else {
- GLuint last_begin = exec->vtx.prim[exec->vtx.prim_count-1].begin;
+ struct _mesa_prim *last_prim = &exec->vtx.prim[exec->vtx.prim_count - 1];
+ const GLuint last_begin = last_prim->begin;
GLuint last_count;
if (_mesa_inside_begin_end(exec->ctx)) {
- GLint i = exec->vtx.prim_count - 1;
- assert(i >= 0);
- exec->vtx.prim[i].count = (exec->vtx.vert_count -
- exec->vtx.prim[i].start);
+ last_prim->count = exec->vtx.vert_count - last_prim->start;
}
- last_count = exec->vtx.prim[exec->vtx.prim_count-1].count;
+ last_count = last_prim->count;
/* Execute the buffer and save copied vertices.
*/