diff options
author | Brian Paul <[email protected]> | 2004-06-10 17:26:05 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2004-06-10 17:26:05 +0000 |
commit | 13ad04719e292a2bee7e1b3155da74a97921c035 (patch) | |
tree | 344d2ed18ee4b1debff777ec46396eda6e776445 /src/mesa/main | |
parent | 41b58954e1742493452b91d9ecdb761db5de3bed (diff) |
Roland's patch to fix promotion of alpha or luminance textures to the
luminance_alpha format. In particular, using the al88 format to store
GL_ALPHA textures with r200 driver.
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/texstore.c | 89 |
1 files changed, 57 insertions, 32 deletions
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 57b669ac38f..68a089b9d03 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -80,37 +80,60 @@ compute_component_mapping(GLenum logicalBaseFormat, GLenum textureBaseFormat, GLint map[4]) { /* compute mapping from dest components back to src components */ - switch (logicalBaseFormat) { - case GL_LUMINANCE: - map[0] = map[1] = map[2] = 0; - if (textureBaseFormat == GL_RGBA) - map[3] = ONE; - break; - case GL_ALPHA: - ASSERT(textureBaseFormat == GL_RGBA); - map[0] = map[1] = map[2] = ZERO; - map[3] = 0; - break; - case GL_INTENSITY: - map[0] = map[1] = map[2] = 0; - if (textureBaseFormat == GL_RGBA) + switch (textureBaseFormat) { + case GL_RGB: + case GL_RGBA: + switch (logicalBaseFormat) { + case GL_LUMINANCE: + map[0] = map[1] = map[2] = 0; + if (textureBaseFormat == GL_RGBA) + map[3] = ONE; + break; + case GL_ALPHA: + ASSERT(textureBaseFormat == GL_RGBA); + map[0] = map[1] = map[2] = ZERO; map[3] = 0; + break; + case GL_INTENSITY: + map[0] = map[1] = map[2] = 0; + if (textureBaseFormat == GL_RGBA) + map[3] = 0; + break; + case GL_LUMINANCE_ALPHA: + ASSERT(textureBaseFormat == GL_RGBA); + map[0] = map[1] = map[2] = 0; + map[3] = 1; + break; + case GL_RGB: + ASSERT(textureBaseFormat == GL_RGBA); + map[0] = 0; + map[1] = 1; + map[2] = 2; + map[3] = ONE; + break; + default: + _mesa_problem(NULL, "Unexpected logicalBaseFormat"); + map[0] = map[1] = map[2] = map[3] = 0; + } break; case GL_LUMINANCE_ALPHA: - ASSERT(textureBaseFormat == GL_RGBA); - map[0] = map[1] = map[2] = 0; - map[3] = 1; - break; - case GL_RGB: - ASSERT(textureBaseFormat == GL_RGBA); - map[0] = 0; - map[1] = 1; - map[2] = 2; - map[3] = ONE; - break; - default: - _mesa_problem(NULL, "Unexpected logicalBaseFormat"); - map[0] = map[1] = map[2] = map[3] = 0; + switch (logicalBaseFormat) { + case GL_LUMINANCE: + map[0] = 0; + map[1] = ONE; + break; + case GL_ALPHA: + map[0] = ZERO; + map[1] = 0; + break; + case GL_INTENSITY: + map[0] = 0; + map[1] = 0; + break; + default: + _mesa_problem(NULL, "Unexpected logicalBaseFormat"); + map[0] = map[1] = 0; + } } } @@ -298,8 +321,9 @@ make_temp_float_image(GLcontext *ctx, GLuint dims, GLint i, n; GLint map[4]; - /* we only promote up to RGB and RGBA formats for now */ - ASSERT(textureBaseFormat == GL_RGB || textureBaseFormat == GL_RGBA); + /* we only promote up to RGB, RGBA and LUMINANCE_ALPHA formats for now */ + ASSERT(textureBaseFormat == GL_RGB || textureBaseFormat == GL_RGBA || + textureBaseFormat == GL_LUMINANCE_ALPHA); /* The actual texture format should have at least as many components * as the logical texture format. @@ -451,8 +475,9 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims, GLint i, n; GLint map[4]; - /* we only promote up to RGB and RGBA formats for now */ - ASSERT(textureBaseFormat == GL_RGB || textureBaseFormat == GL_RGBA); + /* we only promote up to RGB, RGBA and LUMINANCE_ALPHA formats for now */ + ASSERT(textureBaseFormat == GL_RGB || textureBaseFormat == GL_RGBA || + textureBaseFormat == GL_LUMINANCE_ALPHA); /* The actual texture format should have at least as many components * as the logical texture format. |