[Mesa-dev] [PATCH 4/8] mesa: fill in signed cases and RGBA16 in _mesa_format_matches_format_and_type

Michel Dänzer michel at daenzer.net
Wed Jan 30 02:58:51 PST 2013


On Die, 2013-01-29 at 21:22 +0100, Marek Olšák wrote: 
> On Tue, Jan 29, 2013 at 4:31 PM, Michel Dänzer <michel at daenzer.net> wrote:
> > On Die, 2013-01-29 at 14:43 +0100, Marek Olšák wrote:
> >> ---
> >>  src/mesa/main/formats.c |   30 ++++++++++++++++++++++++++----
> >>  1 file changed, 26 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
> >> index 0273425..b86fb9e 100644
> >> --- a/src/mesa/main/formats.c
> >> +++ b/src/mesa/main/formats.c
> [...]
> >> @@ -3264,12 +3270,17 @@ _mesa_format_matches_format_and_type(gl_format gl_format,
> >>        return GL_FALSE;
> >>
> >>     case MESA_FORMAT_SIGNED_R16:
> >> +      return format == GL_RED && type == GL_SHORT && littleEndian &&
> >> +             !swapBytes;
> >>     case MESA_FORMAT_SIGNED_GR1616:
> >> +      return format == GL_RG && type == GL_SHORT && littleEndian && !swapBytes;
> >
> > GL_SHORT is in host byte order, so checking for littleEndian here
> > incorrectly excludes big endian hosts.
> 
> Does that apply only to X16, or even to X16Y16, or even to X16Y16Z16W16?

Hmm. AFAICT MESA_FORMAT_*1616 are currently defined as 32 bit packed
values, so the line you added for MESA_FORMAT_SIGNED_GR1616 is actually
correct.

OTOH e.g. MESA_FORMAT_RGBA_16 appears to be defined as an array of 16
bit values, so that could be treated the same way as
MESA_FORMAT_SIGNED_R16.

I wonder if it wouldn't make sense to replace MESA_FORMAT_*1616 with
array based formats as well. AFAICT there's nothing like GL_INT_16_16 in
OpenGL.


-- 
Earthling Michel Dänzer           |                   http://www.amd.com
Libre software enthusiast         |          Debian, X and DRI developer


More information about the mesa-dev mailing list