[Mesa-dev] [PATCH 1/4] i965/fs: Don't convert float/int/bool uniforms for GLSL 1.30.

Ian Romanick idr at freedesktop.org
Mon Aug 15 13:39:10 PDT 2011


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

On 08/11/2011 05:38 PM, Kenneth Graunke wrote:
> Core Mesa now loads float/integer/boolean uniform data for drivers that
> claim to support GLSL 1.30, thanks to Bryan Cain's recent work.  When we
> run in "1.30 mode," we need to avoid double conversions.

Instead of triggering on the GLSL version, this could (should?) trigger
on a flag somewhere in the gl_context (like the existing EmitNo* flags).

The rest of the series is

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

> Once we really support 1.30, we should just delete all this code.
> 
> Fixes piglit tests with INTEL_GLSL_VERSION=130 set:
> - spec/glsl-1.10/fs-uniform-int-110.shader_test
> - spec/glsl-1.30/fs-uniform-int-130.shader_test
> 
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/drivers/dri/i965/brw_fs.cpp |   36 ++++++++++++++++++---------------
>  1 files changed, 20 insertions(+), 16 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index cafb709..e163d30 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -279,23 +279,27 @@ fs_visitor::setup_uniform_values(int loc, const glsl_type *type)
>  
>  	 assert(param < ARRAY_SIZE(c->prog_data.param));
>  
> -	 switch (type->base_type) {
> -	 case GLSL_TYPE_FLOAT:
> +	 if (ctx->Const.GLSLVersion >= 130) {
>  	    c->prog_data.param_convert[param] = PARAM_NO_CONVERT;
> -	    break;
> -	 case GLSL_TYPE_UINT:
> -	    c->prog_data.param_convert[param] = PARAM_CONVERT_F2U;
> -	    break;
> -	 case GLSL_TYPE_INT:
> -	    c->prog_data.param_convert[param] = PARAM_CONVERT_F2I;
> -	    break;
> -	 case GLSL_TYPE_BOOL:
> -	    c->prog_data.param_convert[param] = PARAM_CONVERT_F2B;
> -	    break;
> -	 default:
> -	    assert(!"not reached");
> -	    c->prog_data.param_convert[param] = PARAM_NO_CONVERT;
> -	    break;
> +	 } else {
> +	    switch (type->base_type) {
> +	    case GLSL_TYPE_FLOAT:
> +	       c->prog_data.param_convert[param] = PARAM_NO_CONVERT;
> +	       break;
> +	    case GLSL_TYPE_UINT:
> +	       c->prog_data.param_convert[param] = PARAM_CONVERT_F2U;
> +	       break;
> +	    case GLSL_TYPE_INT:
> +	       c->prog_data.param_convert[param] = PARAM_CONVERT_F2I;
> +	       break;
> +	    case GLSL_TYPE_BOOL:
> +	       c->prog_data.param_convert[param] = PARAM_CONVERT_F2B;
> +	       break;
> +	    default:
> +	       assert(!"not reached");
> +	       c->prog_data.param_convert[param] = PARAM_NO_CONVERT;
> +	       break;
> +	    }
>  	 }
>  	 this->param_index[param] = loc;
>  	 this->param_offset[param] = i;

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

iEYEARECAAYFAk5Jg+4ACgkQX1gOwKyEAw+h4wCdFT+fTiVekPUAGPZN8bxx/00A
OJUAnRTW95iR+eHo1oucEkpFgttQtj64
=Raff
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list