st/mesa: implement zero-stride edge flag by culling primitives

This was unimplemented.
This commit is contained in:
Marek Olšák
2014-03-04 01:11:49 +01:00
parent 3d42696d10
commit 4e634c5240
3 changed files with 17 additions and 1 deletions
+8 -1
View File
@@ -132,7 +132,7 @@ static void check_program_state( struct st_context *st )
static void check_attrib_edgeflag(struct st_context *st)
{
const struct gl_client_array **arrays = st->ctx->Array._DrawArrays;
GLboolean vertdata_edgeflags;
GLboolean vertdata_edgeflags, edgeflag_culls_prims;
if (!arrays)
return;
@@ -142,6 +142,13 @@ static void check_attrib_edgeflag(struct st_context *st)
st->vertdata_edgeflags = vertdata_edgeflags;
st->dirty.st |= ST_NEW_EDGEFLAGS_DATA;
}
edgeflag_culls_prims = !vertdata_edgeflags &&
!st->ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0];
if (edgeflag_culls_prims != st->edgeflag_culls_prims) {
st->edgeflag_culls_prims = edgeflag_culls_prims;
st->dirty.st |= ST_NEW_RASTERIZER;
}
}
@@ -236,6 +236,14 @@ static void update_raster_state( struct st_context *st )
/* ST_NEW_RASTERIZER */
raster->rasterizer_discard = ctx->RasterDiscard;
if (st->edgeflag_culls_prims) {
/* All edge flags are FALSE. Cull the affected faces. */
if (raster->fill_front != PIPE_POLYGON_MODE_FILL)
raster->cull_face |= PIPE_FACE_FRONT;
if (raster->fill_back != PIPE_POLYGON_MODE_FILL)
raster->cull_face |= PIPE_FACE_BACK;
}
/* _NEW_TRANSFORM */
raster->depth_clip = ctx->Transform.DepthClamp == GL_FALSE;
raster->clip_plane_enable = ctx->Transform.ClipPlanesEnabled;
+1
View File
@@ -131,6 +131,7 @@ struct st_context
GLboolean missing_textures;
GLboolean vertdata_edgeflags;
GLboolean edgeflag_culls_prims;
/** Mapping from VARYING_SLOT_x to post-transformed vertex slot */
const GLuint *vertex_result_to_slot;