Skip to content
Snippets Groups Projects
Commit e55c545d authored by Keith Whitwell's avatar Keith Whitwell
Browse files

Get edgeflag/unfilled polygons working.

Don't allow more vertices in a vertex list than ctx->Const.MaxArrayLockSize.
parent b101554d
No related branches found
No related tags found
No related merge requests found
......@@ -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] );
}
}
......
......@@ -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;
};
......
......@@ -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;
......
......@@ -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.
......
......@@ -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;
......
......@@ -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
......@@ -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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment