mesa: fix a glGetTexImage issue with base-converted texture formats
authorRoland Scheidegger <sroland@vmware.com>
Sat, 28 Mar 2009 00:19:49 +0000 (01:19 +0100)
committerRoland Scheidegger <sroland@vmware.com>
Sat, 28 Mar 2009 01:06:40 +0000 (02:06 +0100)
need to respect the user-supplied base format, not the one derived from
the texture format actually used.

src/mesa/main/texformat.c
src/mesa/main/texstore.c

index ee531c45c692940c807a6f243f638acc43663c6f..0d60e5ebd3421a1828e11b63fad0ab17b4af2b26 100644 (file)
@@ -382,6 +382,7 @@ const struct gl_texture_format _mesa_texformat_sl8 = {
    store_texel_sl8                     /* StoreTexel */
 };
 
+/* Note: this format name looks like a misnomer, make it sal8? */
 const struct gl_texture_format _mesa_texformat_sla8 = {
    MESA_FORMAT_SLA8,                   /* MesaFormat */
    GL_LUMINANCE_ALPHA,                 /* BaseFormat */
index 7e7e0ac07a429a426f19139a85d89e840663251b..a94df532c64e69395db72fc2768f0dd80f30c436 100644 (file)
@@ -4078,18 +4078,18 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level,
 
                for (col = 0; col < width; col++) {
                   (*texImage->FetchTexelf)(texImage, col, row, img, rgba[col]);
-                  if (texImage->TexFormat->BaseFormat == GL_LUMINANCE) {
+                  if (texImage->_BaseFormat == GL_LUMINANCE) {
                      rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]);
                      rgba[col][GCOMP] = 0.0;
                      rgba[col][BCOMP] = 0.0;
                   }
-                  else if (texImage->TexFormat->BaseFormat == GL_LUMINANCE_ALPHA) {
+                  else if (texImage->_BaseFormat == GL_LUMINANCE_ALPHA) {
                      rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]);
                      rgba[col][GCOMP] = 0.0;
                      rgba[col][BCOMP] = 0.0;
                   }
-                  else if (texImage->TexFormat->BaseFormat == GL_RGB ||
-                     texImage->TexFormat->BaseFormat == GL_RGBA) {
+                  else if (texImage->_BaseFormat == GL_RGB ||
+                     texImage->_BaseFormat == GL_RGBA) {
                      rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]);
                      rgba[col][GCOMP] = linear_to_nonlinear(rgba[col][GCOMP]);
                      rgba[col][BCOMP] = linear_to_nonlinear(rgba[col][BCOMP]);
@@ -4117,21 +4117,21 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level,
 
                for (col = 0; col < width; col++) {
                   (*texImage->FetchTexelf)(texImage, col, row, img, rgba[col]);
-                  if (texImage->TexFormat->BaseFormat == GL_ALPHA) {
+                  if (texImage->_BaseFormat == GL_ALPHA) {
                      rgba[col][RCOMP] = 0.0;
                      rgba[col][GCOMP] = 0.0;
                      rgba[col][BCOMP] = 0.0;
                   }
-                  else if (texImage->TexFormat->BaseFormat == GL_LUMINANCE) {
+                  else if (texImage->_BaseFormat == GL_LUMINANCE) {
                      rgba[col][GCOMP] = 0.0;
                      rgba[col][BCOMP] = 0.0;
                      rgba[col][ACOMP] = 1.0;
                   }
-                  else if (texImage->TexFormat->BaseFormat == GL_LUMINANCE_ALPHA) {
+                  else if (texImage->_BaseFormat == GL_LUMINANCE_ALPHA) {
                      rgba[col][GCOMP] = 0.0;
                      rgba[col][BCOMP] = 0.0;
                   }
-                  else if (texImage->TexFormat->BaseFormat == GL_INTENSITY) {
+                  else if (texImage->_BaseFormat == GL_INTENSITY) {
                      rgba[col][GCOMP] = 0.0;
                      rgba[col][BCOMP] = 0.0;
                      rgba[col][ACOMP] = 1.0;