st/mesa: remove _NEW_POLYGON dependency from vertex shader
We can just check the polygon mode when updating the edge flag state. Also, we can just flag ST_NEW_VERTEX_PROGRAM directly, which makes ST_NEW_EDGEFLAGS_DATA useless.
This commit is contained in:
@@ -132,18 +132,22 @@ 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, edgeflag_culls_prims;
|
||||
GLboolean vertdata_edgeflags, edgeflag_culls_prims, edgeflags_enabled;
|
||||
|
||||
if (!arrays)
|
||||
return;
|
||||
|
||||
vertdata_edgeflags = arrays[VERT_ATTRIB_EDGEFLAG]->StrideB != 0;
|
||||
edgeflags_enabled = st->ctx->Polygon.FrontMode != GL_FILL ||
|
||||
st->ctx->Polygon.BackMode != GL_FILL;
|
||||
|
||||
vertdata_edgeflags = edgeflags_enabled &&
|
||||
arrays[VERT_ATTRIB_EDGEFLAG]->StrideB != 0;
|
||||
if (vertdata_edgeflags != st->vertdata_edgeflags) {
|
||||
st->vertdata_edgeflags = vertdata_edgeflags;
|
||||
st->dirty.st |= ST_NEW_EDGEFLAGS_DATA;
|
||||
st->dirty.st |= ST_NEW_VERTEX_PROGRAM;
|
||||
}
|
||||
|
||||
edgeflag_culls_prims = !vertdata_edgeflags &&
|
||||
edgeflag_culls_prims = edgeflags_enabled && !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;
|
||||
|
@@ -141,11 +141,8 @@ update_vp( struct st_context *st )
|
||||
* edgeflag semantics, and extend the vertex shader to pass through
|
||||
* the input to the output. We'll need to use similar logic to set
|
||||
* up the extra vertex_element input for edgeflags.
|
||||
* _NEW_POLYGON, ST_NEW_EDGEFLAGS_DATA
|
||||
*/
|
||||
key.passthrough_edgeflags = (st->vertdata_edgeflags && (
|
||||
st->ctx->Polygon.FrontMode != GL_FILL ||
|
||||
st->ctx->Polygon.BackMode != GL_FILL));
|
||||
key.passthrough_edgeflags = st->vertdata_edgeflags;
|
||||
|
||||
key.clamp_color = st->clamp_vert_color_in_shader &&
|
||||
st->ctx->Light._ClampVertexColor;
|
||||
@@ -164,8 +161,8 @@ update_vp( struct st_context *st )
|
||||
const struct st_tracked_state st_update_vp = {
|
||||
"st_update_vp", /* name */
|
||||
{ /* dirty */
|
||||
_NEW_POLYGON, /* mesa */
|
||||
ST_NEW_VERTEX_PROGRAM | ST_NEW_EDGEFLAGS_DATA /* st */
|
||||
0, /* mesa */
|
||||
ST_NEW_VERTEX_PROGRAM /* st */
|
||||
},
|
||||
update_vp /* update */
|
||||
};
|
||||
|
@@ -47,7 +47,7 @@ struct u_upload_mgr;
|
||||
#define ST_NEW_FRAGMENT_PROGRAM (1 << 1)
|
||||
#define ST_NEW_VERTEX_PROGRAM (1 << 2)
|
||||
#define ST_NEW_FRAMEBUFFER (1 << 3)
|
||||
#define ST_NEW_EDGEFLAGS_DATA (1 << 4)
|
||||
/* gap, re-use it */
|
||||
#define ST_NEW_GEOMETRY_PROGRAM (1 << 5)
|
||||
#define ST_NEW_VERTEX_ARRAYS (1 << 6)
|
||||
#define ST_NEW_RASTERIZER (1 << 7)
|
||||
|
Reference in New Issue
Block a user