[Mesa-dev] [PATCH 2/9] mesa: Minor clean ups in set_combiner_mode
Ian Romanick
idr at freedesktop.org
Fri May 19 13:38:04 UTC 2017
From: Ian Romanick <ian.d.romanick at intel.com>
text data bss dec hex filename
7034307 235248 37280 7306835 6f7e53 32-bit i965_dri.so before
7034307 235248 37280 7306835 6f7e53 32-bit i965_dri.so after
6676143 303400 50608 7030151 6b4587 64-bit i965_dri.so before
6676127 303400 50608 7030135 6b4577 64-bit i965_dri.so after
v2: Modify the switch with unreachable() instead of changing the
parameters to the function.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/mesa/main/texenv.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c
index ee5171c..fc1e49e 100644
--- a/src/mesa/main/texenv.c
+++ b/src/mesa/main/texenv.c
@@ -108,7 +108,7 @@ set_combiner_mode(struct gl_context *ctx,
struct gl_texture_unit *texUnit,
GLenum pname, GLenum mode)
{
- GLboolean legal;
+ bool legal;
switch (mode) {
case GL_REPLACE:
@@ -116,30 +116,26 @@ set_combiner_mode(struct gl_context *ctx,
case GL_ADD:
case GL_ADD_SIGNED:
case GL_INTERPOLATE:
- legal = GL_TRUE;
+ legal = true;
break;
case GL_SUBTRACT:
legal = ctx->Extensions.ARB_texture_env_combine;
break;
case GL_DOT3_RGB_EXT:
case GL_DOT3_RGBA_EXT:
- legal = (ctx->API == API_OPENGL_COMPAT &&
- ctx->Extensions.EXT_texture_env_dot3 &&
- pname == GL_COMBINE_RGB);
+ legal = _mesa_has_EXT_texture_env_dot3(ctx) && pname == GL_COMBINE_RGB;
break;
case GL_DOT3_RGB:
case GL_DOT3_RGBA:
- legal = (ctx->Extensions.ARB_texture_env_dot3 &&
- pname == GL_COMBINE_RGB);
+ legal = ctx->Extensions.ARB_texture_env_dot3 && pname == GL_COMBINE_RGB;
break;
case GL_MODULATE_ADD_ATI:
case GL_MODULATE_SIGNED_ADD_ATI:
case GL_MODULATE_SUBTRACT_ATI:
- legal = (ctx->API == API_OPENGL_COMPAT &&
- ctx->Extensions.ATI_texture_env_combine3);
+ legal = _mesa_has_ATI_texture_env_combine3(ctx);
break;
default:
- legal = GL_FALSE;
+ legal = false;
}
if (!legal) {
@@ -162,7 +158,8 @@ set_combiner_mode(struct gl_context *ctx,
texUnit->Combine.ModeA = mode;
break;
default:
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ /* Caller already does pname filtering. */
+ unreachable("Invalid pname");
}
}
--
2.7.4
More information about the mesa-dev
mailing list