From: Ian Romanick <ian.d.roman...@intel.com> Signed-off-by: Ian Romanick <ian.d.roman...@intel.com> --- src/mesa/main/texenv.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c index 3f3adba..ba22301 100644 --- a/src/mesa/main/texenv.c +++ b/src/mesa/main/texenv.c @@ -326,40 +326,32 @@ set_combiner_operand(struct gl_context *ctx, static void set_combiner_scale(struct gl_context *ctx, struct gl_texture_unit *texUnit, - GLenum pname, GLfloat scale) + bool is_rgb, GLfloat scale) { GLuint shift; if (scale == 1.0F) { shift = 0; - } - else if (scale == 2.0F) { + } else if (scale == 2.0F) { shift = 1; - } - else if (scale == 4.0F) { + } else if (scale == 4.0F) { shift = 2; - } - else { + } else { _mesa_error( ctx, GL_INVALID_VALUE, "glTexEnv(GL_RGB_SCALE not 1, 2 or 4)" ); return; } - switch (pname) { - case GL_RGB_SCALE: + if (is_rgb) { if (texUnit->Combine.ScaleShiftRGB == shift) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->Combine.ScaleShiftRGB = shift; - break; - case GL_ALPHA_SCALE: + } else { if (texUnit->Combine.ScaleShiftA == shift) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->Combine.ScaleShiftA = shift; - break; - default: - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); } } @@ -417,7 +409,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) break; case GL_RGB_SCALE: case GL_ALPHA_SCALE: - set_combiner_scale(ctx, texUnit, pname, param[0]); + set_combiner_scale(ctx, texUnit, pname == GL_RGB_SCALE, param[0]); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" ); -- 2.5.5 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev