diff options
author | Keith Whitwell <[email protected]> | 2003-10-10 19:19:50 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2003-10-10 19:19:50 +0000 |
commit | e55c545d4ae20b3e30b73bc5a7c7582a9755b25e (patch) | |
tree | 405a5342cb885f8d24b65315998ff482bb3922cd /src | |
parent | b101554d167e2b57d986f0c143a1a34c95308dfe (diff) |
Get edgeflag/unfilled polygons working.
Don't allow more vertices in a vertex list than ctx->Const.MaxArrayLockSize.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/tnl/t_context.c | 11 | ||||
-rw-r--r-- | src/mesa/tnl/t_context.h | 1 | ||||
-rw-r--r-- | src/mesa/tnl/t_save_api.c | 3 | ||||
-rw-r--r-- | src/mesa/tnl/t_save_playback.c | 14 | ||||
-rw-r--r-- | src/mesa/tnl/t_vtx_api.c | 3 | ||||
-rw-r--r-- | src/mesa/tnl/t_vtx_api.h | 4 | ||||
-rw-r--r-- | src/mesa/tnl/t_vtx_exec.c | 36 |
7 files changed, 54 insertions, 18 deletions
diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c index 4b9ee1d8add..a139510d26f 100644 --- a/src/mesa/tnl/t_context.c +++ b/src/mesa/tnl/t_context.c @@ -81,8 +81,7 @@ _tnl_CreateContext( GLcontext *ctx ) /* Initialize the VB. */ - tnl->vb.Size = MAX2( 256, - ctx->Const.MaxArrayLockSize + MAX_CLIPPED_VERTICES); + tnl->vb.Size = ctx->Const.MaxArrayLockSize + MAX_CLIPPED_VERTICES; /* Initialize tnl state and tnl->vtxfmt. @@ -105,15 +104,13 @@ _tnl_CreateContext( GLcontext *ctx ) /* Set a few default values in the driver struct. */ install_driver_callbacks(ctx); - ctx->Driver.NeedFlush = FLUSH_UPDATE_CURRENT; + ctx->Driver.NeedFlush = 0; ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END; ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts; tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts; tnl->Driver.NotifyMaterialChange = _mesa_validate_all_lighting_tables; - - return GL_TRUE; } @@ -173,9 +170,9 @@ _tnl_wakeup_exec( GLcontext *ctx ) tnl->pipeline.run_input_changes = ~0; if (ctx->Light.ColorMaterialEnabled) { - _mesa_update_color_material( ctx, ctx->Current.Attrib[VERT_ATTRIB_COLOR0] ); + _mesa_update_color_material( ctx, + ctx->Current.Attrib[VERT_ATTRIB_COLOR0] ); } - } diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h index 6d0b8a863c6..71825084268 100644 --- a/src/mesa/tnl/t_context.h +++ b/src/mesa/tnl/t_context.h @@ -254,6 +254,7 @@ struct tnl_vtx { struct tnl_copied_vtx copied; attrfv_func tabfv[_TNL_ATTRIB_MAX][4]; struct tnl_eval eval; + GLboolean *edgeflag_tmp; }; diff --git a/src/mesa/tnl/t_save_api.c b/src/mesa/tnl/t_save_api.c index 27685b558b7..f72cde2fe4a 100644 --- a/src/mesa/tnl/t_save_api.c +++ b/src/mesa/tnl/t_save_api.c @@ -183,6 +183,9 @@ static void _save_reset_counters( GLcontext *ctx ) else tnl->save.initial_counter = 0; + if (tnl->save.initial_counter > ctx->Const.MaxArrayLockSize ) + tnl->save.initial_counter = ctx->Const.MaxArrayLockSize; + tnl->save.counter = tnl->save.initial_counter; tnl->save.prim_count = 0; tnl->save.prim_max = SAVE_PRIM_SIZE - tnl->save.prim_store->used; diff --git a/src/mesa/tnl/t_save_playback.c b/src/mesa/tnl/t_save_playback.c index a1949a1ce31..deb404f483d 100644 --- a/src/mesa/tnl/t_save_playback.c +++ b/src/mesa/tnl/t_save_playback.c @@ -91,11 +91,15 @@ static void _tnl_bind_vertex_list( GLcontext *ctx, /* Copy edgeflag to a contiguous array */ - if (node->attrsz[_TNL_ATTRIB_EDGEFLAG]) { - VB->EdgeFlag = _tnl_translate_edgeflag( ctx, data, - node->count, - node->vertex_size ); - data++; + if (ctx->Polygon.FrontMode != GL_FILL || ctx->Polygon.BackMode != GL_FILL) { + if (node->attrsz[_TNL_ATTRIB_EDGEFLAG]) { + VB->EdgeFlag = _tnl_translate_edgeflag( ctx, data, + node->count, + node->vertex_size ); + data++; + } + else + VB->EdgeFlag = _tnl_import_current_edgeflag( ctx, node->count ); } /* Legacy pointers -- remove one day. diff --git a/src/mesa/tnl/t_vtx_api.c b/src/mesa/tnl/t_vtx_api.c index 301271ea34a..aaa17c20509 100644 --- a/src/mesa/tnl/t_vtx_api.c +++ b/src/mesa/tnl/t_vtx_api.c @@ -186,7 +186,8 @@ static void _tnl_wrap_upgrade_vertex( GLcontext *ctx, tnl->vtx.attrsz[attr] = newsz; tnl->vtx.vertex_size += newsz - oldsz; - tnl->vtx.counter = VERT_BUFFER_SIZE / tnl->vtx.vertex_size; + tnl->vtx.counter = MIN2( VERT_BUFFER_SIZE / tnl->vtx.vertex_size, + ctx->Const.MaxArrayLockSize ); tnl->vtx.initial_counter = tnl->vtx.counter; tnl->vtx.vbptr = tnl->vtx.buffer; diff --git a/src/mesa/tnl/t_vtx_api.h b/src/mesa/tnl/t_vtx_api.h index 98ee617b69b..25003202132 100644 --- a/src/mesa/tnl/t_vtx_api.h +++ b/src/mesa/tnl/t_vtx_api.h @@ -51,4 +51,8 @@ extern GLboolean *_tnl_translate_edgeflag( GLcontext *ctx, const GLfloat *data, GLuint count, GLuint stride ); + +extern GLboolean *_tnl_import_current_edgeflag( GLcontext *ctx, + GLuint count ); + #endif diff --git a/src/mesa/tnl/t_vtx_exec.c b/src/mesa/tnl/t_vtx_exec.c index d4dceed2dd2..13129d74d35 100644 --- a/src/mesa/tnl/t_vtx_exec.c +++ b/src/mesa/tnl/t_vtx_exec.c @@ -37,8 +37,12 @@ GLboolean *_tnl_translate_edgeflag( GLcontext *ctx, const GLfloat *data, GLuint count, GLuint stride ) { - GLboolean *ef = 0; + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLboolean *ef = tnl->vtx.edgeflag_tmp; GLuint i; + + if (!ef) + ef = tnl->vtx.edgeflag_tmp = MALLOC( tnl->vb.Size ); for (i = 0 ; i < count ; i++, data += stride) ef[i] = (data[0] == 1.0); @@ -46,6 +50,24 @@ GLboolean *_tnl_translate_edgeflag( GLcontext *ctx, const GLfloat *data, return ef; } + +GLboolean *_tnl_import_current_edgeflag( GLcontext *ctx, + GLuint count ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLboolean *ef = tnl->vtx.edgeflag_tmp; + GLboolean tmp = ctx->Current.EdgeFlag; + GLuint i; + + if (!ef) + ef = tnl->vtx.edgeflag_tmp = MALLOC( tnl->vb.Size ); + + for (i = 0 ; i < count ; i++) + ef[i] = tmp; + + return ef; +} + static GLint get_size( const GLfloat *f ) { if (f[3] != 1.0) return 4; @@ -103,10 +125,14 @@ static void _tnl_vb_bind_vtx( GLcontext *ctx ) /* Copy and translate EdgeFlag to a contiguous array of GLbooleans */ - if (tnl->vtx.attrsz[_TNL_ATTRIB_EDGEFLAG]) { - VB->EdgeFlag = _tnl_translate_edgeflag( ctx, data, count, - tnl->vtx.vertex_size ); - data++; + if (ctx->Polygon.FrontMode != GL_FILL || ctx->Polygon.BackMode != GL_FILL) { + if (tnl->vtx.attrsz[_TNL_ATTRIB_EDGEFLAG]) { + VB->EdgeFlag = _tnl_translate_edgeflag( ctx, data, count, + tnl->vtx.vertex_size ); + data++; + } + else + VB->EdgeFlag = _tnl_import_current_edgeflag( ctx, count ); } /* Legacy pointers -- remove one day. |