[Mesa-dev] [PATCH 1/3] mesa: don't use _mesa_base_tex_format for format parameter of GetTexImage
Marek Olšák
maraeo at gmail.com
Wed Feb 6 15:29:43 PST 2013
_mesa_base_tex_format doesn't accept GL_BGR and GL_ABGR_EXT.
NOTE: This is a candidate for the stable branches.
---
src/mesa/main/texgetimage.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 3a550d9..9441ce6 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -323,7 +323,7 @@ get_tex_rgba_uncompressed(struct gl_context *ctx, GLuint dimensions,
const gl_format texFormat =
_mesa_get_srgb_format_linear(texImage->TexFormat);
const GLuint width = texImage->Width;
- const GLenum destBaseFormat = _mesa_base_tex_format(ctx, format);
+ GLenum destBaseFormat;
GLenum rebaseFormat = GL_NONE;
GLuint height = texImage->Height;
GLuint depth = texImage->Depth;
@@ -333,6 +333,18 @@ get_tex_rgba_uncompressed(struct gl_context *ctx, GLuint dimensions,
GLboolean tex_is_integer = _mesa_is_format_integer_color(texImage->TexFormat);
GLboolean tex_is_uint = _mesa_is_format_unsigned(texImage->TexFormat);
+ switch (format) {
+ case GL_ABGR_EXT:
+ case GL_BGRA:
+ destBaseFormat = GL_RGBA;
+ break;
+ case GL_BGR:
+ destBaseFormat = GL_RGB;
+ break;
+ default:
+ destBaseFormat = format;
+ }
+
/* Allocate buffer for one row of texels */
rgba = malloc(4 * width * sizeof(GLfloat));
rgba_uint = (GLuint (*)[4]) rgba;
--
1.7.10.4
More information about the mesa-dev
mailing list