[Mesa-dev] float argument normalize shader error

Madan Mohan Chinnam Madan_Chinnam at infosys.com
Tue Feb 26 01:47:17 PST 2013


Hi,

I am trying to use "normalize" method at fragment test shader in my Open GL es2 application.

precision mediump float;
varying vec4 color;

void main (void)
{
    vec4 tmp_Color = color + vec4(0.25);
    gl_FragColor = vec4(normalize(tmp_Color.r), 0.0, 0.0, 1.0);
}

With above shader, my app colour is changed to "White". In the reference shader test case,

gl_FragColor = vec4(tmp_Color.r / length(tmp_Color.r), 0.0, 0.0, 1.0);

With above shader, the app colour becomes Red.

When I saw normalize.ir in src\glsl\builtins\ir folder, from line no: 5 for float argument

((return (expression float sign (var_ref arg0)))))

With above expression, normalize should produce expected behaviour. Not known about the reason for unexpected behaviour. When I changed the code in normalize.ir for float argument as like below, application is behaving as expected (Red colour).

((return (expression float / (var_ref arg0) (expression float abs (var_ref arg0))))))

Is any known bug present in mesa for float argument normalize, or am I missing any thing?

Thanks & Regards
Madan

**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely 
for the use of the addressee(s). If you are not the intended recipient, please 
notify the sender by e-mail and delete the original message. Further, you are not 
to copy, disclose, or distribute this e-mail or its contents to any other person and 
any such actions are unlawful. This e-mail may contain viruses. Infosys has taken 
every reasonable precaution to minimize this risk, but is not liable for any damage 
you may sustain as a result of any virus in this e-mail. You should carry out your 
own virus checks before opening the e-mail or attachment. Infosys reserves the 
right to monitor and review the content of all messages sent to or from this e-mail 
address. Messages sent to or from this e-mail address may be stored on the 
Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***


More information about the mesa-dev mailing list