diff options
author | Jason Ekstrand <[email protected]> | 2014-08-22 13:39:23 -0700 |
---|---|---|
committer | Iago Toral Quiroga <[email protected]> | 2015-01-12 11:20:27 +0100 |
commit | ec0bfba49668875462dfd75f4824f48018e82efe (patch) | |
tree | 2ff2261e86b7928f710977a2a61444621a090e6e /src/mesa/main/formats.c | |
parent | 7d1b08ac44cf2531b0df39f52ead93ad216ea233 (diff) |
mesa: Fix packing/unpacking of MESA_FORMAT_R5G6B5_UNORM
Aparently, the packing/unpacking functions for these formats have differed
from the format description in formats.h. Instead of fixing this, people
simply left a comment saying it was broken. Let's actually fix it for
real.
v2 by Samuel Iglesias <[email protected]>:
- Fix comment in formats.h
Signed-off-by: Jason Ekstrand <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Reviewed-by: Anuj Phogat <[email protected]>
Diffstat (limited to 'src/mesa/main/formats.c')
-rw-r--r-- | src/mesa/main/formats.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 58c32e23b30..1315d368c27 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -1462,14 +1462,14 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format, return format == GL_RGB && type == GL_UNSIGNED_BYTE && littleEndian; case MESA_FORMAT_B5G6R5_UNORM: - return format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 && !swapBytes; + return ((format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5) || + (format == GL_BGR && type == GL_UNSIGNED_SHORT_5_6_5_REV)) && + !swapBytes; case MESA_FORMAT_R5G6B5_UNORM: - /* Some of the 16-bit MESA_FORMATs that would seem to correspond to - * GL_UNSIGNED_SHORT_* are byte-swapped instead of channel-reversed, - * according to formats.h, so they can't be matched. - */ - return GL_FALSE; + return ((format == GL_BGR && type == GL_UNSIGNED_SHORT_5_6_5) || + (format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5_REV)) && + !swapBytes; case MESA_FORMAT_B4G4R4A4_UNORM: return format == GL_BGRA && type == GL_UNSIGNED_SHORT_4_4_4_4_REV && |