mesa: fix a few format table mistakes, assertions
authorBrian Paul <brianp@vmware.com>
Tue, 11 Jan 2011 16:23:45 +0000 (09:23 -0700)
committerBrian Paul <brianp@vmware.com>
Tue, 11 Jan 2011 16:27:06 +0000 (09:27 -0700)
The BaseFormat field was incorrect for a few R and RG formats.
Fix a couple assertions too.

NOTE: This is a candidate for the 7.9 and 7.10 branches.

src/mesa/main/formats.c

index 4eb2c35..514fe7a 100644 (file)
@@ -802,7 +802,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
    {
       MESA_FORMAT_SIGNED_R8,        /* Name */
       "MESA_FORMAT_SIGNED_R8",      /* StrName */
-      GL_RGBA,                      /* BaseFormat */
+      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 */
@@ -811,7 +811,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
    {
       MESA_FORMAT_SIGNED_RG88,
       "MESA_FORMAT_SIGNED_RG88",
-      GL_RGBA,
+      GL_RG,
       GL_SIGNED_NORMALIZED,
       8, 8, 0, 0,
       0, 0, 0, 0, 0,
@@ -820,7 +820,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
    {
       MESA_FORMAT_SIGNED_RGBX8888,
       "MESA_FORMAT_SIGNED_RGBX8888",
-      GL_RGBA,
+      GL_RGB,
       GL_SIGNED_NORMALIZED,
       8, 8, 8, 0,
       0, 0, 0, 0, 0,
@@ -849,7 +849,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
    {
       MESA_FORMAT_SIGNED_R_16,
       "MESA_FORMAT_SIGNED_R_16",
-      GL_RGBA,
+      GL_RED,
       GL_SIGNED_NORMALIZED,
       16, 0, 0, 0,
       0, 0, 0, 0, 0,
@@ -858,7 +858,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
    {
       MESA_FORMAT_SIGNED_RG_16,
       "MESA_FORMAT_SIGNED_RG_16",
-      GL_RGBA,
+      GL_RG,
       GL_SIGNED_NORMALIZED,
       16, 16, 0, 0,
       0, 0, 0, 0, 0,
@@ -867,7 +867,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
    {
       MESA_FORMAT_SIGNED_RGB_16,
       "MESA_FORMAT_SIGNED_RGB_16",
-      GL_RGBA,
+      GL_RGB,
       GL_SIGNED_NORMALIZED,
       16, 16, 16, 0,
       0, 0, 0, 0, 0,
@@ -1192,7 +1192,7 @@ _mesa_test_formats(void)
          if (info->RedBits > 0) {
             GLuint t = info->RedBits + info->GreenBits
                + info->BlueBits + info->AlphaBits;
-            assert(t / 8 == info->BytesPerBlock);
+            assert(t / 8 <= info->BytesPerBlock);
             (void) t;
          }
       }
@@ -1200,6 +1200,7 @@ _mesa_test_formats(void)
       assert(info->DataType == GL_UNSIGNED_NORMALIZED ||
              info->DataType == GL_SIGNED_NORMALIZED ||
              info->DataType == GL_UNSIGNED_INT ||
+             info->DataType == GL_INT ||
              info->DataType == GL_FLOAT);
 
       if (info->BaseFormat == GL_RGB) {