diff options
author | Marek Olšák <[email protected]> | 2013-02-06 22:31:44 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2013-02-11 19:43:01 +0100 |
commit | 09a99867abcc65e208959995c794457da6193967 (patch) | |
tree | 71f581f711c9d403b69b5d7553d4cd7fa27a878e | |
parent | 5587c8619a5501181fc47df53cc4bbdac1576b41 (diff) |
mesa: don't use _mesa_base_tex_format for format parameter of GetTexImage
_mesa_base_tex_format doesn't accept GL_BGR and GL_ABGR_EXT, etc.
v2: add a (now hopefully complete) helper function to deal with this
NOTE: This is a candidate for the stable branches.
Reviewed-by: Brian Paul <[email protected]>
-rw-r--r-- | src/mesa/main/texgetimage.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 3a550d94150..031e04d472c 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -311,6 +311,41 @@ get_tex_rgba_compressed(struct gl_context *ctx, GLuint dimensions, /** + * Return a base GL format given the user-requested format + * for glGetTexImage(). + */ +static GLenum +_mesa_base_pack_format(GLenum format) +{ + switch (format) { + case GL_ABGR_EXT: + case GL_BGRA: + case GL_BGRA_INTEGER: + case GL_RGBA_INTEGER: + return GL_RGBA; + case GL_BGR: + case GL_BGR_INTEGER: + case GL_RGB_INTEGER: + return GL_RGB; + case GL_RED_INTEGER: + return GL_RED; + case GL_GREEN_INTEGER: + return GL_GREEN; + case GL_BLUE_INTEGER: + return GL_BLUE; + case GL_ALPHA_INTEGER: + return GL_ALPHA; + case GL_LUMINANCE_INTEGER_EXT: + return GL_LUMINANCE; + case GL_LUMINANCE_ALPHA_INTEGER_EXT: + return GL_LUMINANCE_ALPHA; + default: + return format; + } +} + + +/** * Get an uncompressed color texture image. */ static void @@ -323,7 +358,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 = _mesa_base_pack_format(format); GLenum rebaseFormat = GL_NONE; GLuint height = texImage->Height; GLuint depth = texImage->Depth; |