summaryrefslogtreecommitdiffstats
path: root/src/mesa/tnl
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/tnl')
-rw-r--r--src/mesa/tnl/t_context.c6
-rw-r--r--src/mesa/tnl/t_context.h3
-rw-r--r--src/mesa/tnl/t_draw.c42
-rw-r--r--src/mesa/tnl/tnl.h14
4 files changed, 59 insertions, 6 deletions
diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c
index bb5d9fc07b9..345f0bf8584 100644
--- a/src/mesa/tnl/t_context.c
+++ b/src/mesa/tnl/t_context.c
@@ -96,12 +96,12 @@ _tnl_CreateContext( struct gl_context *ctx )
insert_at_tail( tnl->_ShineTabList, s );
}
- /* plug in the VBO drawing function */
- vbo_set_draw_func(ctx, _tnl_draw_prims);
-
_math_init_transformation();
_math_init_translate();
+ /* Keep our list of gl_vertex_array inputs */
+ _vbo_init_inputs(&tnl->draw_arrays);
+
return GL_TRUE;
}
diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h
index 082110c6070..4827480e1a7 100644
--- a/src/mesa/tnl/t_context.h
+++ b/src/mesa/tnl/t_context.h
@@ -536,6 +536,9 @@ typedef struct
struct tnl_shine_tab *_ShineTable[2]; /**< Active shine tables */
struct tnl_shine_tab *_ShineTabList; /**< MRU list of inactive shine tables */
/**@}*/
+
+ /* The list of gl_vertex_array inputs. */
+ struct vbo_inputs draw_arrays;
} TNLcontext;
diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c
index b3142788892..96d6b988d3e 100644
--- a/src/mesa/tnl/t_draw.c
+++ b/src/mesa/tnl/t_draw.c
@@ -35,6 +35,7 @@
#include "main/mtypes.h"
#include "main/macros.h"
#include "main/enums.h"
+#include "main/varray.h"
#include "util/half_float.h"
#include "t_context.h"
@@ -422,9 +423,7 @@ static void unmap_vbos( 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.
+/* This is the main workhorse doing all the rendering work.
*/
void _tnl_draw_prims(struct gl_context *ctx,
const struct _mesa_prim *prim,
@@ -537,3 +536,40 @@ void _tnl_draw_prims(struct gl_context *ctx,
}
}
+
+void
+_tnl_bind_inputs( struct gl_context *ctx )
+{
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ _mesa_set_drawing_arrays(ctx, tnl->draw_arrays.inputs);
+ _vbo_update_inputs(ctx, &tnl->draw_arrays);
+}
+
+
+/* This is the main entrypoint into the slimmed-down software tnl
+ * module. In a regular swtnl driver, this can be plugged straight
+ * into the ctx->Driver.Draw() callback.
+ */
+void
+_tnl_draw(struct gl_context *ctx,
+ const struct _mesa_prim *prim, GLuint nr_prims,
+ const struct _mesa_index_buffer *ib,
+ GLboolean index_bounds_valid, GLuint min_index, GLuint max_index,
+ struct gl_transform_feedback_object *tfb_vertcount,
+ unsigned stream, struct gl_buffer_object *indirect)
+{
+ /* Update TNLcontext::draw_arrays and set that pointer
+ * into Array._DrawArrays.
+ */
+ _tnl_bind_inputs(ctx);
+
+ _tnl_draw_prims(ctx, prim, nr_prims, ib, index_bounds_valid,
+ min_index, max_index, tfb_vertcount, stream, indirect);
+}
+
+
+void
+_tnl_init_driver_draw_function(struct dd_function_table *functions)
+{
+ functions->Draw = _tnl_draw;
+}
diff --git a/src/mesa/tnl/tnl.h b/src/mesa/tnl/tnl.h
index 7f425a58d28..14e590501ef 100644
--- a/src/mesa/tnl/tnl.h
+++ b/src/mesa/tnl/tnl.h
@@ -48,6 +48,9 @@ _tnl_DestroyContext( struct gl_context *ctx );
extern void
_tnl_InvalidateState( struct gl_context *ctx, GLuint new_state );
+extern void
+_tnl_init_driver_draw_function(struct dd_function_table *functions);
+
/* Functions to revive the tnl module after being unhooked from
* dispatch and/or driver callbacks.
*/
@@ -60,6 +63,9 @@ _tnl_wakeup( struct gl_context *ctx );
extern void
_tnl_need_projected_coords( struct gl_context *ctx, GLboolean flag );
+extern void
+_tnl_bind_inputs( struct gl_context *ctx );
+
/* Control whether T&L does per-vertex fog
*/
@@ -87,6 +93,14 @@ _tnl_draw_prims(struct gl_context *ctx,
unsigned stream,
struct gl_buffer_object *indirect );
+void
+_tnl_draw(struct gl_context *ctx,
+ const struct _mesa_prim *prim, GLuint nr_prims,
+ const struct _mesa_index_buffer *ib,
+ GLboolean index_bounds_valid, GLuint min_index, GLuint max_index,
+ struct gl_transform_feedback_object *tfb_vertcount, unsigned stream,
+ struct gl_buffer_object *indirect);
+
extern void
_tnl_RasterPos(struct gl_context *ctx, const GLfloat vObj[4]);