added a work-around in _swrast_copy_texsubimage[123]d() to fix alpha channel problem in some DRI drivers (see comments)

This commit is contained in:
Brian Paul 2001-04-13 00:13:51 +00:00
parent 77ff5e038a
commit bf478280eb
1 changed files with 49 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $Id: s_texstore.c,v 1.2 2001/03/28 20:40:52 gareth Exp $ */
/* $Id: s_texstore.c,v 1.3 2001/04/13 00:13:51 brianp Exp $ */
/*
* Mesa 3-D graphics library
@ -274,6 +274,22 @@ _swrast_copy_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
return;
}
/*
* XXX this is a bit of a hack. We need to be sure that the alpha
* channel is 1.0 if the internal texture format is not supposed to
* have an alpha channel. This is because some drivers may store
* RGB textures as RGBA and the texutil.c code isn't smart enough
* to set the alpha channel to 1.0 in this situation.
*/
if (texImage->Format == GL_LUMINANCE ||
texImage->Format == GL_RGB) {
const GLuint n = width * 4;
GLuint i;
for (i = 0; i < n; i += 4) {
image[i + 3] = CHAN_MAX;
}
}
/* now call glTexSubImage1D to do the real work */
(*ctx->Driver.TexSubImage1D)(ctx, target, level, xoffset, width,
GL_RGBA, CHAN_TYPE, image,
@ -326,6 +342,22 @@ _swrast_copy_texsubimage2d( GLcontext *ctx,
return;
}
/*
* XXX this is a bit of a hack. We need to be sure that the alpha
* channel is 1.0 if the internal texture format is not supposed to
* have an alpha channel. This is because some drivers may store
* RGB textures as RGBA and the texutil.c code isn't smart enough
* to set the alpha channel to 1.0 in this situation.
*/
if (texImage->Format == GL_LUMINANCE ||
texImage->Format == GL_RGB) {
const GLuint n = width * height * 4;
GLuint i;
for (i = 0; i < n; i += 4) {
image[i + 3] = CHAN_MAX;
}
}
/* now call glTexSubImage2D to do the real work */
(*ctx->Driver.TexSubImage2D)(ctx, target, level,
xoffset, yoffset, width, height,
@ -380,6 +412,22 @@ _swrast_copy_texsubimage3d( GLcontext *ctx,
return;
}
/*
* XXX this is a bit of a hack. We need to be sure that the alpha
* channel is 1.0 if the internal texture format is not supposed to
* have an alpha channel. This is because some drivers may store
* RGB textures as RGBA and the texutil.c code isn't smart enough
* to set the alpha channel to 1.0 in this situation.
*/
if (texImage->Format == GL_LUMINANCE ||
texImage->Format == GL_RGB) {
const GLuint n = width * height * 4;
GLuint i;
for (i = 0; i < n; i += 4) {
image[i + 3] = CHAN_MAX;
}
}
/* now call glTexSubImage3D to do the real work */
(*ctx->Driver.TexSubImage3D)(ctx, target, level,
xoffset, yoffset, zoffset, width, height, 1,