[Mesa-dev] [PATCH] softpipe: Do round-to-even, not round-up.

Olivier Galibert galibert at pobox.com
Sun Jun 24 23:49:50 PDT 2012


On Fri, May 18, 2012 at 08:55:39AM -0600, Brian Paul wrote:
> In any case, I think this function could be moved into u_math.c so it 
> could be used elsewhere.
[...]
> I was looking at the GLSL round() and roundEven() functions.  The GLSL 
> spec says round() can use whatever method is fastest.  But in 
> builtin_functions.cpp the round() function is implemented in terms of 
> the round_even builtin.  It seems to me that we should have a generic 
> 'round' builtin function and separate TGSI_ROUND and TGSI_ROUND_EVEN 
> opcodes so that drivers can really have the option of using a 
> faster/looser round function.

I've tried doing that.  I've moved the function to u_math.c, then made
src/glsl/ir_constant_expression.cpp use it.  That blew up.

If I compile with scons, I get:
  Linking build/linux-x86_64-debug/glsl/builtin_compiler ...
build/linux-x86_64-debug/glsl/ir_constant_expression.o: In function `dot':
/home/galibert/X/work/mesa-play/src/glsl/ir_constant_expression.cpp:47: undefined reference to `_debug_assert_fail'
[...]
/home/galibert/X/work/mesa-play/src/glsl/ir_constant_expression.cpp:265: undefined reference to `ieee754_fp32_round_half_to_even'
[etc]

If I compile with autoconf/make I get:
ir_constant_expression.cpp:42:25: fatal error: util/u_math.h: No such file or directory

So at that point src/glsl and src/gallium are not supposed to meet
each other.  And changing that is not a responsability I feel like
taking.  Any advice?

Best,

  OG.



More information about the mesa-dev mailing list