vbo: whitespace, formatting fixes in vbo_split.[ch]

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
This commit is contained in:
Brian Paul
2018-01-17 12:20:49 -07:00
parent ec4bb693a0
commit 67ebde19d4
2 changed files with 65 additions and 60 deletions
+45 -43
View File
@@ -36,7 +36,7 @@
*
* We want buffer splitting to be a convenience function for the code
* actually drawing the primitives rather than a system-wide maximum,
* otherwise it is hard to avoid pessimism.
* otherwise it is hard to avoid pessimism.
*
* For instance, if a driver has no hardware limits on vertex buffer
* dimensions, it would not ordinarily want to split vbos. But if
@@ -55,10 +55,12 @@
#include "vbo_split.h"
#include "vbo.h"
/* True if a primitive can be split without copying of vertices, false
* otherwise.
*/
GLboolean split_prim_inplace(GLenum mode, GLuint *first, GLuint *incr)
GLboolean
split_prim_inplace(GLenum mode, GLuint *first, GLuint *incr)
{
switch (mode) {
case GL_POINTS:
@@ -98,62 +100,62 @@ GLboolean split_prim_inplace(GLenum mode, GLuint *first, GLuint *incr)
void vbo_split_prims( struct gl_context *ctx,
const struct gl_vertex_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
GLuint min_index,
GLuint max_index,
vbo_draw_func draw,
const struct split_limits *limits )
void
vbo_split_prims(struct gl_context *ctx,
const struct gl_vertex_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
GLuint min_index,
GLuint max_index,
vbo_draw_func draw,
const struct split_limits *limits)
{
if (ib) {
if (limits->max_indices == 0) {
/* Could traverse the indices, re-emitting vertices in turn.
* But it's hard to see why this case would be needed - for
* software tnl, it is better to convert to non-indexed
* rendering after transformation is complete. Are there any devices
* with hardware tnl that cannot do indexed rendering?
*
* For now, this path is disabled.
*/
assert(0);
/* Could traverse the indices, re-emitting vertices in turn.
* But it's hard to see why this case would be needed - for
* software tnl, it is better to convert to non-indexed
* rendering after transformation is complete. Are there any devices
* with hardware tnl that cannot do indexed rendering?
*
* For now, this path is disabled.
*/
assert(0);
}
else if (max_index - min_index >= limits->max_verts) {
/* The vertex buffers are too large for hardware (or the
* swtnl module). Traverse the indices, re-emitting vertices
* in turn. Use a vertex cache to preserve some of the
* sharing from the original index list.
*/
vbo_split_copy(ctx, arrays, prim, nr_prims, ib,
draw, limits );
/* The vertex buffers are too large for hardware (or the
* swtnl module). Traverse the indices, re-emitting vertices
* in turn. Use a vertex cache to preserve some of the
* sharing from the original index list.
*/
vbo_split_copy(ctx, arrays, prim, nr_prims, ib, draw, limits);
}
else if (ib->count > limits->max_indices) {
/* The index buffer is too large for hardware. Try to split
* on whole-primitive boundaries, otherwise try to split the
* individual primitives.
*/
vbo_split_inplace(ctx, arrays, prim, nr_prims, ib,
min_index, max_index, draw, limits );
/* The index buffer is too large for hardware. Try to split
* on whole-primitive boundaries, otherwise try to split the
* individual primitives.
*/
vbo_split_inplace(ctx, arrays, prim, nr_prims, ib,
min_index, max_index, draw, limits);
}
else {
/* Why were we called? */
assert(0);
/* Why were we called? */
assert(0);
}
}
else {
if (max_index - min_index >= limits->max_verts) {
/* The vertex buffer is too large for hardware (or the swtnl
* module). Try to split on whole-primitive boundaries,
* otherwise try to split the individual primitives.
*/
vbo_split_inplace(ctx, arrays, prim, nr_prims, ib,
min_index, max_index, draw, limits );
/* The vertex buffer is too large for hardware (or the swtnl
* module). Try to split on whole-primitive boundaries,
* otherwise try to split the individual primitives.
*/
vbo_split_inplace(ctx, arrays, prim, nr_prims, ib,
min_index, max_index, draw, limits);
}
else {
/* Why were we called? */
assert(0);
/* Why were we called? */
assert(0);
}
}
}
+20 -17
View File
@@ -47,26 +47,29 @@
/* True if a primitive can be split without copying of vertices, false
* otherwise.
*/
GLboolean split_prim_inplace(GLenum mode, GLuint *first, GLuint *incr);
GLboolean
split_prim_inplace(GLenum mode, GLuint *first, GLuint *incr);
void vbo_split_inplace( struct gl_context *ctx,
const struct gl_vertex_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
GLuint min_index,
GLuint max_index,
vbo_draw_func draw,
const struct split_limits *limits );
void
vbo_split_inplace(struct gl_context *ctx,
const struct gl_vertex_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
GLuint min_index,
GLuint max_index,
vbo_draw_func draw,
const struct split_limits *limits);
/* Requires ib != NULL:
*/
void vbo_split_copy( struct gl_context *ctx,
const struct gl_vertex_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
vbo_draw_func draw,
const struct split_limits *limits );
void
vbo_split_copy(struct gl_context *ctx,
const struct gl_vertex_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
vbo_draw_func draw,
const struct split_limits *limits);
#endif