summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2018-01-12 13:17:10 -0700
committerBrian Paul <[email protected]>2018-01-17 11:17:56 -0700
commit4edc8fdcdc8df2a37930241b803383d46e6d7f5f (patch)
tree1ee70f2a84e6454912e5c0923bcbff7616b0e942 /src/mesa
parentad3b162b8165d9f72e7014671cf4ad64541474d6 (diff)
vbo: rewrite some code in playback_copy_to_current()
I think this is a little easier to understand. Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/vbo/vbo_save_draw.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c
index ee7f509b6cb..1694a04a3e1 100644
--- a/src/mesa/vbo/vbo_save_draw.c
+++ b/src/mesa/vbo/vbo_save_draw.c
@@ -51,7 +51,6 @@ playback_copy_to_current(struct gl_context *ctx,
fi_type vertex[VBO_ATTRIB_MAX * 4];
fi_type *data;
GLbitfield64 mask;
- GLuint offset;
if (node->current_size == 0)
return;
@@ -60,14 +59,13 @@ playback_copy_to_current(struct gl_context *ctx,
data = node->current_data;
}
else {
- data = vertex;
+ /* Position of last vertex */
+ const GLuint pos = node->vertex_count > 0 ? node->vertex_count - 1 : 0;
+ /* Offset to last vertex in the vertex buffer */
+ const GLuint offset = node->buffer_offset
+ + pos * node->vertex_size * sizeof(GLfloat);
- if (node->vertex_count)
- offset = (node->buffer_offset +
- (node->vertex_count - 1)
- * node->vertex_size * sizeof(GLfloat));
- else
- offset = node->buffer_offset;
+ data = vertex;
ctx->Driver.GetBufferSubData(ctx, offset,
node->vertex_size * sizeof(GLfloat),