[Mesa-dev] [PATCH] mesa/gallium: Signal _NEW_TRANSFORM from glClipControl.
Marek Olšák
maraeo at gmail.com
Tue Oct 28 14:00:48 PDT 2014
Yes, thanks!
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Marek
On Sat, Oct 25, 2014 at 10:42 AM, <Mathias.Froehlich at gmx.net> wrote:
> From: Mathias Fröhlich <Mathias.Froehlich at gmx.net>
>
> Hi Marek,
>
> Did you have something like below in mind?
>
> Mathias
>
>
> This removes the need for the gallium rasterizer state
> to listen to viewport changes.
> Thanks to Marek Olšák <maraeo at gmail.com>.
>
> CC: Marek Olšák <maraeo at gmail.com>
> Signed-off-by: Mathias Froehlich <Mathias.Froehlich at web.de>
> ---
> src/mesa/main/viewport.c | 8 ++------
> src/mesa/state_tracker/st_atom_rasterizer.c | 11 ++++-------
> 2 files changed, 6 insertions(+), 13 deletions(-)
>
> diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c
> index d6a9e29..0adce9c 100644
> --- a/src/mesa/main/viewport.c
> +++ b/src/mesa/main/viewport.c
> @@ -459,15 +459,14 @@ _mesa_ClipControl(GLenum origin, GLenum depth)
> ctx->Transform.ClipDepthMode == depth)
> return;
>
> - FLUSH_VERTICES(ctx, 0);
> + /* Affects transform state and the viewport transform */
> + FLUSH_VERTICES(ctx, _NEW_TRANSFORM | _NEW_VIEWPORT);
>
> if (ctx->Transform.ClipOrigin != origin) {
> ctx->Transform.ClipOrigin = origin;
>
> /* Affects the winding order of the front face. */
> ctx->NewState |= _NEW_POLYGON;
> - /* Affects the y component of the viewport transform. */
> - ctx->NewState |= _NEW_VIEWPORT;
>
> if (ctx->Driver.FrontFace)
> ctx->Driver.FrontFace(ctx, ctx->Polygon.FrontFace);
> @@ -476,9 +475,6 @@ _mesa_ClipControl(GLenum origin, GLenum depth)
> if (ctx->Transform.ClipDepthMode != depth) {
> ctx->Transform.ClipDepthMode = depth;
>
> - /* Affects the z part of the viewpoint transform. */
> - ctx->NewState |= _NEW_VIEWPORT;
> -
> if (ctx->Driver.DepthRange)
> ctx->Driver.DepthRange(ctx);
> }
> diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c
> index 5020978..606f19a 100644
> --- a/src/mesa/state_tracker/st_atom_rasterizer.c
> +++ b/src/mesa/state_tracker/st_atom_rasterizer.c
> @@ -72,7 +72,7 @@ static void update_raster_state( struct st_context *st )
> {
> raster->front_ccw = (ctx->Polygon.FrontFace == GL_CCW);
>
> - /* _NEW_VIEWPORT */
> + /* _NEW_TRANSFORM */
> if (ctx->Transform.ClipOrigin == GL_UPPER_LEFT) {
> raster->front_ccw ^= 1;
> }
> @@ -246,13 +246,10 @@ static void update_raster_state( struct st_context *st )
> raster->half_pixel_center = 1;
> if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP)
> raster->bottom_edge_rule = 1;
> - /* _NEW_VIEWPORT */
> + /* _NEW_TRANSFORM */
> if (ctx->Transform.ClipOrigin == GL_UPPER_LEFT)
> raster->bottom_edge_rule ^= 1;
>
> - /* _NEW_VIEWPORT */
> - raster->clip_halfz = (ctx->Transform.ClipDepthMode == GL_ZERO_TO_ONE);
> -
> /* ST_NEW_RASTERIZER */
> raster->rasterizer_discard = ctx->RasterDiscard;
>
> @@ -267,6 +264,7 @@ static void update_raster_state( struct st_context *st )
> /* _NEW_TRANSFORM */
> raster->depth_clip = !ctx->Transform.DepthClamp;
> raster->clip_plane_enable = ctx->Transform.ClipPlanesEnabled;
> + raster->clip_halfz = (ctx->Transform.ClipDepthMode == GL_ZERO_TO_ONE);
>
> cso_set_rasterizer(st->cso_context, raster);
> }
> @@ -283,8 +281,7 @@ const struct st_tracked_state st_update_rasterizer = {
> _NEW_PROGRAM |
> _NEW_SCISSOR |
> _NEW_FRAG_CLAMP |
> - _NEW_TRANSFORM |
> - _NEW_VIEWPORT), /* mesa state dependencies*/
> + _NEW_TRANSFORM), /* mesa state dependencies*/
> (ST_NEW_VERTEX_PROGRAM |
> ST_NEW_RASTERIZER), /* state tracker dependencies */
> },
> --
> 1.9.3
>
More information about the mesa-dev
mailing list