diff options
author | Brian Paul <[email protected]> | 2015-10-16 11:19:40 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2015-10-20 12:52:41 -0600 |
commit | 03d2f085394011f704f5702a92128b5677733c38 (patch) | |
tree | 4d57949c327d924c189bf5b607c75c3295d84e67 /src/mesa/vbo/vbo_context.h | |
parent | 002c5c1da3a2db60607fb184b9c6343415987fb5 (diff) |
vbo: add new vbo_compute_max_verts() helper function
Reviewed-by: Marek Olšák <[email protected]>
Reviewed-by: Jose Fonseca <[email protected]>
Reviewed-by: Sinclair Yeh <[email protected]>
Diffstat (limited to 'src/mesa/vbo/vbo_context.h')
-rw-r--r-- | src/mesa/vbo/vbo_context.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mesa/vbo/vbo_context.h b/src/mesa/vbo/vbo_context.h index a376efe34a7..1e85335c107 100644 --- a/src/mesa/vbo/vbo_context.h +++ b/src/mesa/vbo/vbo_context.h @@ -196,6 +196,20 @@ vbo_get_default_vals_as_union(GLenum format) } } + +/** + * Compute the max number of vertices which can be stored in + * a vertex buffer, given the current vertex size, and the amount + * of space already used. + */ +static inline unsigned +vbo_compute_max_verts(const struct vbo_exec_context *exec) +{ + return (VBO_VERT_BUFFER_SIZE - exec->vtx.buffer_used) / + (exec->vtx.vertex_size * sizeof(GLfloat)); +} + + #ifdef __cplusplus } // extern "C" #endif |