[Mesa-dev] Mesa (master): i965: Remove linear_color for GL_PERSPECTIVE_CORRECTION_HINT .

Ian Romanick idr at freedesktop.org
Thu May 26 11:39:36 PDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/26/2011 10:08 AM, Eric Anholt wrote:
> Module: Mesa
> Branch: master
> Commit: f147599ef4b0d14c25a7e0d3f9f1c9b0229bb6fc
> URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f147599ef4b0d14c25a7e0d3f9f1c9b0229bb6fc
> 
> Author: Eric Anholt <eric at anholt.net>
> Date:   Thu May 19 08:48:42 2011 -0700
> 
> i965: Remove linear_color for GL_PERSPECTIVE_CORRECTION_HINT.
> 
> From the GL 2.1 spec:
> 
>    "Required perspective-correct interpolation for all fragment
>     attributes except depth in sections 3.4.1 and 3.5.1, effectively
>     making GL PERSPECTIVE CORRECT HINT a no-op."
> 
> Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

We'll need this added back in order to support the GLSL 1.30
noperspective interpolation qualifier.  Removing the dependency on the
silly hint is fine, but we still need to be able to do linear
interpolation of varyings.

> ---
> 
>  src/mesa/drivers/dri/i965/brw_fs.cpp    |    2 +-
>  src/mesa/drivers/dri/i965/brw_sf.c      |    3 ---
>  src/mesa/drivers/dri/i965/brw_sf.h      |    1 -
>  src/mesa/drivers/dri/i965/brw_sf_emit.c |    2 +-
>  src/mesa/drivers/dri/i965/brw_wm.c      |    4 ----
>  src/mesa/drivers/dri/i965/brw_wm.h      |    1 -
>  src/mesa/drivers/dri/i965/brw_wm_fp.c   |   27 ++++++++-------------------
>  7 files changed, 10 insertions(+), 30 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index a4adb17..c022378 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -584,7 +584,7 @@ fs_visitor::emit_general_interpolation(ir_variable *ir)
>  	       attr.reg_offset++;
>  	    }
>  
> -	    if (intel->gen < 6 && !(is_gl_Color && c->key.linear_color)) {
> +	    if (intel->gen < 6) {
>  	       attr.reg_offset -= type->vector_elements;
>  	       for (unsigned int k = 0; k < type->vector_elements; k++) {
>  		  emit(BRW_OPCODE_MUL, attr, attr, this->pixel_w);
> diff --git a/src/mesa/drivers/dri/i965/brw_sf.c b/src/mesa/drivers/dri/i965/brw_sf.c
> index 9b82fe1..c222777 100644
> --- a/src/mesa/drivers/dri/i965/brw_sf.c
> +++ b/src/mesa/drivers/dri/i965/brw_sf.c
> @@ -181,9 +181,6 @@ static void upload_sf_prog(struct brw_context *brw)
>     key.do_flat_shading = (ctx->Light.ShadeModel == GL_FLAT);
>     key.do_twoside_color = (ctx->Light.Enabled && ctx->Light.Model.TwoSide);
>  
> -   /* _NEW_HINT */
> -   key.linear_color = (ctx->Hint.PerspectiveCorrection == GL_FASTEST);
> -
>     /* _NEW_POLYGON */
>     if (key.do_twoside_color) {
>        /* If we're rendering to a FBO, we have to invert the polygon
> diff --git a/src/mesa/drivers/dri/i965/brw_sf.h b/src/mesa/drivers/dri/i965/brw_sf.h
> index e525c73..be32085 100644
> --- a/src/mesa/drivers/dri/i965/brw_sf.h
> +++ b/src/mesa/drivers/dri/i965/brw_sf.h
> @@ -52,7 +52,6 @@ struct brw_sf_prog_key {
>     GLuint do_flat_shading:1;
>     GLuint frontface_ccw:1;
>     GLuint do_point_sprite:1;
> -   GLuint linear_color:1;  /**< linear interp vs. perspective interp */
>     GLuint sprite_origin_lower_left:1;
>     GLuint pad:24;
>  };
> diff --git a/src/mesa/drivers/dri/i965/brw_sf_emit.c b/src/mesa/drivers/dri/i965/brw_sf_emit.c
> index 4b2e26c..52a3fb3 100644
> --- a/src/mesa/drivers/dri/i965/brw_sf_emit.c
> +++ b/src/mesa/drivers/dri/i965/brw_sf_emit.c
> @@ -316,7 +316,7 @@ static GLboolean calculate_masks( struct brw_sf_compile *c,
>     GLbitfield64 persp_mask;
>     GLbitfield64 linear_mask;
>  
> -   if (c->key.do_flat_shading || c->key.linear_color)
> +   if (c->key.do_flat_shading)
>        persp_mask = c->key.attrs & ~(FRAG_BIT_WPOS |
>                                      FRAG_BIT_COL0 |
>                                      FRAG_BIT_COL1);
> diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
> index 9079762..61b2262 100644
> --- a/src/mesa/drivers/dri/i965/brw_wm.c
> +++ b/src/mesa/drivers/dri/i965/brw_wm.c
> @@ -355,9 +355,6 @@ static void brw_wm_populate_key( struct brw_context *brw,
>     /* _NEW_LIGHT */
>     key->flat_shade = (ctx->Light.ShadeModel == GL_FLAT);
>  
> -   /* _NEW_HINT */
> -   key->linear_color = (ctx->Hint.PerspectiveCorrection == GL_FASTEST);
> -
>     /* _NEW_FRAG_CLAMP | _NEW_BUFFERS */
>     key->clamp_fragment_color = ctx->Color._ClampFragmentColor;
>  
> @@ -489,7 +486,6 @@ const struct brw_tracked_state brw_wm_prog = {
>     .dirty = {
>        .mesa  = (_NEW_COLOR |
>  		_NEW_DEPTH |
> -                _NEW_HINT |
>  		_NEW_STENCIL |
>  		_NEW_POLYGON |
>  		_NEW_LINE |
> diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h
> index 8ab531b..e5f7a79 100644
> --- a/src/mesa/drivers/dri/i965/brw_wm.h
> +++ b/src/mesa/drivers/dri/i965/brw_wm.h
> @@ -61,7 +61,6 @@
>  struct brw_wm_prog_key {
>     GLuint stats_wm:1;
>     GLuint flat_shade:1;
> -   GLuint linear_color:1;  /**< linear interpolation vs perspective interp */
>     GLuint nr_color_regions:5;
>     GLuint render_to_fbo:1;
>     GLuint alpha_test:1;
> diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c
> index 9ddbee2..59dcda7 100644
> --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c
> +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c
> @@ -417,25 +417,14 @@ static void emit_interp( struct brw_wm_compile *c,
>  		 src_undef());
>        }
>        else {
> -         if (c->key.linear_color) {
> -            emit_op(c,
> -                    WM_LINTERP,
> -                    dst,
> -                    0,
> -                    interp,
> -                    deltas,
> -                    src_undef());
> -         }
> -         else {
> -            /* perspective-corrected color interpolation */
> -            emit_op(c,
> -                    WM_PINTERP,
> -                    dst,
> -                    0,
> -                    interp,
> -                    deltas,
> -                    get_pixel_w(c));
> -         }
> +	 /* perspective-corrected color interpolation */
> +	 emit_op(c,
> +		 WM_PINTERP,
> +		 dst,
> +		 0,
> +		 interp,
> +		 deltas,
> +		 get_pixel_w(c));
>        }
>        break;
>     case FRAG_ATTRIB_FOGC:
> 
> _______________________________________________
> mesa-commit mailing list
> mesa-commit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-commit
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk3enmgACgkQX1gOwKyEAw8oSgCfbS2zgsAh+2jtC48I2XtPLcOb
macAnRrLQBIVDBj8rt1fFOcG2Aa79do1
=rS6N
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list