[Mesa-dev] [PATCH v2 03/13] mesa/formats: Autogenerate the format_info structure from a CSV file

Jason Ekstrand jason at jlekstrand.net
Sat Aug 2 13:11:22 PDT 2014


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>
---
 src/mesa/Makefile.am         |   10 +
 src/mesa/main/.gitignore     |    1 +
 src/mesa/main/format_info.py |  181 +++++
 src/mesa/main/formats.c      | 1739 +-----------------------------------------
 4 files changed, 193 insertions(+), 1738 deletions(-)
 create mode 100644 src/mesa/main/format_info.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/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.
  */
-- 
2.0.4



More information about the mesa-dev mailing list