On 05/08/2012 02:51 AM, Olivier Galibert wrote:
The apparent cost of the calibration is eaten by the constant propagation optimization pass.
Is the underlying problem that the constant in the acos implementation just didn't have enough precision? Would adding more digits to the literal constant help?
There is still a danger here. You (we) are assuming that asin on the CPU and asin on the GPU produce the exact same result. This may or may not be the case.
Signed-off-by: Olivier Galibert<galib...@pobox.com> diff --git a/src/glsl/builtins/ir/acos.ir b/src/glsl/builtins/ir/acos.ir index f0078f8..d321057 100644 --- a/src/glsl/builtins/ir/acos.ir +++ b/src/glsl/builtins/ir/acos.ir @@ -3,27 +3,35 @@ (parameters (declare (in) float x)) ((declare () float s) + (declare () float t) (call asin (var_ref s) ((var_ref x))) - (return (expression float - (constant float (1.5707963)) (var_ref s))))) + (call asin (var_ref t) ((constant float (1)))) + (return (expression float - (var_ref t) (var_ref s))))) (signature vec2 (parameters (declare (in) vec2 x)) ((declare () vec2 s) + (declare () float t) (call asin (var_ref s) ((var_ref x))) - (return (expression vec2 - (constant float (1.5707963)) (var_ref s))))) + (call asin (var_ref t) ((constant float (1)))) + (return (expression vec2 - (var_ref t) (var_ref s))))) (signature vec3 (parameters (declare (in) vec3 x)) ((declare () vec3 s) + (declare () float t) (call asin (var_ref s) ((var_ref x))) - (return (expression vec3 - (constant float (1.5707963)) (var_ref s))))) + (call asin (var_ref t) ((constant float (1)))) + (return (expression vec3 - (var_ref t) (var_ref s))))) (signature vec4 (parameters (declare (in) vec4 x)) ((declare () vec4 s) + (declare () float t) (call asin (var_ref s) ((var_ref x))) - (return (expression vec4 - (constant float (1.5707963)) (var_ref s))))) + (call asin (var_ref t) ((constant float (1)))) + (return (expression vec4 - (var_ref t) (var_ref s))))) )) _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev