aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i915/intel_context.c1
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw.c4
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_context.c1
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c21
-rw-r--r--src/mesa/drivers/dri/r200/r200_context.c1
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_context.c1
-rw-r--r--src/mesa/drivers/dri/swrast/swrast.c1
-rw-r--r--src/mesa/drivers/osmesa/osmesa.c1
-rw-r--r--src/mesa/drivers/x11/xm_api.c1
-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
13 files changed, 88 insertions, 9 deletions
diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c
index 96d09ca9472..f22ebbd7ac2 100644
--- a/src/mesa/drivers/dri/i915/intel_context.c
+++ b/src/mesa/drivers/dri/i915/intel_context.c
@@ -380,6 +380,7 @@ void
intelInitDriverFunctions(struct dd_function_table *functions)
{
_mesa_init_driver_functions(functions);
+ _tnl_init_driver_draw_function(functions);
functions->Flush = intel_glFlush;
functions->Finish = intelFinish;
diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
index 5f52404bd6e..4caaadd560d 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -969,8 +969,8 @@ brw_draw_prims(struct gl_context *ctx,
_mesa_enum_to_string(ctx->RenderMode));
_swsetup_Wakeup(ctx);
_tnl_wakeup(ctx);
- _tnl_draw_prims(ctx, prims, nr_prims, ib,
- index_bounds_valid, min_index, max_index, NULL, 0, NULL);
+ _tnl_draw(ctx, prims, nr_prims, ib,
+ index_bounds_valid, min_index, max_index, NULL, 0, NULL);
return;
}
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 5fab81d8663..93f6ce473a1 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -119,6 +119,7 @@ nouveau_context_init(struct gl_context *ctx, gl_api api,
/* Initialize the function pointers. */
_mesa_init_driver_functions(&functions);
+ _tnl_init_driver_draw_function(&functions);
nouveau_driver_functions_init(&functions);
nouveau_bufferobj_functions_init(&functions);
nouveau_texture_functions_init(&functions);
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
index a7b911c50ea..10b5c15e41d 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
@@ -537,6 +537,24 @@ TAG(vbo_check_render_prims)(struct gl_context *ctx,
tfb_vertcount, stream, indirect);
}
+static void
+TAG(vbo_draw)(struct gl_context *ctx,
+ const struct _mesa_prim *prims, 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)
+{
+ /* Borrow and update the inputs list from the tnl context */
+ _tnl_bind_inputs(ctx);
+
+ TAG(vbo_check_render_prims)(ctx, prims, nr_prims, ib,
+ index_bounds_valid, min_index, max_index,
+ tfb_vertcount, stream, indirect);
+}
+
void
TAG(vbo_init)(struct gl_context *ctx)
{
@@ -546,7 +564,8 @@ TAG(vbo_init)(struct gl_context *ctx)
for (i = 0; i < VERT_ATTRIB_MAX; i++)
render->map[i] = -1;
- vbo_set_draw_func(ctx, TAG(vbo_check_render_prims));
+ /* Overwrite our draw function */
+ ctx->Driver.Draw = TAG(vbo_draw);
vbo_use_buffer_objects(ctx);
}
diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c
index eb7d92f3c60..4524f06d10c 100644
--- a/src/mesa/drivers/dri/r200/r200_context.c
+++ b/src/mesa/drivers/dri/r200/r200_context.c
@@ -227,6 +227,7 @@ GLboolean r200CreateContext( gl_api api,
* (the texture functions are especially important)
*/
_mesa_init_driver_functions(&functions);
+ _tnl_init_driver_draw_function(&functions);
r200InitDriverFuncs(&functions);
r200InitIoctlFuncs(&functions);
r200InitStateFuncs(&rmesa->radeon, &functions);
diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c
index 8c5c1671996..28ced814e59 100644
--- a/src/mesa/drivers/dri/radeon/radeon_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_context.c
@@ -194,6 +194,7 @@ r100CreateContext( gl_api api,
* (the texture functions are especially important)
*/
_mesa_init_driver_functions( &functions );
+ _tnl_init_driver_draw_function( &functions );
radeonInitTextureFuncs( &rmesa->radeon, &functions );
radeonInitQueryObjFunctions(&functions);
diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
index 8084be64393..ae5874f5927 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -783,6 +783,7 @@ dri_create_context(gl_api api,
/* build table of device driver functions */
_mesa_init_driver_functions(&functions);
swrast_init_driver_functions(&functions);
+ _tnl_init_driver_draw_function(&functions);
if (share) {
sharedCtx = &share->Base;
diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c
index e0f87b850a7..3423eb63236 100644
--- a/src/mesa/drivers/osmesa/osmesa.c
+++ b/src/mesa/drivers/osmesa/osmesa.c
@@ -832,6 +832,7 @@ OSMesaCreateContextAttribs(const int *attribList, OSMesaContext sharelist)
/* Initialize device driver function table */
_mesa_init_driver_functions(&functions);
+ _tnl_init_driver_draw_function(&functions);
/* override with our functions */
functions.GetString = get_string;
functions.UpdateState = osmesa_update_state_wrapper;
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index 069e9e12b98..3d54193580e 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -906,6 +906,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
/* initialize with default driver functions, then plug in XMesa funcs */
_mesa_init_driver_functions(&functions);
+ _tnl_init_driver_draw_function(&functions);
xmesa_init_driver_functions(v, &functions);
if (!_mesa_initialize_context(mesaCtx, API_OPENGL_COMPAT, &v->mesa_visual,
share_list ? &(share_list->mesa) : (struct gl_context *) NULL,
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]);