[Mesa-dev] [PATCH 02/12] main/formats: Autogenerate the format_info structure from a CSV file
Jason Ekstrand
jason at jlekstrand.net
Fri Aug 1 16:20:10 PDT 2014
Dylan,
Thanks for reviewing. I've got a new version coming that is much better
documented and incorporates all of your comments. It even has docstrings!
--Jason
On Mon, Jul 21, 2014 at 11:26 AM, Dylan Baker <baker.dylan.c at gmail.com>
wrote:
> On Thursday, July 17, 2014 11:04:24 AM Jason Ekstrand wrote:
> > Instead of a having all of the format metadata in a gigantic hard-to-edit
> > array of type struct format_info, we now use a human-readable CSV file.
> > The CSV file also contains more format information than the format_info
> > struct contained so we can potentially make format_info more detailed
> later.
> >
> > The idea (and some of the implementation) for this was taken from the
> > gallium driver. However, due to differences in the way the two systems
> > handle formats, they are NOT the same; watch out for differences.
> >
> > Signed-off-by: Jason Ekstrand <jason.ekstrand at intel.com>
>
> I have some formatting/style/cleanup comments for your python. I also have
> a
> general suggestion, that you might want to use division from the __future__
> module. This fixes division to behave like the more sensible python3
> default:
> // is floor division always, and / is true division always.
>
> > ---
> > src/mesa/Makefile.am | 10 +
> > src/mesa/main/.gitignore | 1 +
> > src/mesa/main/format_info.py | 181 +++++
> > src/mesa/main/format_parser.py | 406 ++++++++++
> > src/mesa/main/formats.c | 1739
> > +--------------------------------------- 5 files changed, 599
> > insertions(+), 1738 deletions(-)
> > create mode 100644 src/mesa/main/format_info.py
> > create mode 100755 src/mesa/main/format_parser.py
> >
> > diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
> > index 88eeff9..57c1e4a 100644
> > --- a/src/mesa/Makefile.am
> > +++ b/src/mesa/Makefile.am
> > @@ -64,6 +64,7 @@ include Makefile.sources
> >
> > BUILT_SOURCES = \
> > main/get_hash.h \
> > + main/format_info.c \
> > $(BUILDDIR)main/git_sha1.h \
> > $(BUILDDIR)program/program_parse.tab.c \
> > $(BUILDDIR)program/lex.yy.c
> > @@ -81,6 +82,15 @@ main/get_hash.h: $(GLAPI)/gl_and_es_API.xml
> > main/get_hash_params.py \ -f $< > $@.tmp;
> \
> > mv $@.tmp $@;
> >
> > +main/format_info.c: main/formats.csv
> \
> > + main/format_parser.py main/format_info.py
> > + $(AM_V_GEN)set -e; \
> > + $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/main/format_info.py \
> > + $< > $@.tmp;
> \
> > + mv $@.tmp $@;
> > +
> > +main/formats.c: main/format_info.c
> > +
> > noinst_LTLIBRARIES = $(ARCH_LIBS)
> > if NEED_LIBMESA
> > noinst_LTLIBRARIES += libmesa.la
> > diff --git a/src/mesa/main/.gitignore b/src/mesa/main/.gitignore
> > index 837f490..fec0629 100644
> > --- a/src/mesa/main/.gitignore
> > +++ b/src/mesa/main/.gitignore
> > @@ -8,3 +8,4 @@ git_sha1.h.tmp
> > remap_helper.h
> > get_hash.h
> > get_hash.h.tmp
> > +format_info.c
> > diff --git a/src/mesa/main/format_info.py b/src/mesa/main/format_info.py
> > new file mode 100644
> > index 0000000..9b63bfb
> > --- /dev/null
> > +++ b/src/mesa/main/format_info.py
> > @@ -0,0 +1,181 @@
> > +#!/usr/bin/env python
> > +#
> > +# Copyright 2014 Intel Corporation
> > +#
> > +# Permission is hereby granted, free of charge, to any person obtaining
> a
> > +# copy of this software and associated documentation files (the
> > +# "Software"), to deal in the Software without restriction, including
> > +# without limitation the rights to use, copy, modify, merge, publish,
> > +# distribute, sub license, and/or sell copies of the Software, and to
> > +# permit persons to whom the Software is furnished to do so, subject to
> > +# the following conditions:
> > +#
> > +# The above copyright notice and this permission notice (including the
> > +# next paragraph) shall be included in all copies or substantial
> portions
> > +# of the Software.
> > +#
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS
> > +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> > +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> NON-INFRINGEMENT.
> > +# IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
> > +# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
> CONTRACT,
> > +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
> > +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
> > +
> > +import format_parser as parser
> > +import sys
> > +
> > +def get_gl_base_format(fmat):
> > + if fmat.name == 'MESA_FORMAT_NONE':
> > + return 'GL_NONE'
> > + elif fmat.name in ['MESA_FORMAT_YCBCR', 'MESA_FORMAT_YCBCR_REV']:
> > + return 'GL_YCBCR_MESA'
> > + elif fmat.has_channel('r'):
> > + if fmat.has_channel('g'):
> > + if fmat.has_channel('b'):
> > + if fmat.has_channel('a'):
> > + return 'GL_RGBA'
> > + else:
> > + return 'GL_RGB'
> > + else:
> > + return 'GL_RG'
> > + else:
> > + return 'GL_RED'
> > + elif fmat.has_channel('l'):
> > + if fmat.has_channel('a'):
> > + return 'GL_LUMINANCE_ALPHA'
> > + else:
> > + return 'GL_LUMINANCE'
> > + elif fmat.has_channel('a') and fmat.num_channels() == 1:
> > + return 'GL_ALPHA'
> > + elif fmat.has_channel('z'):
> > + if fmat.has_channel('s'):
> > + return 'GL_DEPTH_STENCIL'
> > + else:
> > + return 'GL_DEPTH_COMPONENT'
> > + elif fmat.has_channel('s'):
> > + return 'GL_STENCIL_INDEX'
> > + elif fmat.has_channel('i') and fmat.num_channels() == 1:
> > + return 'GL_INTENSITY'
> > + else:
> > + assert False
> > +
> > +def get_gl_data_type(fmat):
> > + if fmat.is_compressed():
> > + if 'SIGNED' in fmat.name or 'SNORM' in fmat.name:
> > + return 'GL_SIGNED_NORMALIZED'
> > + else:
> > + return 'GL_UNSIGNED_NORMALIZED'
> > + elif fmat.name in ['MESA_FORMAT_YCBCR', 'MESA_FORMAT_YCBCR_REV']:
> > + return 'GL_UNSIGNED_NORMALIZED'
> > +
> > + channel = None
> > + for chan in fmat.channels:
> > + if chan.type == 'x' and len(fmat.channels) > 1:
> > + continue # We can do better
> > + elif chan.name == 's' and fmat.has_channel('z'):
> > + continue # We'll use the type from the depth instead
> > +
> > + channel = chan
> > + break;
> > +
> > + if channel.type == parser.UNSIGNED:
> > + if channel.norm:
> > + return 'GL_UNSIGNED_NORMALIZED'
> > + else:
> > + return 'GL_UNSIGNED_INT'
> > + elif channel.type == parser.SIGNED:
> > + if channel.norm:
> > + return 'GL_SIGNED_NORMALIZED'
> > + else:
> > + return 'GL_INT'
> > + elif channel.type == parser.FLOAT:
> > + return 'GL_FLOAT'
> > + elif channel.type == parser.VOID:
> > + return 'GL_NONE'
> > + else:
> > + assert False
> > +
> > +def get_channel_bits(fmat, chan_name):
> > + if fmat.is_compressed():
> > + # These values are pretty-much bogus, but OpenGL requires that we
> > + # return an "approximate" number of bits.
> > + if fmat.layout == 's3tc':
> > + return 4 if fmat.has_channel(chan_name) else 0
> > + elif fmat.layout == 'fxt1':
> > + if chan_name in 'rgb':
> > + return 4
> > + elif chan_name == 'a':
> > + return 1 if fmat.has_channel('a') else 0
> > + else:
> > + return 0
> > + elif fmat.layout == 'rgtc':
> > + return 8 if fmat.has_channel(chan_name) else 0
> > + elif fmat.layout in ('etc1', 'etc2'):
> > + if fmat.name.endswith('_ALPHA1') and chan_name == 'a':
> > + return 1
> > +
> > + bits = 11 if fmat.name.endswith('11_EAC') else 8
> > + return bits if fmat.has_channel(chan_name) else 0
> > + else:
> > + assert False
> > + else:
> > + # Uncompressed textures
> > + for chan in fmat.channels:
> > + if chan.name == chan_name:
> > + return chan.size
> > + return 0
> > +
> > +formats = parser.parse(sys.argv[1])
> > +
> > +print '''
> > +/*
> > + * Mesa 3-D graphics library
> > + *
> > + * Copyright (c) 2014 Intel Corporation
> > + *
> > + * Permission is hereby granted, free of charge, to any person
> obtaining a
> > + * copy of this software and associated documentation files (the
> > "Software"), + * to deal in the Software without restriction, including
> > without limitation + * the rights to use, copy, modify, merge, publish,
> > distribute, sublicense, + * and/or sell copies of the Software, and to
> > permit persons to whom the + * Software is furnished to do so, subject to
> > the following conditions: + *
> > + * The above copyright notice and this permission notice shall be
> included
> > + * in all copies or substantial portions of the Software.
> > + *
> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS
> > + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> > MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND
> NONINFRINGEMENT.
> > IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
> > CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
> > TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE
> > SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE.
> > + */
> > +
> > + /*
> > + * This file is AUTOGENERATED by format_info.py. Do not edit it
> > + * manually or commit it into version control.
> > + */
> > +
> > +static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
> > +{
> > +'''
> > +
> > +for fmat in formats:
> > + print ' {'
> > + print ' {0},'.format(fmat.name)
> > + print ' "{0}",'.format(fmat.name)
> > + print ' {0},'.format(get_gl_base_format(fmat))
> > + print ' {0},'.format(get_gl_data_type(fmat))
> > +
> > + bits = [ get_channel_bits(fmat, name) for name in ['r', 'g', 'b',
> 'a']]
> > + print ' {0},'.format(', '.join(map(str, bits)))
> > + bits = [ get_channel_bits(fmat, name) for name in ['l', 'i', 'I',
> 'z',
> > 's']] + print ' {0},'.format(', '.join(map(str, bits)))
> > +
> > + print ' {0}, {1}, {2},'.format(fmat.block_width,
> fmat.block_height,
> > + int(fmat.block_size() / 8)) +
> > print ' },'
> > +
> > +print '};'
> > diff --git a/src/mesa/main/format_parser.py
> b/src/mesa/main/format_parser.py
> > new file mode 100755
> > index 0000000..2791c6c
> > --- /dev/null
> > +++ b/src/mesa/main/format_parser.py
> > @@ -0,0 +1,406 @@
> > +#!/usr/bin/env python
> > +#
> > +# Copyright 2009 VMware, Inc.
> > +# Copyright 2014 Intel Corporation
> > +# All Rights Reserved.
> > +#
> > +# Permission is hereby granted, free of charge, to any person obtaining
> a
> > +# copy of this software and associated documentation files (the
> > +# "Software"), to deal in the Software without restriction, including
> > +# without limitation the rights to use, copy, modify, merge, publish,
> > +# distribute, sub license, and/or sell copies of the Software, and to
> > +# permit persons to whom the Software is furnished to do so, subject to
> > +# the following conditions:
> > +#
> > +# The above copyright notice and this permission notice (including the
> > +# next paragraph) shall be included in all copies or substantial
> portions
> > +# of the Software.
> > +#
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS
> > +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> > +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> NON-INFRINGEMENT.
> > +# IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
> > +# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
> CONTRACT,
> > +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
> > +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
> > +
> > +VOID = 'x'
> > +UNSIGNED = 'u'
> > +SIGNED = 's'
> > +FLOAT = 'f'
> > +
> > +ARRAY = 'array'
> > +PACKED = 'packed'
> > +OTHER = 'other'
> > +
> > +RGB = 'rgb'
> > +SRGB = 'srgb'
> > +YUV = 'yuv'
> > +ZS = 'zs'
> > +
> > +def is_power_of_two(x):
> > + return not bool(x & (x - 1))
> > +
> > +VERY_LARGE = 99999999999999999999999
> > +
> > +class Channel:
>
> You should use a new-style class, class Channel(object), you should do this
> for your other classes as well
>
> > + '''Describe the channel of a color channel.'''
> > +
> > + def __init__(self, type, norm, size):
> > + self.type = type
> > + self.norm = norm
> > + self.size = size
> > + self.sign = type in (SIGNED, FLOAT)
> > + self.name = None # Set when the channels are added to the format
> > + self.shift = -1 # Set when the channels are added to the format
> > + self.index = -1 # Set when the channels are added to the format
> > +
> > + def __str__(self):
> > + s = str(self.type)
> > + if self.norm:
> > + s += 'n'
> > + s += str(self.size)
> > + return s
> > +
> > + def __eq__(self, other):
> > + return self.type == other.type and self.norm == other.norm and
> > self.size == other.size +
> > + def max(self):
> > + '''Maximum representable number.'''
> > + if self.type == FLOAT:
> > + return VERY_LARGE
> > + if self.norm:
> > + return 1
> > + if self.type == UNSIGNED:
> > + return (1 << self.size) - 1
> > + if self.type == SIGNED:
> > + return (1 << (self.size - 1)) - 1
> > + assert False
> > +
> > + def min(self):
> > + '''Minimum representable number.'''
> > + if self.type == FLOAT:
> > + return -VERY_LARGE
> > + if self.type == UNSIGNED:
> > + return 0
> > + if self.norm:
> > + return -1
> > + if self.type == SIGNED:
> > + return -(1 << (self.size - 1))
> > + assert False
> > +
> > + def one(self):
> > + '''Representation of 1.0f.'''
> > + if self.type == UNSIGNED:
> > + return (1 << self.size) - 1
> > + if self.type == SIGNED:
> > + return (1 << (self.size - 1)) - 1
> > + else:
> > + return 1
> > +
> > + def is_power_of_two(self):
> > + return is_power_of_two(self.size)
> > +
> > +class Swizzle:
> > + __identity_str = 'xyzw01_'
> > +
> > + SWIZZLE_X = 0
> > + SWIZZLE_Y = 1
> > + SWIZZLE_Z = 2
> > + SWIZZLE_W = 3
> > + SWIZZLE_ZERO = 4
> > + SWIZZLE_ONE = 5
> > + SWIZZLE_NONE = 6
> > +
> > + def __init__(self, swizzle):
> > + if type(swizzle) is str:
> > + swizzle = [Swizzle.__identity_str.index(c) for c in swizzle]
> > + else:
> > + for s in swizzle:
> > + assert type(s) is int and 0 <= s and s <=
> Swizzle.SWIZZLE_NONE
> > + swizzle = list(swizzle)
> > +
> > + assert len(swizzle) <= 4
> > +
> > + self.__list = swizzle + [Swizzle.SWIZZLE_NONE] * (4 -
> len(swizzle))
> > +
> > + def __iter__(self):
> > + return self.__list.__iter__()
>
> Don't call magic methods directly (anything that starts and ends with __),
> you
> should use the iter() function
> return iter(self.__list)
>
> > +
> > + def __str__(self):
> > + return ''.join([Swizzle.__identity_str[i] for i in
> self.__list])[:4]
>
> You could replace the list comprehension with a generator, (just drop the
> '['
> and ']'). You should probably also have a comment mentioning that you are
> intentionally do string slicing
>
> > +
> > + def __getitem__(self, idx):
> > + if type(idx) is int:
>
> this works and is correct, but generally isinstance() is used for this
> operation
>
> > + assert idx >= Swizzle.SWIZZLE_X and idx <= Swizzle.SWIZZLE_NONE
> > + if idx <= Swizzle.SWIZZLE_W:
> > + return self.__list.__getitem__(idx)
> > + else:
> > + return idx
> > + elif type(idx) is str:
> > + if idx in 'xyzw':
> > + idx = 'xyzw'.find(idx)
> > + elif idx in 'rgba':
> > + idx = 'rgba'.find(idx)
> > + elif idx in 'zs':
> > + idx = 'zs'.find(idx)
> > + else:
> > + assert False
> > + return self.__list.__getitem__(idx)
> > + else:
> > + assert False
> > +
> > + def __mul__(self, other):
> > + assert isinstance(other, Swizzle)
> > + return Swizzle([self[other[i]] for i in range(4)])
>
> This is generally not the way this is done in python. You should be able
> to do
> this with list slicing. Something like:
> return Swizzle(self[x] for x in other[:4])
>
> > +
> > + def inverse(self):
> > + rev = [Swizzle.SWIZZLE_NONE] * 4
> > + for i in range(4):
> > + for j in range(4):
>
> in python2 don't use range(), use xrange() instead. xrange() returns an
> iterator, while range() returns a list.
>
> You could also use itertools.product() to remove the nested loop if you
> wanted.
>
> > + if self.__list[j] == i and rev[i] == Swizzle.SWIZZLE_NONE:
> > + rev[i] = j
> > + return Swizzle(rev)
> > +
> > +
> > +class Format:
> > + '''Describe a pixel format.'''
> > +
> > + def __init__(self, name, layout, block_width, block_height, channels,
> > swizzle, colorspace): + self.name = name
> > + self.layout = layout
> > + self.block_width = block_width
> > + self.block_height = block_height
> > + self.channels = channels
> > + assert isinstance(swizzle, Swizzle)
> > + self.swizzle = swizzle
> > + self.name = name
> > + self.colorspace = colorspace
> > +
> > + # Name the channels
> > + chan_names = ['']*4
> > + if self.colorspace in (RGB, SRGB):
> > + for (i, s) in enumerate(swizzle):
> > + if s < 4:
> > + chan_names[s] += 'rgba'[i]
> > + elif colorspace == ZS:
> > + for (i, s) in enumerate(swizzle):
> > + if s < 4:
> > + chan_names[s] += 'zs'[i]
> > + else:
> > + chan_names = ['x', 'y', 'z', 'w']
> > +
> > + for c, name in zip(self.channels, chan_names):
> > + if name == 'rgb':
> > + c.name = 'l'
> > + elif name == 'rgba':
> > + c.name = 'i'
> > + elif name == '':
> > + c.name = 'x'
> > + else:
> > + c.name = name
> > +
> > + # Set indices and offsets
> > + if self.layout == PACKED:
> > + shift = 0
> > + for channel in self.channels:
> > + channel.shift = shift
> > + shift += channel.size
> > + for idx, channel in enumerate(self.channels):
> > + channel.index = idx
> > + else:
> > + pass # Shift means nothing here
> > +
> > + def __str__(self):
> > + return self.name
> > +
> > + def short_name(self):
> > + '''Make up a short norm for a format, suitable to be used as
> suffix
> > in + function names.'''
> > +
> > + name = self.name
> > + if name.startswith('MESA_FORMAT_'):
> > + name = name[len('MESA_FORMAT_'):]
> > + name = name.lower()
> > + return name
> > +
> > + def block_size(self):
> > + size = 0
> > + for channel in self.channels:
> > + size += channel.size
> > + return size
> > +
> > + def num_channels(self):
> > + nr_channels = 0
> > + for channel in self.channels:
> > + if channel.size:
> > + nr_channels += 1
> > + return nr_channels
> > +
> > + def array_element(self):
> > + if self.layout == ARRAY:
> > + return self.channels[0]
> > + elif self.layout == PACKED:
> > + ref_channel = self.channels[0]
> > + if ref_channel.type == VOID:
> > + ref_channel = self.channels[1]
> > + for channel in self.channels:
> > + if channel.size == 0 or channel.type == VOID:
> > + continue
> > + if channel.size != ref_channel.size or channel.size % 8 !=
> 0:
> > + return None
> > + if channel.type != ref_channel.type:
> > + return None
> > + if channel.norm != ref_channel.norm:
> > + return None
> > + return ref_channel
> > + else:
> > + return None
> > +
> > + def is_array(self):
> > + return self.array_element() != None
> > +
> > + def is_compressed(self):
> > + return self.block_width != 1 or self.block_height != 1
> > +
> > + def is_int(self):
> > + if self.layout not in (ARRAY, PACKED):
> > + return False
> > + for channel in self.channels:
> > + if channel.type not in (VOID, UNSIGNED, SIGNED):
> > + return False
> > + return True
> > +
> > + def is_float(self):
> > + if self.layout not in (ARRAY, PACKED):
> > + return False
> > + for channel in self.channels:
> > + if channel.type not in (VOID, FLOAT):
> > + return False
> > + return True
> > +
> > + def channel_type(self):
> > + _type = VOID
> > + for c in self.channels:
> > + if c.type == VOID:
> > + continue
> > + if _type == VOID:
> > + _type = c.type
> > + assert c.type == _type
> > + return _type
> > +
> > + def channel_size(self):
> > + size = None
> > + for c in self.channels:
> > + if c.type == VOID:
> > + continue
> > + if size is None:
> > + size = c.size
> > + assert c.size == size
> > + return size
> > +
> > + def max_channel_size(self):
> > + size = 0
> > + for c in self.channels:
> > + if c.type == VOID:
> > + continue
> > + size = max(size, c.size)
> > + return size
> > +
> > + def is_normalized(self):
> > + norm = None
> > + for c in self.channels:
> > + if c.type == VOID:
> > + continue
> > + if norm is None:
> > + norm = c.norm
> > + assert c.norm == norm
> > + return norm
> > +
> > + def has_channel(self, name):
> > + if self.is_compressed():
> > + # No channel information, so we pull it from the swizzle
> > + if str(self.swizzle) == 'xxxx':
> > + return name == 'i'
> > + elif str(self.swizzle)[0:3] in ('xxx', 'yyy'):
> > + if name == 'l':
> > + return True
> > + elif name == 'a':
> > + return self.swizzle['a'] <= Swizzle.SWIZZLE_W
> > + else:
> > + return False
> > + elif name in 'rgba':
> > + return self.swizzle[name] <= Swizzle.SWIZZLE_W
> > + else:
> > + return False
> > + else:
> > + for channel in self.channels:
> > + if channel.name == name:
> > + return True
> > + return False
> > +
> > + def get_channel(self, name):
> > + for channel in self.channels:
> > + if channel.name == name:
> > + return channel
> > + assert False
> > +
> > + def has_depth(self):
> > + return self.colorspace == ZS and self.has_channel(0)
> > +
> > + def has_stencil(self):
> > + return self.colorspace == ZS and self.has_channel(1)
> > +
> > + def stride(self):
> > + return self.block_size()/8
> > +
> > +def _parse_channels(fields, layout, colorspace, swizzle):
> > + channels = []
> > + for field in fields:
> > + if not field:
> > + continue;
>
> remove the semicolon
>
> > +
> > + type = field[0] if field[0] else 'x'
> > +
> > + if field[1] == 'n':
> > + norm = True
> > + size = int(field[2:])
> > + else:
> > + norm = False
> > + size = int(field[1:])
> > +
> > + channel = Channel(type, norm, size)
> > + channels.append(channel)
> > +
> > + return channels
> > +
> > +def parse(filename):
> > + '''Parse the format descrition in CSV format in terms of the
> > + Channel and Format classes above.'''
> > +
> > + stream = open(filename)
>
> you should use open() as a context manager, that way you don't need to
> remember to close the file (which you forgot). like so:
> with open(filename, 'r') as stream:
> for line in stream:
>
> > + formats = []
> > + for line in stream:
> > + try:
> > + comment = line.index('#')
> > + except ValueError:
> > + pass
> > + else:
> > + line = line[:comment]
> > + line = line.strip()
> > + if not line:
> > + continue
> > +
> > + fields = [field.strip() for field in line.split(',')]
> > +
> > + name = fields[0]
> > + layout = fields[1]
> > + block_width, block_height = map(int, fields[2:4])
>
> map() is deprecated (so is filter(), in case you where wondering), using a
> list comprehension or generator is the modern way to handle this.
> block_width, block_height = (int(x) for x in fields[2:4])
>
> > + colorspace = fields[9]
> > +
> > + swizzle = Swizzle(fields[8])
> > + channels = _parse_channels(fields[4:8], layout, colorspace,
> swizzle)
> > +
> > + format = Format(name, layout, block_width, block_height, channels,
> > swizzle, colorspace) + formats.append(format)
> > + return formats
> > diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
> > index 1f20a9a..e237064 100644
> > --- a/src/mesa/main/formats.c
> > +++ b/src/mesa/main/formats.c
> > @@ -70,1743 +70,7 @@ struct gl_format_info
> > GLubyte BytesPerBlock;
> > };
> >
> > -
> > -/**
> > - * Info about each format.
> > - * These must be in the same order as the MESA_FORMAT_* enums so that
> > - * we can do lookups without searching.
> > - */
> > -static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
> > -{
> > - /* Packed unorm formats */
> > - {
> > - MESA_FORMAT_NONE, /* Name */
> > - "MESA_FORMAT_NONE", /* StrName */
> > - GL_NONE, /* BaseFormat */
> > - GL_NONE, /* DataType */
> > - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 0, 0, 0 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_A8B8G8R8_UNORM, /* Name */
> > - "MESA_FORMAT_A8B8G8R8_UNORM",/* StrName */
> > - GL_RGBA, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 4 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_X8B8G8R8_UNORM, /* Name */
> > - "MESA_FORMAT_X8B8G8R8_UNORM",/* StrName */
> > - GL_RGB, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 4 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_R8G8B8A8_UNORM, /* Name */
> > - "MESA_FORMAT_R8G8B8A8_UNORM",/* StrName */
> > - GL_RGBA, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 4 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_R8G8B8X8_UNORM, /* Name */
> > - "MESA_FORMAT_R8G8B8X8_UNORM",/* StrName */
> > - GL_RGB, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 4 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_B8G8R8A8_UNORM, /* Name */
> > - "MESA_FORMAT_B8G8R8A8_UNORM",/* StrName */
> > - GL_RGBA, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 4 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_B8G8R8X8_UNORM, /* Name */
> > - "MESA_FORMAT_B8G8R8X8_UNORM",/* StrName */
> > - GL_RGB, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 4 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_A8R8G8B8_UNORM, /* Name */
> > - "MESA_FORMAT_A8R8G8B8_UNORM",/* StrName */
> > - GL_RGBA, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 4 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_X8R8G8B8_UNORM, /* Name */
> > - "MESA_FORMAT_X8R8G8B8_UNORM",/* StrName */
> > - GL_RGB, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 4 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_L16A16_UNORM, /* Name */
> > - "MESA_FORMAT_L16A16_UNORM", /* StrName */
> > - GL_LUMINANCE_ALPHA, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 0, 0, 0, 16, /* Red/Green/Blue/AlphaBits */
> > - 16, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 4 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_A16L16_UNORM, /* Name */
> > - "MESA_FORMAT_A16L16_UNORM", /* StrName */
> > - GL_LUMINANCE_ALPHA, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 0, 0, 0, 16, /* Red/Green/Blue/AlphaBits */
> > - 16, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 4 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_B5G6R5_UNORM, /* Name */
> > - "MESA_FORMAT_B5G6R5_UNORM", /* StrName */
> > - GL_RGB, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 5, 6, 5, 0, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 2 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_R5G6B5_UNORM, /* Name */
> > - "MESA_FORMAT_R5G6B5_UNORM", /* StrName */
> > - GL_RGB, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 5, 6, 5, 0, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 2 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_B4G4R4A4_UNORM, /* Name */
> > - "MESA_FORMAT_B4G4R4A4_UNORM",/* StrName */
> > - GL_RGBA, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 4, 4, 4, 4, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 2 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_B4G4R4X4_UNORM,
> > - "MESA_FORMAT_B4G4R4X4_UNORM",
> > - GL_RGB,
> > - GL_UNSIGNED_NORMALIZED,
> > - 4, 4, 4, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > - {
> > - MESA_FORMAT_A4R4G4B4_UNORM, /* Name */
> > - "MESA_FORMAT_A4R4G4B4_UNORM",/* StrName */
> > - GL_RGBA, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 4, 4, 4, 4, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 2 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_A1B5G5R5_UNORM, /* Name */
> > - "MESA_FORMAT_A1B5G5R5_UNORM",/* StrName */
> > - GL_RGBA, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 5, 5, 5, 1, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 2 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_B5G5R5A1_UNORM, /* Name */
> > - "MESA_FORMAT_B5G5R5A1_UNORM",/* StrName */
> > - GL_RGBA, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 5, 5, 5, 1, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 2 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_B5G5R5X1_UNORM,
> > - "MESA_FORMAT_B5G5R5X1_UNORM",
> > - GL_RGB,
> > - GL_UNSIGNED_NORMALIZED,
> > - 5, 5, 5, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > - {
> > - MESA_FORMAT_A1R5G5B5_UNORM, /* Name */
> > - "MESA_FORMAT_A1R5G5B5_UNORM",/* StrName */
> > - GL_RGBA, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 5, 5, 5, 1, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 2 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_L8A8_UNORM, /* Name */
> > - "MESA_FORMAT_L8A8_UNORM", /* StrName */
> > - GL_LUMINANCE_ALPHA, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 0, 0, 0, 8, /* Red/Green/Blue/AlphaBits */
> > - 8, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 2 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_A8L8_UNORM, /* Name */
> > - "MESA_FORMAT_A8L8_UNORM", /* StrName */
> > - GL_LUMINANCE_ALPHA, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 0, 0, 0, 8, /* Red/Green/Blue/AlphaBits */
> > - 8, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 2 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_R8G8_UNORM,
> > - "MESA_FORMAT_R8G8_UNORM",
> > - GL_RG,
> > - GL_UNSIGNED_NORMALIZED,
> > - 8, 8, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > - {
> > - MESA_FORMAT_G8R8_UNORM,
> > - "MESA_FORMAT_G8R8_UNORM",
> > - GL_RG,
> > - GL_UNSIGNED_NORMALIZED,
> > - 8, 8, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > - {
> > - MESA_FORMAT_L4A4_UNORM, /* Name */
> > - "MESA_FORMAT_L4A4_UNORM", /* StrName */
> > - GL_LUMINANCE_ALPHA, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 0, 0, 0, 4, /* Red/Green/Blue/AlphaBits */
> > - 4, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 1 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_B2G3R3_UNORM, /* Name */
> > - "MESA_FORMAT_B2G3R3_UNORM", /* StrName */
> > - GL_RGB, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 3, 3, 2, 0, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 1 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_R16G16_UNORM,
> > - "MESA_FORMAT_R16G16_UNORM",
> > - GL_RG,
> > - GL_UNSIGNED_NORMALIZED,
> > - 16, 16, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_G16R16_UNORM,
> > - "MESA_FORMAT_G16R16_UNORM",
> > - GL_RG,
> > - GL_UNSIGNED_NORMALIZED,
> > - 16, 16, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_B10G10R10A2_UNORM,
> > - "MESA_FORMAT_B10G10R10A2_UNORM",
> > - GL_RGBA,
> > - GL_UNSIGNED_NORMALIZED,
> > - 10, 10, 10, 2,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_B10G10R10X2_UNORM,
> > - "MESA_FORMAT_B10G10R10X2_UNORM",
> > - GL_RGB,
> > - GL_UNSIGNED_NORMALIZED,
> > - 10, 10, 10, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_R10G10B10A2_UNORM,
> > - "MESA_FORMAT_R10G10B10A2_UNORM",
> > - GL_RGBA,
> > - GL_UNSIGNED_NORMALIZED,
> > - 10, 10, 10, 2,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_S8_UINT_Z24_UNORM, /* Name */
> > - "MESA_FORMAT_S8_UINT_Z24_UNORM", /* StrName */
> > - GL_DEPTH_STENCIL, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 24, 8, /*
> Lum/Int/Index/Depth/StencilBits
> > */ - 1, 1, 4 /* BlockWidth/Height,Bytes */
> -
> > },
> > - {
> > - MESA_FORMAT_X8_UINT_Z24_UNORM, /* Name */
> > - "MESA_FORMAT_X8_UINT_Z24_UNORM", /* StrName */
> > - GL_DEPTH_COMPONENT, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 24, 0, /*
> Lum/Int/Index/Depth/StencilBits
> > */ - 1, 1, 4 /* BlockWidth/Height,Bytes */
> -
> > },
> > - {
> > - MESA_FORMAT_Z24_UNORM_S8_UINT, /* Name */
> > - "MESA_FORMAT_Z24_UNORM_S8_UINT", /* StrName */
> > - GL_DEPTH_STENCIL, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 24, 8, /*
> Lum/Int/Index/Depth/StencilBits
> > */ - 1, 1, 4 /* BlockWidth/Height,Bytes */
> -
> > },
> > - {
> > - MESA_FORMAT_Z24_UNORM_X8_UINT, /* Name */
> > - "MESA_FORMAT_Z24_UNORM_X8_UINT", /* StrName */
> > - GL_DEPTH_COMPONENT, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 24, 0, /*
> Lum/Int/Index/Depth/StencilBits
> > */ - 1, 1, 4 /* BlockWidth/Height,Bytes */
> -
> > },
> > - {
> > - MESA_FORMAT_YCBCR, /* Name */
> > - "MESA_FORMAT_YCBCR", /* StrName */
> > - GL_YCBCR_MESA, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 2 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_YCBCR_REV, /* Name */
> > - "MESA_FORMAT_YCBCR_REV", /* StrName */
> > - GL_YCBCR_MESA, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 2 /* BlockWidth/Height,Bytes */
> > - },
> > -
> > - /* Array unorm formats */
> > - {
> > - MESA_FORMAT_A_UNORM8, /* Name */
> > - "MESA_FORMAT_A_UNORM8", /* StrName */
> > - GL_ALPHA, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 0, 0, 0, 8, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 1 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_A_UNORM16, /* Name */
> > - "MESA_FORMAT_A_UNORM16", /* StrName */
> > - GL_ALPHA, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 0, 0, 0, 16, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 2 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_L_UNORM8, /* Name */
> > - "MESA_FORMAT_L_UNORM8", /* StrName */
> > - GL_LUMINANCE, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
> > - 8, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 1 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_L_UNORM16, /* Name */
> > - "MESA_FORMAT_L_UNORM16", /* StrName */
> > - GL_LUMINANCE, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
> > - 16, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 2 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_I_UNORM8, /* Name */
> > - "MESA_FORMAT_I_UNORM8", /* StrName */
> > - GL_INTENSITY, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
> > - 0, 8, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 1 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_I_UNORM16, /* Name */
> > - "MESA_FORMAT_I_UNORM16", /* StrName */
> > - GL_INTENSITY, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
> > - 0, 16, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 2 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_R_UNORM8,
> > - "MESA_FORMAT_R_UNORM8",
> > - GL_RED,
> > - GL_UNSIGNED_NORMALIZED,
> > - 8, 0, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 1
> > - },
> > - {
> > - MESA_FORMAT_R_UNORM16,
> > - "MESA_FORMAT_R_UNORM16",
> > - GL_RED,
> > - GL_UNSIGNED_NORMALIZED,
> > - 16, 0, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > - {
> > - MESA_FORMAT_BGR_UNORM8, /* Name */
> > - "MESA_FORMAT_BGR_UNORM8", /* StrName */
> > - GL_RGB, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 3 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_RGB_UNORM8, /* Name */
> > - "MESA_FORMAT_RGB_UNORM8", /* StrName */
> > - GL_RGB, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 3 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_RGBA_UNORM16,
> > - "MESA_FORMAT_RGBA_UNORM16",
> > - GL_RGBA,
> > - GL_UNSIGNED_NORMALIZED,
> > - 16, 16, 16, 16,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 8
> > - },
> > - {
> > - MESA_FORMAT_RGBX_UNORM16,
> > - "MESA_FORMAT_RGBX_UNORM16",
> > - GL_RGB,
> > - GL_UNSIGNED_NORMALIZED,
> > - 16, 16, 16, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 8
> > - },
> > - {
> > - MESA_FORMAT_Z_UNORM16, /* Name */
> > - "MESA_FORMAT_Z_UNORM16", /* StrName */
> > - GL_DEPTH_COMPONENT, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 16, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 2 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_Z_UNORM32, /* Name */
> > - "MESA_FORMAT_Z_UNORM32", /* StrName */
> > - GL_DEPTH_COMPONENT, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 32, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 4 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_S_UINT8, /* Name */
> > - "MESA_FORMAT_S_UINT8", /* StrName */
> > - GL_STENCIL_INDEX, /* BaseFormat */
> > - GL_UNSIGNED_INT, /* DataType */
> > - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 0, 8, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 1 /* BlockWidth/Height,Bytes */
> > - },
> > -
> > - /* Packed signed/normalized formats */
> > - {
> > - MESA_FORMAT_A8B8G8R8_SNORM,
> > - "MESA_FORMAT_A8B8G8R8_SNORM",
> > - GL_RGBA,
> > - GL_SIGNED_NORMALIZED,
> > - 8, 8, 8, 8,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_X8B8G8R8_SNORM,
> > - "MESA_FORMAT_X8B8G8R8_SNORM",
> > - GL_RGB,
> > - GL_SIGNED_NORMALIZED,
> > - 8, 8, 8, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4 /* 4 bpp, but no alpha */
> > - },
> > - {
> > - MESA_FORMAT_R8G8B8A8_SNORM,
> > - "MESA_FORMAT_R8G8B8A8_SNORM",
> > - GL_RGBA,
> > - GL_SIGNED_NORMALIZED,
> > - 8, 8, 8, 8,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_R8G8B8X8_SNORM,
> > - "MESA_FORMAT_R8G8B8X8_SNORM",
> > - GL_RGB,
> > - GL_SIGNED_NORMALIZED,
> > - 8, 8, 8, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_R16G16_SNORM,
> > - "MESA_FORMAT_R16G16_SNORM",
> > - GL_RG,
> > - GL_SIGNED_NORMALIZED,
> > - 16, 16, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_G16R16_SNORM,
> > - "MESA_FORMAT_G16R16_SNORM",
> > - GL_RG,
> > - GL_SIGNED_NORMALIZED,
> > - 16, 16, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_R8G8_SNORM,
> > - "MESA_FORMAT_R8G8_SNORM",
> > - GL_RG,
> > - GL_SIGNED_NORMALIZED,
> > - 8, 8, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > - {
> > - MESA_FORMAT_G8R8_SNORM,
> > - "MESA_FORMAT_G8R8_SNORM",
> > - GL_RG,
> > - GL_SIGNED_NORMALIZED,
> > - 8, 8, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > - {
> > - MESA_FORMAT_L8A8_SNORM,
> > - "MESA_FORMAT_L8A8_SNORM",
> > - GL_LUMINANCE_ALPHA,
> > - GL_SIGNED_NORMALIZED,
> > - 0, 0, 0, 8,
> > - 8, 0, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > -
> > - /* Array signed/normalized formats */
> > - {
> > - MESA_FORMAT_A_SNORM8,
> > - "MESA_FORMAT_A_SNORM8",
> > - GL_ALPHA,
> > - GL_SIGNED_NORMALIZED,
> > - 0, 0, 0, 8,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 1
> > - },
> > - {
> > - MESA_FORMAT_A_SNORM16,
> > - "MESA_FORMAT_A_SNORM16",
> > - GL_ALPHA,
> > - GL_SIGNED_NORMALIZED,
> > - 0, 0, 0, 16,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > - {
> > - MESA_FORMAT_L_SNORM8,
> > - "MESA_FORMAT_L_SNORM8",
> > - GL_LUMINANCE,
> > - GL_SIGNED_NORMALIZED,
> > - 0, 0, 0, 0,
> > - 8, 0, 0, 0, 0,
> > - 1, 1, 1
> > - },
> > - {
> > - MESA_FORMAT_L_SNORM16,
> > - "MESA_FORMAT_L_SNORM16",
> > - GL_LUMINANCE,
> > - GL_SIGNED_NORMALIZED,
> > - 0, 0, 0, 0,
> > - 16, 0, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > - {
> > - MESA_FORMAT_I_SNORM8,
> > - "MESA_FORMAT_I_SNORM8",
> > - GL_INTENSITY,
> > - GL_SIGNED_NORMALIZED,
> > - 0, 0, 0, 0,
> > - 0, 8, 0, 0, 0,
> > - 1, 1, 1
> > - },
> > - {
> > - MESA_FORMAT_I_SNORM16,
> > - "MESA_FORMAT_I_SNORM16",
> > - GL_INTENSITY,
> > - GL_SIGNED_NORMALIZED,
> > - 0, 0, 0, 0,
> > - 0, 16, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > - {
> > - MESA_FORMAT_R_SNORM8, /* Name */
> > - "MESA_FORMAT_R_SNORM8", /* StrName */
> > - GL_RED, /* BaseFormat */
> > - GL_SIGNED_NORMALIZED, /* DataType */
> > - 8, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits
> */
> > - 1, 1, 1 /* BlockWidth/Height,Bytes */
> > - },
> > - {
> > - MESA_FORMAT_R_SNORM16,
> > - "MESA_FORMAT_R_SNORM16",
> > - GL_RED,
> > - GL_SIGNED_NORMALIZED,
> > - 16, 0, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > - {
> > - MESA_FORMAT_LA_SNORM16,
> > - "MESA_FORMAT_LA_SNORM16",
> > - GL_LUMINANCE_ALPHA,
> > - GL_SIGNED_NORMALIZED,
> > - 0, 0, 0, 16,
> > - 16, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_RGB_SNORM16,
> > - "MESA_FORMAT_RGB_SNORM16",
> > - GL_RGB,
> > - GL_SIGNED_NORMALIZED,
> > - 16, 16, 16, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 6
> > - },
> > - {
> > - MESA_FORMAT_RGBA_SNORM16,
> > - "MESA_FORMAT_RGBA_SNORM16",
> > - GL_RGBA,
> > - GL_SIGNED_NORMALIZED,
> > - 16, 16, 16, 16,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 8
> > - },
> > - {
> > - MESA_FORMAT_RGBX_SNORM16,
> > - "MESA_FORMAT_RGBX_SNORM16",
> > - GL_RGB,
> > - GL_SIGNED_NORMALIZED,
> > - 16, 16, 16, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 8
> > - },
> > -
> > - /* Packed sRGB formats */
> > - {
> > - MESA_FORMAT_A8B8G8R8_SRGB,
> > - "MESA_FORMAT_A8B8G8R8_SRGB",
> > - GL_RGBA,
> > - GL_UNSIGNED_NORMALIZED,
> > - 8, 8, 8, 8,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_B8G8R8A8_SRGB,
> > - "MESA_FORMAT_B8G8R8A8_SRGB",
> > - GL_RGBA,
> > - GL_UNSIGNED_NORMALIZED,
> > - 8, 8, 8, 8,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_B8G8R8X8_SRGB,
> > - "MESA_FORMAT_B8G8R8X8_SRGB",
> > - GL_RGB,
> > - GL_UNSIGNED_NORMALIZED,
> > - 8, 8, 8, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_R8G8B8A8_SRGB,
> > - "MESA_FORMAT_R8G8B8A8_SRGB",
> > - GL_RGBA,
> > - GL_UNSIGNED_NORMALIZED,
> > - 8, 8, 8, 8,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_R8G8B8X8_SRGB,
> > - "MESA_FORMAT_R8G8B8X8_SRGB",
> > - GL_RGB,
> > - GL_UNSIGNED_NORMALIZED,
> > - 8, 8, 8, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_L8A8_SRGB,
> > - "MESA_FORMAT_L8A8_SRGB",
> > - GL_LUMINANCE_ALPHA,
> > - GL_UNSIGNED_NORMALIZED,
> > - 0, 0, 0, 8,
> > - 8, 0, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > -
> > - /* Array sRGB formats */
> > - {
> > - MESA_FORMAT_L_SRGB8,
> > - "MESA_FORMAT_L_SRGB8",
> > - GL_LUMINANCE,
> > - GL_UNSIGNED_NORMALIZED,
> > - 0, 0, 0, 0,
> > - 8, 0, 0, 0, 0,
> > - 1, 1, 1
> > - },
> > - {
> > - MESA_FORMAT_BGR_SRGB8,
> > - "MESA_FORMAT_BGR_SRGB8",
> > - GL_RGB,
> > - GL_UNSIGNED_NORMALIZED,
> > - 8, 8, 8, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 3
> > - },
> > -
> > - /* Packed float formats */
> > - {
> > - MESA_FORMAT_R9G9B9E5_FLOAT,
> > - "MESA_FORMAT_RGB9_E5",
> > - GL_RGB,
> > - GL_FLOAT,
> > - 9, 9, 9, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_R11G11B10_FLOAT,
> > - "MESA_FORMAT_R11G11B10_FLOAT",
> > - GL_RGB,
> > - GL_FLOAT,
> > - 11, 11, 10, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_Z32_FLOAT_S8X24_UINT, /* Name */
> > - "MESA_FORMAT_Z32_FLOAT_S8X24_UINT", /* StrName */
> > - GL_DEPTH_STENCIL, /* BaseFormat */
> > - /* DataType here is used to answer GL_TEXTURE_DEPTH_TYPE queries,
> and
> > is - * never used for stencil because stencil is always
> > GL_UNSIGNED_INT. - */
> > - GL_FLOAT, /* DataType */
> > - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 32, 8, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 8 /* BlockWidth/Height,Bytes */
> > - },
> > -
> > - /* Array float formats */
> > - {
> > - MESA_FORMAT_A_FLOAT16,
> > - "MESA_FORMAT_A_FLOAT16",
> > - GL_ALPHA,
> > - GL_FLOAT,
> > - 0, 0, 0, 16,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > - {
> > - MESA_FORMAT_A_FLOAT32,
> > - "MESA_FORMAT_A_FLOAT32",
> > - GL_ALPHA,
> > - GL_FLOAT,
> > - 0, 0, 0, 32,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_L_FLOAT16,
> > - "MESA_FORMAT_L_FLOAT16",
> > - GL_LUMINANCE,
> > - GL_FLOAT,
> > - 0, 0, 0, 0,
> > - 16, 0, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > - {
> > - MESA_FORMAT_L_FLOAT32,
> > - "MESA_FORMAT_L_FLOAT32",
> > - GL_LUMINANCE,
> > - GL_FLOAT,
> > - 0, 0, 0, 0,
> > - 32, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_LA_FLOAT16,
> > - "MESA_FORMAT_LA_FLOAT16",
> > - GL_LUMINANCE_ALPHA,
> > - GL_FLOAT,
> > - 0, 0, 0, 16,
> > - 16, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_LA_FLOAT32,
> > - "MESA_FORMAT_LA_FLOAT32",
> > - GL_LUMINANCE_ALPHA,
> > - GL_FLOAT,
> > - 0, 0, 0, 32,
> > - 32, 0, 0, 0, 0,
> > - 1, 1, 8
> > - },
> > - {
> > - MESA_FORMAT_I_FLOAT16,
> > - "MESA_FORMAT_I_FLOAT16",
> > - GL_INTENSITY,
> > - GL_FLOAT,
> > - 0, 0, 0, 0,
> > - 0, 16, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > - {
> > - MESA_FORMAT_I_FLOAT32,
> > - "MESA_FORMAT_I_FLOAT32",
> > - GL_INTENSITY,
> > - GL_FLOAT,
> > - 0, 0, 0, 0,
> > - 0, 32, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_R_FLOAT16,
> > - "MESA_FORMAT_R_FLOAT16",
> > - GL_RED,
> > - GL_FLOAT,
> > - 16, 0, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > - {
> > - MESA_FORMAT_R_FLOAT32,
> > - "MESA_FORMAT_R_FLOAT32",
> > - GL_RED,
> > - GL_FLOAT,
> > - 32, 0, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_RG_FLOAT16,
> > - "MESA_FORMAT_RG_FLOAT16",
> > - GL_RG,
> > - GL_FLOAT,
> > - 16, 16, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_RG_FLOAT32,
> > - "MESA_FORMAT_RG_FLOAT32",
> > - GL_RG,
> > - GL_FLOAT,
> > - 32, 32, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 8
> > - },
> > - {
> > - MESA_FORMAT_RGB_FLOAT16,
> > - "MESA_FORMAT_RGB_FLOAT16",
> > - GL_RGB,
> > - GL_FLOAT,
> > - 16, 16, 16, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 6
> > - },
> > - {
> > - MESA_FORMAT_RGB_FLOAT32,
> > - "MESA_FORMAT_RGB_FLOAT32",
> > - GL_RGB,
> > - GL_FLOAT,
> > - 32, 32, 32, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 12
> > - },
> > - {
> > - MESA_FORMAT_RGBA_FLOAT16,
> > - "MESA_FORMAT_RGBA_FLOAT16",
> > - GL_RGBA,
> > - GL_FLOAT,
> > - 16, 16, 16, 16,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 8
> > - },
> > - {
> > - MESA_FORMAT_RGBA_FLOAT32,
> > - "MESA_FORMAT_RGBA_FLOAT32",
> > - GL_RGBA,
> > - GL_FLOAT,
> > - 32, 32, 32, 32,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 16
> > - },
> > - {
> > - MESA_FORMAT_RGBX_FLOAT16,
> > - "MESA_FORMAT_RGBX_FLOAT16",
> > - GL_RGB,
> > - GL_FLOAT,
> > - 16, 16, 16, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 8
> > - },
> > - {
> > - MESA_FORMAT_RGBX_FLOAT32,
> > - "MESA_FORMAT_RGBX_FLOAT32",
> > - GL_RGB,
> > - GL_FLOAT,
> > - 32, 32, 32, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 16
> > - },
> > - {
> > - MESA_FORMAT_Z_FLOAT32, /* Name */
> > - "MESA_FORMAT_Z_FLOAT32", /* StrName */
> > - GL_DEPTH_COMPONENT, /* BaseFormat */
> > - GL_FLOAT, /* DataType */
> > - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 32, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 1, 1, 4 /* BlockWidth/Height,Bytes */
> > - },
> > -
> > - /* Packed signed/unsigned non-normalized integer formats */
> > - {
> > - MESA_FORMAT_B10G10R10A2_UINT,
> > - "MESA_FORMAT_B10G10R10A2_UINT",
> > - GL_RGBA,
> > - GL_UNSIGNED_INT,
> > - 10, 10, 10, 2,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_R10G10B10A2_UINT,
> > - "MESA_FORMAT_R10G10B10A2_UINT",
> > - GL_RGBA,
> > - GL_UNSIGNED_INT,
> > - 10, 10, 10, 2,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > -
> > - /* Array signed/unsigned non-normalized integer formats */
> > - {
> > - MESA_FORMAT_A_UINT8,
> > - "MESA_FORMAT_A_UINT8",
> > - GL_ALPHA,
> > - GL_UNSIGNED_INT,
> > - 0, 0, 0, 8,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 1
> > - },
> > - {
> > - MESA_FORMAT_A_UINT16,
> > - "MESA_FORMAT_A_UINT16",
> > - GL_ALPHA,
> > - GL_UNSIGNED_INT,
> > - 0, 0, 0, 16,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > - {
> > - MESA_FORMAT_A_UINT32,
> > - "MESA_FORMAT_A_UINT32",
> > - GL_ALPHA,
> > - GL_UNSIGNED_INT,
> > - 0, 0, 0, 32,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_A_SINT8,
> > - "MESA_FORMAT_A_SINT8",
> > - GL_ALPHA,
> > - GL_INT,
> > - 0, 0, 0, 8,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 1
> > - },
> > - {
> > - MESA_FORMAT_A_SINT16,
> > - "MESA_FORMAT_A_SINT16",
> > - GL_ALPHA,
> > - GL_INT,
> > - 0, 0, 0, 16,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > - {
> > - MESA_FORMAT_A_SINT32,
> > - "MESA_FORMAT_A_SINT32",
> > - GL_ALPHA,
> > - GL_INT,
> > - 0, 0, 0, 32,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_I_UINT8,
> > - "MESA_FORMAT_I_UINT8",
> > - GL_INTENSITY,
> > - GL_UNSIGNED_INT,
> > - 0, 0, 0, 0,
> > - 0, 8, 0, 0, 0,
> > - 1, 1, 1
> > - },
> > - {
> > - MESA_FORMAT_I_UINT16,
> > - "MESA_FORMAT_I_UINT16",
> > - GL_INTENSITY,
> > - GL_UNSIGNED_INT,
> > - 0, 0, 0, 0,
> > - 0, 16, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > - {
> > - MESA_FORMAT_I_UINT32,
> > - "MESA_FORMAT_I_UINT32",
> > - GL_INTENSITY,
> > - GL_UNSIGNED_INT,
> > - 0, 0, 0, 0,
> > - 0, 32, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_I_SINT8,
> > - "MESA_FORMAT_I_SINT8",
> > - GL_INTENSITY,
> > - GL_INT,
> > - 0, 0, 0, 0,
> > - 0, 8, 0, 0, 0,
> > - 1, 1, 1
> > - },
> > - {
> > - MESA_FORMAT_I_SINT16,
> > - "MESA_FORMAT_I_SINT16",
> > - GL_INTENSITY,
> > - GL_INT,
> > - 0, 0, 0, 0,
> > - 0, 16, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > - {
> > - MESA_FORMAT_I_SINT32,
> > - "MESA_FORMAT_I_SINT32",
> > - GL_INTENSITY,
> > - GL_INT,
> > - 0, 0, 0, 0,
> > - 0, 32, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_L_UINT8,
> > - "MESA_FORMAT_L_UINT8",
> > - GL_LUMINANCE,
> > - GL_UNSIGNED_INT,
> > - 0, 0, 0, 0,
> > - 8, 0, 0, 0, 0,
> > - 1, 1, 1
> > - },
> > - {
> > - MESA_FORMAT_L_UINT16,
> > - "MESA_FORMAT_L_UINT16",
> > - GL_LUMINANCE,
> > - GL_UNSIGNED_INT,
> > - 0, 0, 0, 0,
> > - 16, 0, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > - {
> > - MESA_FORMAT_L_UINT32,
> > - "MESA_FORMAT_L_UINT32",
> > - GL_LUMINANCE,
> > - GL_UNSIGNED_INT,
> > - 0, 0, 0, 0,
> > - 32, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_L_SINT8,
> > - "MESA_FORMAT_L_SINT8",
> > - GL_LUMINANCE,
> > - GL_INT,
> > - 0, 0, 0, 0,
> > - 8, 0, 0, 0, 0,
> > - 1, 1, 1
> > - },
> > - {
> > - MESA_FORMAT_L_SINT16,
> > - "MESA_FORMAT_L_SINT16",
> > - GL_LUMINANCE,
> > - GL_INT,
> > - 0, 0, 0, 0,
> > - 16, 0, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > - {
> > - MESA_FORMAT_L_SINT32,
> > - "MESA_FORMAT_L_SINT32",
> > - GL_LUMINANCE,
> > - GL_INT,
> > - 0, 0, 0, 0,
> > - 32, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_LA_UINT8,
> > - "MESA_FORMAT_LA_UINT8",
> > - GL_LUMINANCE_ALPHA,
> > - GL_UNSIGNED_INT,
> > - 0, 0, 0, 8,
> > - 8, 0, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > - {
> > - MESA_FORMAT_LA_UINT16,
> > - "MESA_FORMAT_LA_UINT16",
> > - GL_LUMINANCE_ALPHA,
> > - GL_UNSIGNED_INT,
> > - 0, 0, 0, 16,
> > - 16, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_LA_UINT32,
> > - "MESA_FORMAT_LA_UINT32",
> > - GL_LUMINANCE_ALPHA,
> > - GL_UNSIGNED_INT,
> > - 0, 0, 0, 32,
> > - 32, 0, 0, 0, 0,
> > - 1, 1, 8
> > - },
> > - {
> > - MESA_FORMAT_LA_SINT8,
> > - "MESA_FORMAT_LA_SINT8",
> > - GL_LUMINANCE_ALPHA,
> > - GL_INT,
> > - 0, 0, 0, 8,
> > - 8, 0, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > - {
> > - MESA_FORMAT_LA_SINT16,
> > - "MESA_FORMAT_LA_SINT16",
> > - GL_LUMINANCE_ALPHA,
> > - GL_INT,
> > - 0, 0, 0, 16,
> > - 16, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_LA_SINT32,
> > - "MESA_FORMAT_LA_SINT32",
> > - GL_LUMINANCE_ALPHA,
> > - GL_INT,
> > - 0, 0, 0, 32,
> > - 32, 0, 0, 0, 0,
> > - 1, 1, 8
> > - },
> > - {
> > - MESA_FORMAT_R_UINT8,
> > - "MESA_FORMAT_R_UINT8",
> > - GL_RED,
> > - GL_UNSIGNED_INT,
> > - 8, 0, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 1
> > - },
> > - {
> > - MESA_FORMAT_R_UINT16,
> > - "MESA_FORMAT_R_UINT16",
> > - GL_RED,
> > - GL_UNSIGNED_INT,
> > - 16, 0, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > - {
> > - MESA_FORMAT_R_UINT32,
> > - "MESA_FORMAT_R_UINT32",
> > - GL_RED,
> > - GL_UNSIGNED_INT,
> > - 32, 0, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_R_SINT8,
> > - "MESA_FORMAT_R_SINT8",
> > - GL_RED,
> > - GL_INT,
> > - 8, 0, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 1
> > - },
> > - {
> > - MESA_FORMAT_R_SINT16,
> > - "MESA_FORMAT_R_SINT16",
> > - GL_RED,
> > - GL_INT,
> > - 16, 0, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > - {
> > - MESA_FORMAT_R_SINT32,
> > - "MESA_FORMAT_R_SINT32",
> > - GL_RED,
> > - GL_INT,
> > - 32, 0, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_RG_UINT8,
> > - "MESA_FORMAT_RG_UINT8",
> > - GL_RG,
> > - GL_UNSIGNED_INT,
> > - 8, 8, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > - {
> > - MESA_FORMAT_RG_UINT16,
> > - "MESA_FORMAT_RG_UINT16",
> > - GL_RG,
> > - GL_UNSIGNED_INT,
> > - 16, 16, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_RG_UINT32,
> > - "MESA_FORMAT_RG_UINT32",
> > - GL_RG,
> > - GL_UNSIGNED_INT,
> > - 32, 32, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 8
> > - },
> > - {
> > - MESA_FORMAT_RG_SINT8,
> > - "MESA_FORMAT_RG_SINT8",
> > - GL_RG,
> > - GL_INT,
> > - 8, 8, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 2
> > - },
> > - {
> > - MESA_FORMAT_RG_SINT16,
> > - "MESA_FORMAT_RG_SINT16",
> > - GL_RG,
> > - GL_INT,
> > - 16, 16, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_RG_SINT32,
> > - "MESA_FORMAT_RG_SINT32",
> > - GL_RG,
> > - GL_INT,
> > - 32, 32, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 8
> > - },
> > - {
> > - MESA_FORMAT_RGB_UINT8,
> > - "MESA_FORMAT_RGB_UINT8",
> > - GL_RGB,
> > - GL_UNSIGNED_INT,
> > - 8, 8, 8, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 3
> > - },
> > - {
> > - MESA_FORMAT_RGB_UINT16,
> > - "MESA_FORMAT_RGB_UINT16",
> > - GL_RGB,
> > - GL_UNSIGNED_INT,
> > - 16, 16, 16, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 6
> > - },
> > - {
> > - MESA_FORMAT_RGB_UINT32,
> > - "MESA_FORMAT_RGB_UINT32",
> > - GL_RGB,
> > - GL_UNSIGNED_INT,
> > - 32, 32, 32, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 12
> > - },
> > - {
> > - MESA_FORMAT_RGB_SINT8,
> > - "MESA_FORMAT_RGB_SINT8",
> > - GL_RGB,
> > - GL_INT,
> > - 8, 8, 8, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 3
> > - },
> > - {
> > - MESA_FORMAT_RGB_SINT16,
> > - "MESA_FORMAT_RGB_SINT16",
> > - GL_RGB,
> > - GL_INT,
> > - 16, 16, 16, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 6
> > - },
> > - {
> > - MESA_FORMAT_RGB_SINT32,
> > - "MESA_FORMAT_RGB_SINT32",
> > - GL_RGB,
> > - GL_INT,
> > - 32, 32, 32, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 12
> > - },
> > - {
> > - MESA_FORMAT_RGBA_UINT8,
> > - "MESA_FORMAT_RGBA_UINT8",
> > - GL_RGBA,
> > - GL_UNSIGNED_INT,
> > - 8, 8, 8, 8,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_RGBA_UINT16,
> > - "MESA_FORMAT_RGBA_UINT16",
> > - GL_RGBA,
> > - GL_UNSIGNED_INT,
> > - 16, 16, 16, 16,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 8
> > - },
> > - {
> > - MESA_FORMAT_RGBA_UINT32,
> > - "MESA_FORMAT_RGBA_UINT32",
> > - GL_RGBA,
> > - GL_UNSIGNED_INT,
> > - 32, 32, 32, 32,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 16
> > - },
> > - {
> > - MESA_FORMAT_RGBA_SINT8,
> > - "MESA_FORMAT_RGBA_SINT8",
> > - GL_RGBA,
> > - GL_INT,
> > - 8, 8, 8, 8,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_RGBA_SINT16,
> > - "MESA_FORMAT_RGBA_SINT16",
> > - GL_RGBA,
> > - GL_INT,
> > - 16, 16, 16, 16,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 8
> > - },
> > - {
> > - MESA_FORMAT_RGBA_SINT32,
> > - "MESA_FORMAT_RGBA_SINT32",
> > - GL_RGBA,
> > - GL_INT,
> > - 32, 32, 32, 32,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 16
> > - },
> > - {
> > - MESA_FORMAT_RGBX_UINT8,
> > - "MESA_FORMAT_RGBX_UINT8",
> > - GL_RGB,
> > - GL_UNSIGNED_INT,
> > - 8, 8, 8, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_RGBX_UINT16,
> > - "MESA_FORMAT_RGBX_UINT16",
> > - GL_RGB,
> > - GL_UNSIGNED_INT,
> > - 16, 16, 16, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 8
> > - },
> > - {
> > - MESA_FORMAT_RGBX_UINT32,
> > - "MESA_FORMAT_RGBX_UINT32",
> > - GL_RGB,
> > - GL_UNSIGNED_INT,
> > - 32, 32, 32, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 16
> > - },
> > - {
> > - MESA_FORMAT_RGBX_SINT8,
> > - "MESA_FORMAT_RGBX_SINT8",
> > - GL_RGB,
> > - GL_INT,
> > - 8, 8, 8, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 4
> > - },
> > - {
> > - MESA_FORMAT_RGBX_SINT16,
> > - "MESA_FORMAT_RGBX_SINT16",
> > - GL_RGB,
> > - GL_INT,
> > - 16, 16, 16, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 8
> > - },
> > - {
> > - MESA_FORMAT_RGBX_SINT32,
> > - "MESA_FORMAT_RGBX_SINT32",
> > - GL_RGB,
> > - GL_INT,
> > - 32, 32, 32, 0,
> > - 0, 0, 0, 0, 0,
> > - 1, 1, 16
> > - },
> > -
> > - /* DXT compressed formats */
> > - {
> > - MESA_FORMAT_RGB_DXT1, /* Name */
> > - "MESA_FORMAT_RGB_DXT1", /* StrName */
> > - GL_RGB, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 4, 4, 4, 0, /* approx Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 4, 4, 8 /* 8 bytes per 4x4 block */
> > - },
> > - {
> > - MESA_FORMAT_RGBA_DXT1,
> > - "MESA_FORMAT_RGBA_DXT1",
> > - GL_RGBA,
> > - GL_UNSIGNED_NORMALIZED,
> > - 4, 4, 4, 4,
> > - 0, 0, 0, 0, 0,
> > - 4, 4, 8 /* 8 bytes per 4x4 block */
> > - },
> > - {
> > - MESA_FORMAT_RGBA_DXT3,
> > - "MESA_FORMAT_RGBA_DXT3",
> > - GL_RGBA,
> > - GL_UNSIGNED_NORMALIZED,
> > - 4, 4, 4, 4,
> > - 0, 0, 0, 0, 0,
> > - 4, 4, 16 /* 16 bytes per 4x4 block */
> > - },
> > - {
> > - MESA_FORMAT_RGBA_DXT5,
> > - "MESA_FORMAT_RGBA_DXT5",
> > - GL_RGBA,
> > - GL_UNSIGNED_NORMALIZED,
> > - 4, 4, 4, 4,
> > - 0, 0, 0, 0, 0,
> > - 4, 4, 16 /* 16 bytes per 4x4 block */
> > - },
> > -
> > - /* DXT sRGB compressed formats */
> > - {
> > - MESA_FORMAT_SRGB_DXT1, /* Name */
> > - "MESA_FORMAT_SRGB_DXT1", /* StrName */
> > - GL_RGB, /* BaseFormat */
> > - GL_UNSIGNED_NORMALIZED, /* DataType */
> > - 4, 4, 4, 0, /* approx Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
> > - 4, 4, 8 /* 8 bytes per 4x4 block */
> > - },
> > - {
> > - MESA_FORMAT_SRGBA_DXT1,
> > - "MESA_FORMAT_SRGBA_DXT1",
> > - GL_RGBA,
> > - GL_UNSIGNED_NORMALIZED,
> > - 4, 4, 4, 4,
> > - 0, 0, 0, 0, 0,
> > - 4, 4, 8 /* 8 bytes per 4x4 block */
> > - },
> > - {
> > - MESA_FORMAT_SRGBA_DXT3,
> > - "MESA_FORMAT_SRGBA_DXT3",
> > - GL_RGBA,
> > - GL_UNSIGNED_NORMALIZED,
> > - 4, 4, 4, 4,
> > - 0, 0, 0, 0, 0,
> > - 4, 4, 16 /* 16 bytes per 4x4 block */
> > - },
> > - {
> > - MESA_FORMAT_SRGBA_DXT5,
> > - "MESA_FORMAT_SRGBA_DXT5",
> > - GL_RGBA,
> > - GL_UNSIGNED_NORMALIZED,
> > - 4, 4, 4, 4,
> > - 0, 0, 0, 0, 0,
> > - 4, 4, 16 /* 16 bytes per 4x4 block */
> > - },
> > -
> > - /* FXT1 compressed formats */
> > - {
> > - MESA_FORMAT_RGB_FXT1,
> > - "MESA_FORMAT_RGB_FXT1",
> > - GL_RGB,
> > - GL_UNSIGNED_NORMALIZED,
> > - 4, 4, 4, 0, /* approx Red/Green/BlueBits */
> > - 0, 0, 0, 0, 0,
> > - 8, 4, 16 /* 16 bytes per 8x4 block */
> > - },
> > - {
> > - MESA_FORMAT_RGBA_FXT1,
> > - "MESA_FORMAT_RGBA_FXT1",
> > - GL_RGBA,
> > - GL_UNSIGNED_NORMALIZED,
> > - 4, 4, 4, 1, /* approx Red/Green/Blue/AlphaBits */
> > - 0, 0, 0, 0, 0,
> > - 8, 4, 16 /* 16 bytes per 8x4 block */
> > - },
> > -
> > - /* RGTC compressed formats */
> > - {
> > - MESA_FORMAT_R_RGTC1_UNORM,
> > - "MESA_FORMAT_R_RGTC1_UNORM",
> > - GL_RED,
> > - GL_UNSIGNED_NORMALIZED,
> > - 8, 0, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 4, 4, 8 /* 8 bytes per 4x4 block */
> > - },
> > - {
> > - MESA_FORMAT_R_RGTC1_SNORM,
> > - "MESA_FORMAT_R_RGTC1_SNORM",
> > - GL_RED,
> > - GL_SIGNED_NORMALIZED,
> > - 8, 0, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 4, 4, 8 /* 8 bytes per 4x4 block */
> > - },
> > - {
> > - MESA_FORMAT_RG_RGTC2_UNORM,
> > - "MESA_FORMAT_RG_RGTC2_UNORM",
> > - GL_RG,
> > - GL_UNSIGNED_NORMALIZED,
> > - 8, 8, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 4, 4, 16 /* 16 bytes per 4x4 block */
> > - },
> > - {
> > - MESA_FORMAT_RG_RGTC2_SNORM,
> > - "MESA_FORMAT_RG_RGTC2_SNORM",
> > - GL_RG,
> > - GL_SIGNED_NORMALIZED,
> > - 8, 8, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 4, 4, 16 /* 16 bytes per 4x4 block */
> > - },
> > -
> > - /* LATC1/2 compressed formats */
> > - {
> > - MESA_FORMAT_L_LATC1_UNORM,
> > - "MESA_FORMAT_L_LATC1_UNORM",
> > - GL_LUMINANCE,
> > - GL_UNSIGNED_NORMALIZED,
> > - 0, 0, 0, 0,
> > - 4, 0, 0, 0, 0,
> > - 4, 4, 8 /* 8 bytes per 4x4 block */
> > - },
> > - {
> > - MESA_FORMAT_L_LATC1_SNORM,
> > - "MESA_FORMAT_L_LATC1_SNORM",
> > - GL_LUMINANCE,
> > - GL_SIGNED_NORMALIZED,
> > - 0, 0, 0, 0,
> > - 4, 0, 0, 0, 0,
> > - 4, 4, 8 /* 8 bytes per 4x4 block */
> > - },
> > - {
> > - MESA_FORMAT_LA_LATC2_UNORM,
> > - "MESA_FORMAT_LA_LATC2_UNORM",
> > - GL_LUMINANCE_ALPHA,
> > - GL_UNSIGNED_NORMALIZED,
> > - 0, 0, 0, 4,
> > - 4, 0, 0, 0, 0,
> > - 4, 4, 16 /* 16 bytes per 4x4 block */
> > - },
> > - {
> > - MESA_FORMAT_LA_LATC2_SNORM,
> > - "MESA_FORMAT_LA_LATC2_SNORM",
> > - GL_LUMINANCE_ALPHA,
> > - GL_SIGNED_NORMALIZED,
> > - 0, 0, 0, 4,
> > - 4, 0, 0, 0, 0,
> > - 4, 4, 16 /* 16 bytes per 4x4 block */
> > - },
> > -
> > - /* ETC1/2 compressed formats */
> > - {
> > - MESA_FORMAT_ETC1_RGB8,
> > - "MESA_FORMAT_ETC1_RGB8",
> > - GL_RGB,
> > - GL_UNSIGNED_NORMALIZED,
> > - 8, 8, 8, 0,
> > - 0, 0, 0, 0, 0,
> > - 4, 4, 8 /* 8 bytes per 4x4 block */
> > - },
> > - {
> > - MESA_FORMAT_ETC2_RGB8,
> > - "MESA_FORMAT_ETC2_RGB8",
> > - GL_RGB,
> > - GL_UNSIGNED_NORMALIZED,
> > - 8, 8, 8, 0,
> > - 0, 0, 0, 0, 0,
> > - 4, 4, 8 /* 8 bytes per 4x4 block */
> > - },
> > - {
> > - MESA_FORMAT_ETC2_SRGB8,
> > - "MESA_FORMAT_ETC2_SRGB8",
> > - GL_RGB,
> > - GL_UNSIGNED_NORMALIZED,
> > - 8, 8, 8, 0,
> > - 0, 0, 0, 0, 0,
> > - 4, 4, 8 /* 8 bytes per 4x4 block */
> > - },
> > - {
> > - MESA_FORMAT_ETC2_RGBA8_EAC,
> > - "MESA_FORMAT_ETC2_RGBA8_EAC",
> > - GL_RGBA,
> > - GL_UNSIGNED_NORMALIZED,
> > - 8, 8, 8, 8,
> > - 0, 0, 0, 0, 0,
> > - 4, 4, 16 /* 16 bytes per 4x4 block */
> > - },
> > - {
> > - MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC,
> > - "MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC",
> > - GL_RGBA,
> > - GL_UNSIGNED_NORMALIZED,
> > - 8, 8, 8, 8,
> > - 0, 0, 0, 0, 0,
> > - 4, 4, 16 /* 16 bytes per 4x4 block */
> > - },
> > - {
> > - MESA_FORMAT_ETC2_R11_EAC,
> > - "MESA_FORMAT_ETC2_R11_EAC",
> > - GL_RED,
> > - GL_UNSIGNED_NORMALIZED,
> > - 11, 0, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 4, 4, 8 /* 8 bytes per 4x4 block */
> > - },
> > - {
> > - MESA_FORMAT_ETC2_RG11_EAC,
> > - "MESA_FORMAT_ETC2_RG11_EAC",
> > - GL_RG,
> > - GL_UNSIGNED_NORMALIZED,
> > - 11, 11, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 4, 4, 16 /* 16 bytes per 4x4 block */
> > - },
> > - {
> > - MESA_FORMAT_ETC2_SIGNED_R11_EAC,
> > - "MESA_FORMAT_ETC2_SIGNED_R11_EAC",
> > - GL_RED,
> > - GL_SIGNED_NORMALIZED,
> > - 11, 0, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 4, 4, 8 /* 8 bytes per 4x4 block */
> > - },
> > - {
> > - MESA_FORMAT_ETC2_SIGNED_RG11_EAC,
> > - "MESA_FORMAT_ETC2_SIGNED_RG11_EAC",
> > - GL_RG,
> > - GL_SIGNED_NORMALIZED,
> > - 11, 11, 0, 0,
> > - 0, 0, 0, 0, 0,
> > - 4, 4, 16 /* 16 bytes per 4x4 block */
> > - },
> > - {
> > - MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1,
> > - "MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1",
> > - GL_RGBA,
> > - GL_UNSIGNED_NORMALIZED,
> > - 8, 8, 8, 1,
> > - 0, 0, 0, 0, 0,
> > - 4, 4, 8 /* 8 bytes per 4x4 block */
> > - },
> > - {
> > - MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1,
> > - "MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1",
> > - GL_RGBA,
> > - GL_UNSIGNED_NORMALIZED,
> > - 8, 8, 8, 1,
> > - 0, 0, 0, 0, 0,
> > - 4, 4, 8 /* 8 bytes per 4x4 block */
> > - },
> > -};
> > -
> > -
> > +#include "format_info.c"
> >
> > static const struct gl_format_info *
> > _mesa_get_format_info(mesa_format format)
> > @@ -2331,7 +595,6 @@ check_format_to_type_and_comps(void)
> > }
> > }
> >
> > -
> > /**
> > * Do sanity checking of the format info table.
> > */
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140801/f2e22341/attachment-0001.html>
More information about the mesa-dev
mailing list