[Mesa-dev] [PATCH v2 1/7] ir_to_mesa: Only lower saturate to clamp when EmitNoSat is set

Ian Romanick idr at freedesktop.org
Wed Dec 3 15:01:55 PST 2014


On 12/01/2014 05:47 AM, Abdiel Janulgue wrote:
> Fixes an infinite loop in swrast where the lowering pass unpacks saturate into clamp

Which swrast are we talking about here?  Classic swrast?  softpipe?
llvmpipe?

prog_execute.c can handle saturates in vertex shaders, so classic swrast
shouldn't need this lowering pass.  The only classic hardware driver
that can't do saturates in vertex shaders is r200... GLSL is not enabled
there, so it doesn't matter.

What happens if you just revert the ir_to_mesa.cpp hunk from cfa8c1cb?

> but the opt_algebraic pass tries to do the opposite.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83463
> Signed-off-by: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
> ---
>  src/mesa/main/mtypes.h          | 1 +
>  src/mesa/program/ir_to_mesa.cpp | 3 +--
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index 7389baa..cee11a3 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -2990,6 +2990,7 @@ struct gl_shader_compiler_options
>     GLboolean EmitNoMainReturn;            /**< Emit CONT/RET opcodes? */
>     GLboolean EmitNoNoise;                 /**< Emit NOISE opcodes? */
>     GLboolean EmitNoPow;                   /**< Emit POW opcodes? */
> +   GLboolean EmitNoSat;                   /**< Emit SAT opcodes? */
>     GLboolean LowerClipDistance; /**< Lower gl_ClipDistance from float[8] to vec4[2]? */
>  
>     /**
> diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
> index 5cd9058..7e7aded 100644
> --- a/src/mesa/program/ir_to_mesa.cpp
> +++ b/src/mesa/program/ir_to_mesa.cpp
> @@ -2947,8 +2947,7 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
>  	 lower_instructions(ir, (MOD_TO_FRACT | DIV_TO_MUL_RCP | EXP_TO_EXP2
>  				 | LOG_TO_LOG2 | INT_DIV_TO_MUL_RCP
>  				 | ((options->EmitNoPow) ? POW_TO_EXP2 : 0)
> -				 | ((target == GL_VERTEX_PROGRAM_ARB) ? SAT_TO_CLAMP
> -                                    : 0)));
> +				 | ((options->EmitNoSat) ? SAT_TO_CLAMP : 0)));
>  
>  	 progress = do_lower_jumps(ir, true, true, options->EmitNoMainReturn, options->EmitNoCont, options->EmitNoLoops) || progress;
>  
> 



More information about the mesa-dev mailing list