tnl: Push down the gl_vertex_array inputs into tnl drivers.
Reviewed-by: Brian Paul <brianp@vmware.com> Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
This commit is contained in:

committed by
Mathias Fröhlich

parent
7f8db5ca47
commit
784fdef4e7
@@ -380,6 +380,7 @@ void
|
|||||||
intelInitDriverFunctions(struct dd_function_table *functions)
|
intelInitDriverFunctions(struct dd_function_table *functions)
|
||||||
{
|
{
|
||||||
_mesa_init_driver_functions(functions);
|
_mesa_init_driver_functions(functions);
|
||||||
|
_tnl_init_driver_draw_function(functions);
|
||||||
|
|
||||||
functions->Flush = intel_glFlush;
|
functions->Flush = intel_glFlush;
|
||||||
functions->Finish = intelFinish;
|
functions->Finish = intelFinish;
|
||||||
|
@@ -969,8 +969,8 @@ brw_draw_prims(struct gl_context *ctx,
|
|||||||
_mesa_enum_to_string(ctx->RenderMode));
|
_mesa_enum_to_string(ctx->RenderMode));
|
||||||
_swsetup_Wakeup(ctx);
|
_swsetup_Wakeup(ctx);
|
||||||
_tnl_wakeup(ctx);
|
_tnl_wakeup(ctx);
|
||||||
_tnl_draw_prims(ctx, prims, nr_prims, ib,
|
_tnl_draw(ctx, prims, nr_prims, ib,
|
||||||
index_bounds_valid, min_index, max_index, NULL, 0, NULL);
|
index_bounds_valid, min_index, max_index, NULL, 0, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -119,6 +119,7 @@ nouveau_context_init(struct gl_context *ctx, gl_api api,
|
|||||||
|
|
||||||
/* Initialize the function pointers. */
|
/* Initialize the function pointers. */
|
||||||
_mesa_init_driver_functions(&functions);
|
_mesa_init_driver_functions(&functions);
|
||||||
|
_tnl_init_driver_draw_function(&functions);
|
||||||
nouveau_driver_functions_init(&functions);
|
nouveau_driver_functions_init(&functions);
|
||||||
nouveau_bufferobj_functions_init(&functions);
|
nouveau_bufferobj_functions_init(&functions);
|
||||||
nouveau_texture_functions_init(&functions);
|
nouveau_texture_functions_init(&functions);
|
||||||
|
@@ -537,6 +537,24 @@ TAG(vbo_check_render_prims)(struct gl_context *ctx,
|
|||||||
tfb_vertcount, stream, indirect);
|
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
|
void
|
||||||
TAG(vbo_init)(struct gl_context *ctx)
|
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++)
|
for (i = 0; i < VERT_ATTRIB_MAX; i++)
|
||||||
render->map[i] = -1;
|
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);
|
vbo_use_buffer_objects(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -227,6 +227,7 @@ GLboolean r200CreateContext( gl_api api,
|
|||||||
* (the texture functions are especially important)
|
* (the texture functions are especially important)
|
||||||
*/
|
*/
|
||||||
_mesa_init_driver_functions(&functions);
|
_mesa_init_driver_functions(&functions);
|
||||||
|
_tnl_init_driver_draw_function(&functions);
|
||||||
r200InitDriverFuncs(&functions);
|
r200InitDriverFuncs(&functions);
|
||||||
r200InitIoctlFuncs(&functions);
|
r200InitIoctlFuncs(&functions);
|
||||||
r200InitStateFuncs(&rmesa->radeon, &functions);
|
r200InitStateFuncs(&rmesa->radeon, &functions);
|
||||||
|
@@ -194,6 +194,7 @@ r100CreateContext( gl_api api,
|
|||||||
* (the texture functions are especially important)
|
* (the texture functions are especially important)
|
||||||
*/
|
*/
|
||||||
_mesa_init_driver_functions( &functions );
|
_mesa_init_driver_functions( &functions );
|
||||||
|
_tnl_init_driver_draw_function( &functions );
|
||||||
radeonInitTextureFuncs( &rmesa->radeon, &functions );
|
radeonInitTextureFuncs( &rmesa->radeon, &functions );
|
||||||
radeonInitQueryObjFunctions(&functions);
|
radeonInitQueryObjFunctions(&functions);
|
||||||
|
|
||||||
|
@@ -783,6 +783,7 @@ dri_create_context(gl_api api,
|
|||||||
/* build table of device driver functions */
|
/* build table of device driver functions */
|
||||||
_mesa_init_driver_functions(&functions);
|
_mesa_init_driver_functions(&functions);
|
||||||
swrast_init_driver_functions(&functions);
|
swrast_init_driver_functions(&functions);
|
||||||
|
_tnl_init_driver_draw_function(&functions);
|
||||||
|
|
||||||
if (share) {
|
if (share) {
|
||||||
sharedCtx = &share->Base;
|
sharedCtx = &share->Base;
|
||||||
|
@@ -832,6 +832,7 @@ OSMesaCreateContextAttribs(const int *attribList, OSMesaContext sharelist)
|
|||||||
|
|
||||||
/* Initialize device driver function table */
|
/* Initialize device driver function table */
|
||||||
_mesa_init_driver_functions(&functions);
|
_mesa_init_driver_functions(&functions);
|
||||||
|
_tnl_init_driver_draw_function(&functions);
|
||||||
/* override with our functions */
|
/* override with our functions */
|
||||||
functions.GetString = get_string;
|
functions.GetString = get_string;
|
||||||
functions.UpdateState = osmesa_update_state_wrapper;
|
functions.UpdateState = osmesa_update_state_wrapper;
|
||||||
|
@@ -906,6 +906,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
|
|||||||
|
|
||||||
/* initialize with default driver functions, then plug in XMesa funcs */
|
/* initialize with default driver functions, then plug in XMesa funcs */
|
||||||
_mesa_init_driver_functions(&functions);
|
_mesa_init_driver_functions(&functions);
|
||||||
|
_tnl_init_driver_draw_function(&functions);
|
||||||
xmesa_init_driver_functions(v, &functions);
|
xmesa_init_driver_functions(v, &functions);
|
||||||
if (!_mesa_initialize_context(mesaCtx, API_OPENGL_COMPAT, &v->mesa_visual,
|
if (!_mesa_initialize_context(mesaCtx, API_OPENGL_COMPAT, &v->mesa_visual,
|
||||||
share_list ? &(share_list->mesa) : (struct gl_context *) NULL,
|
share_list ? &(share_list->mesa) : (struct gl_context *) NULL,
|
||||||
|
@@ -96,12 +96,12 @@ _tnl_CreateContext( struct gl_context *ctx )
|
|||||||
insert_at_tail( tnl->_ShineTabList, s );
|
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_transformation();
|
||||||
_math_init_translate();
|
_math_init_translate();
|
||||||
|
|
||||||
|
/* Keep our list of gl_vertex_array inputs */
|
||||||
|
_vbo_init_inputs(&tnl->draw_arrays);
|
||||||
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -536,6 +536,9 @@ typedef struct
|
|||||||
struct tnl_shine_tab *_ShineTable[2]; /**< Active shine tables */
|
struct tnl_shine_tab *_ShineTable[2]; /**< Active shine tables */
|
||||||
struct tnl_shine_tab *_ShineTabList; /**< MRU list of inactive 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;
|
} TNLcontext;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -35,6 +35,7 @@
|
|||||||
#include "main/mtypes.h"
|
#include "main/mtypes.h"
|
||||||
#include "main/macros.h"
|
#include "main/macros.h"
|
||||||
#include "main/enums.h"
|
#include "main/enums.h"
|
||||||
|
#include "main/varray.h"
|
||||||
#include "util/half_float.h"
|
#include "util/half_float.h"
|
||||||
|
|
||||||
#include "t_context.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
|
/* This is the main workhorse doing all the rendering work.
|
||||||
* 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,
|
void _tnl_draw_prims(struct gl_context *ctx,
|
||||||
const struct _mesa_prim *prim,
|
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;
|
||||||
|
}
|
||||||
|
@@ -48,6 +48,9 @@ _tnl_DestroyContext( struct gl_context *ctx );
|
|||||||
extern void
|
extern void
|
||||||
_tnl_InvalidateState( struct gl_context *ctx, GLuint new_state );
|
_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
|
/* Functions to revive the tnl module after being unhooked from
|
||||||
* dispatch and/or driver callbacks.
|
* dispatch and/or driver callbacks.
|
||||||
*/
|
*/
|
||||||
@@ -60,6 +63,9 @@ _tnl_wakeup( struct gl_context *ctx );
|
|||||||
extern void
|
extern void
|
||||||
_tnl_need_projected_coords( struct gl_context *ctx, GLboolean flag );
|
_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
|
/* Control whether T&L does per-vertex fog
|
||||||
*/
|
*/
|
||||||
@@ -87,6 +93,14 @@ _tnl_draw_prims(struct gl_context *ctx,
|
|||||||
unsigned stream,
|
unsigned stream,
|
||||||
struct gl_buffer_object *indirect );
|
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
|
extern void
|
||||||
_tnl_RasterPos(struct gl_context *ctx, const GLfloat vObj[4]);
|
_tnl_RasterPos(struct gl_context *ctx, const GLfloat vObj[4]);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user