summaryrefslogtreecommitdiffstats
path: root/src/mesa/tnl
diff options
context:
space:
mode:
authorIago Toral Quiroga <[email protected]>2014-04-08 13:01:20 +0200
committerEric Anholt <[email protected]>2014-04-08 15:10:10 -0700
commit1a92637c68b84fa30e90f442e8a3d32c450cafcc (patch)
tree20e67c25b51ef2607c1265d853ecf7e7869c278a /src/mesa/tnl
parent2ffb50d77b7ae3cdedf0319a0def16732ed39578 (diff)
tnl: Merge _tnl_vbo_draw_prims() into _tnl_draw_prims().
This should help prevent situations where we render without proper index bounds. For example: https://bugs.freedesktop.org/show_bug.cgi?id=59455 Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/tnl')
-rw-r--r--src/mesa/tnl/t_context.c2
-rw-r--r--src/mesa/tnl/t_draw.c34
-rw-r--r--src/mesa/tnl/tnl.h9
3 files changed, 12 insertions, 33 deletions
diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c
index 134f699be5f..eb5bae41da2 100644
--- a/src/mesa/tnl/t_context.c
+++ b/src/mesa/tnl/t_context.c
@@ -93,7 +93,7 @@ _tnl_CreateContext( struct gl_context *ctx )
}
/* plug in the VBO drawing function */
- vbo_set_draw_func(ctx, _tnl_vbo_draw_prims);
+ vbo_set_draw_func(ctx, _tnl_draw_prims);
_math_init_transformation();
_math_init_translate();
diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c
index 2755ae62d49..be3f059bb56 100644
--- a/src/mesa/tnl/t_draw.c
+++ b/src/mesa/tnl/t_draw.c
@@ -411,7 +411,11 @@ static void unmap_vbos( struct gl_context *ctx,
}
-void _tnl_vbo_draw_prims(struct gl_context *ctx,
+/* This is the main entrypoint into the slimmed-down software tnl
+ * module. In a regular swtnl driver, this can be plugged straight
+ * into the vbo->Driver.DrawPrims() callback.
+ */
+void _tnl_draw_prims(struct gl_context *ctx,
const struct _mesa_prim *prim,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
@@ -421,32 +425,16 @@ void _tnl_vbo_draw_prims(struct gl_context *ctx,
struct gl_transform_feedback_object *tfb_vertcount,
struct gl_buffer_object *indirect)
{
- const struct gl_client_array **arrays = ctx->Array._DrawArrays;
-
- if (!index_bounds_valid)
- vbo_get_minmax_indices(ctx, prim, ib, &min_index, &max_index, nr_prims);
-
- _tnl_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index);
-}
-
-/* This is the main entrypoint into the slimmed-down software tnl
- * module. In a regular swtnl driver, this can be plugged straight
- * into the vbo->Driver.DrawPrims() callback.
- */
-void _tnl_draw_prims( struct gl_context *ctx,
- const struct gl_client_array *arrays[],
- const struct _mesa_prim *prim,
- GLuint nr_prims,
- const struct _mesa_index_buffer *ib,
- GLuint min_index,
- GLuint max_index)
-{
TNLcontext *tnl = TNL_CONTEXT(ctx);
+ const struct gl_client_array **arrays = ctx->Array._DrawArrays;
const GLuint TEST_SPLIT = 0;
const GLint max = TEST_SPLIT ? 8 : tnl->vb.Size - MAX_CLIPPED_VERTICES;
GLint max_basevertex = prim->basevertex;
GLuint i;
+ if (!index_bounds_valid)
+ vbo_get_minmax_indices(ctx, prim, ib, &min_index, &max_index, nr_prims);
+
/* Mesa core state should have been validated already */
assert(ctx->NewState == 0x0);
@@ -471,7 +459,7 @@ void _tnl_draw_prims( struct gl_context *ctx,
*/
vbo_rebase_prims( ctx, arrays, prim, nr_prims, ib,
min_index, max_index,
- _tnl_vbo_draw_prims );
+ _tnl_draw_prims );
return;
}
else if ((GLint)max_index + max_basevertex > max) {
@@ -489,7 +477,7 @@ void _tnl_draw_prims( struct gl_context *ctx,
*/
vbo_split_prims( ctx, arrays, prim, nr_prims, ib,
0, max_index + prim->basevertex,
- _tnl_vbo_draw_prims,
+ _tnl_draw_prims,
&limits );
}
else {
diff --git a/src/mesa/tnl/tnl.h b/src/mesa/tnl/tnl.h
index 59a0ac38084..8c59ff9e58f 100644
--- a/src/mesa/tnl/tnl.h
+++ b/src/mesa/tnl/tnl.h
@@ -77,15 +77,6 @@ struct _mesa_index_buffer;
void
_tnl_draw_prims( struct gl_context *ctx,
- const struct gl_client_array *arrays[],
- const struct _mesa_prim *prim,
- GLuint nr_prims,
- const struct _mesa_index_buffer *ib,
- GLuint min_index,
- GLuint max_index);
-
-void
-_tnl_vbo_draw_prims( struct gl_context *ctx,
const struct _mesa_prim *prim,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,