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

Abdiel Janulgue abdiel.janulgue at linux.intel.com
Mon Dec 8 03:14:29 PST 2014


Hi Ian,

On 12/04/2014 01:01 AM, Ian Romanick wrote:
> 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?

Classic swrast. Although there is also another separate issue in
llvmpipe that I fixed in patch 5 within this series.

> 
> 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?

Reverting the ir_to_mesa.cpp change in cfa8c1cb does fix the issue as
well. I'll submit this change today together with the llvmpipe fix.  But
I'll drop the i915, i965, and r200 patches.

> 
>> 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