mesa: fix packing of float texels to GL_SHORT/GL_BYTE
authorChris Forbes <chrisf@ijw.co.nz>
Sun, 16 Mar 2014 19:03:38 +0000 (08:03 +1300)
committerChris Forbes <chrisf@ijw.co.nz>
Thu, 10 Apr 2014 06:27:40 +0000 (18:27 +1200)
commita421be1dcbf0c8aca4ec0a1862299c27c04d7e6c
treea1e050c0feb7b85ede5a8ea674e50f426542db85
parentee2bcf38a4c8930d8f9cecfac580030a45c41dae
mesa: fix packing of float texels to GL_SHORT/GL_BYTE

Previously, we would unpack the texels to floats using *_TO_FLOAT_TEX,
and then pack them into the desired format using FLOAT_TO_*. Unfortunately,
this isn't quite the inverse operation, and so some texel values would
end up off-by-one.

This fixes the GL_RGB8_SNORM and GL_RGB16_SNORM subcases in piglit's
arb_texture_view-format-consistency-get test on i965. The similar 1-, 2-
and 4-component cases already worked because they took the memcpy path
rather than repacking.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Eric Anholt <eric@anholt.net>
src/mesa/main/pack.c