llvmpipe: Use saturating add/sub for UNORM formats
authorRichard Sandiford <rsandifo@linux.vnet.ibm.com>
Fri, 7 Jun 2013 12:31:58 +0000 (13:31 +0100)
committerAdam Jackson <ajax@redhat.com>
Mon, 10 Jun 2013 20:20:45 +0000 (16:20 -0400)
commitba6cd796dd60635ca12f036ba9de5b907d8e82f5
treea137597c37170c3550ec512feb91601713e79e5d
parenta0037cecd1d8c609070e1b464ea0693e8769e55c
llvmpipe: Use saturating add/sub for UNORM formats

lp_build_add and lp_build_sub have fallback code for cases
that cannot be handled by known intrinsics.  For UNORM formats,
this code was using modulo rather than saturating arithmetic.

This fixes some rendering issues for a gnome session on System z.
It also fixes various piglit tests on z, such as
spec/ARB_color_buffer_float/GL_RGBA8-render.

The patch deliberately doesn't tackle the more complicated
SNORM case.

Tested against piglit on x86_64 and System z with no regressions.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com>
src/gallium/auxiliary/gallivm/lp_bld_arit.c