diff options
Diffstat (limited to 'mesalib/src/mesa/state_tracker')
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_atom.c | 22 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_atom_rasterizer.c | 8 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_atom_shader.c | 9 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_context.h | 3 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_draw.c | 10 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_gen_mipmap.c | 3 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_program.c | 4 |
7 files changed, 33 insertions, 26 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_atom.c b/mesalib/src/mesa/state_tracker/st_atom.c index 32ce1eaaa..99e9df26b 100644 --- a/mesalib/src/mesa/state_tracker/st_atom.c +++ b/mesalib/src/mesa/state_tracker/st_atom.c @@ -132,16 +132,26 @@ 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 vertDataEdgeFlags; + GLboolean vertdata_edgeflags, edgeflag_culls_prims, edgeflags_enabled; if (!arrays) return; - vertDataEdgeFlags = arrays[VERT_ATTRIB_EDGEFLAG]->BufferObj && - arrays[VERT_ATTRIB_EDGEFLAG]->BufferObj->Name; - if (vertDataEdgeFlags != st->vertdata_edgeflags) { - st->vertdata_edgeflags = vertDataEdgeFlags; - st->dirty.st |= ST_NEW_EDGEFLAGS_DATA; + 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_VERTEX_PROGRAM; + } + + 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; + st->dirty.st |= ST_NEW_RASTERIZER; } } diff --git a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c index a4f3ffee3..ee5e9e574 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c @@ -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; diff --git a/mesalib/src/mesa/state_tracker/st_atom_shader.c b/mesalib/src/mesa/state_tracker/st_atom_shader.c index ba04c1fb7..67c615713 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_shader.c +++ b/mesalib/src/mesa/state_tracker/st_atom_shader.c @@ -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 */ }; diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h index 9c699a015..0e00dd4fa 100644 --- a/mesalib/src/mesa/state_tracker/st_context.h +++ b/mesalib/src/mesa/state_tracker/st_context.h @@ -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) @@ -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; diff --git a/mesalib/src/mesa/state_tracker/st_draw.c b/mesalib/src/mesa/state_tracker/st_draw.c index 355c180f8..dba5870a0 100644 --- a/mesalib/src/mesa/state_tracker/st_draw.c +++ b/mesalib/src/mesa/state_tracker/st_draw.c @@ -164,16 +164,6 @@ translate_prim(const struct gl_context *ctx, unsigned prim) STATIC_ASSERT(GL_QUADS == PIPE_PRIM_QUADS); STATIC_ASSERT(GL_TRIANGLE_STRIP_ADJACENCY == PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY); - /* Avoid quadstrips if it's easy to do so: - * Note: it's important to do the correct trimming if we change the - * prim type! We do that wherever this function is called. - */ - if (prim == GL_QUAD_STRIP && - ctx->Light.ShadeModel != GL_FLAT && - ctx->Polygon.FrontMode == GL_FILL && - ctx->Polygon.BackMode == GL_FILL) - prim = GL_TRIANGLE_STRIP; - return prim; } diff --git a/mesalib/src/mesa/state_tracker/st_gen_mipmap.c b/mesalib/src/mesa/state_tracker/st_gen_mipmap.c index 04333f75e..b615575b5 100644 --- a/mesalib/src/mesa/state_tracker/st_gen_mipmap.c +++ b/mesalib/src/mesa/state_tracker/st_gen_mipmap.c @@ -221,7 +221,8 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target, else { dstHeight = u_minify(pt->height0, dstLevel); } - if (texObj->Target == GL_TEXTURE_2D_ARRAY) { + if (texObj->Target == GL_TEXTURE_2D_ARRAY || + texObj->Target == GL_TEXTURE_CUBE_MAP_ARRAY) { dstDepth = pt->array_size; } else { diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c index e9074ac97..692a57008 100644 --- a/mesalib/src/mesa/state_tracker/st_program.c +++ b/mesalib/src/mesa/state_tracker/st_program.c @@ -342,14 +342,14 @@ st_translate_vertex_program(struct st_context *st, stvp->glsl_to_tgsi, &stvp->Base.Base, /* inputs */ - stvp->num_inputs, + vpv->num_inputs, stvp->input_to_index, NULL, /* input semantic name */ NULL, /* input semantic index */ NULL, /* interp mode */ NULL, /* is centroid */ /* outputs */ - stvp->num_outputs, + num_outputs, stvp->result_to_output, stvp->output_semantic_name, stvp->output_semantic_index, |