[Mesa-dev] [PATCH] glsl: Use a separate div_to_mul_rcp lowering flag for integers.

Bryan Cain bryancain3 at gmail.com
Sun Aug 28 08:26:35 PDT 2011


On 08/27/2011 10:18 PM, Kenneth Graunke wrote:
> From: Bryan Cain <bryancain3 at gmail.com>
>
> Using multiply and reciprocal for integer division involves potentially
> lossy floating point conversions.  This is okay for older GPUs that
> represent integers as floating point, but undesirable for GPUs with
> native integer division instructions.
>
> TGSI, for example, has UDIV/IDIV instructions for integer division,
> so it makes sense to handle this directly.  Likewise for i965.
>
> Signed-off-by: Bryan Cain <bryancain3 at gmail.com>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>
> Bryan,
>
> I like your patch---it looks good!  It seems a bit cleaner to me to split
> div_to_mul_rcp into two separate functions, seeing as the two paths don't
> share any code and are now controlled by different flags.
>
> This version of the patch splits them out, and adds comments to the top
> of the file explaining the new flag.

Looks good to me.



More information about the mesa-dev mailing list