[Mesa-dev] [PATCH 08/13] mesa: Minor clean ups in set_combiner_source

Ian Romanick idr at freedesktop.org
Wed Aug 24 18:46:16 UTC 2016


From: Ian Romanick <ian.d.romanick at intel.com>

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/main/texenv.c | 32 +++++++++++++-------------------
 1 file changed, 13 insertions(+), 19 deletions(-)

diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c
index 1ab4708..3d6a219 100644
--- a/src/mesa/main/texenv.c
+++ b/src/mesa/main/texenv.c
@@ -165,10 +165,10 @@ set_combiner_source(struct gl_context *ctx,
                     GLenum pname, GLenum param)
 {
    GLuint term;
-   GLboolean alpha, legal;
+   bool alpha;
+   bool legal;
 
-   /*
-    * Translate pname to (term, alpha).
+   /* Translate pname to (term, alpha).
     *
     * The enums were given sequential values for a reason.
     */
@@ -178,37 +178,33 @@ set_combiner_source(struct gl_context *ctx,
    case GL_SOURCE2_RGB:
    case GL_SOURCE3_RGB_NV:
       term = pname - GL_SOURCE0_RGB;
-      alpha = GL_FALSE;
+      alpha = false;
       break;
    case GL_SOURCE0_ALPHA:
    case GL_SOURCE1_ALPHA:
    case GL_SOURCE2_ALPHA:
    case GL_SOURCE3_ALPHA_NV:
       term = pname - GL_SOURCE0_ALPHA;
-      alpha = GL_TRUE;
+      alpha = true;
       break;
    default:
-      TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
-      return;
+      unreachable("invalid pname");
    }
 
-   if ((term == 3) && (ctx->API != API_OPENGL_COMPAT
-                       || !ctx->Extensions.NV_texture_env_combine4)) {
+   if (term == 3 && !_mesa_has_NV_texture_env_combine4(ctx)) {
       TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
       return;
    }
 
    assert(term < MAX_COMBINER_TERMS);
 
-   /*
-    * Error-check param (the source term)
-    */
+   /* Error-check param (the source term) */
    switch (param) {
    case GL_TEXTURE:
    case GL_CONSTANT:
    case GL_PRIMARY_COLOR:
    case GL_PREVIOUS:
-      legal = GL_TRUE;
+      legal = true;
       break;
    case GL_TEXTURE0:
    case GL_TEXTURE1:
@@ -222,16 +218,14 @@ set_combiner_source(struct gl_context *ctx,
                param - GL_TEXTURE0 < ctx->Const.MaxTextureUnits);
       break;
    case GL_ZERO:
-      legal = (ctx->API == API_OPENGL_COMPAT &&
-               (ctx->Extensions.ATI_texture_env_combine3 ||
-                ctx->Extensions.NV_texture_env_combine4));
+      legal = _mesa_has_ATI_texture_env_combine3(ctx) ||
+              _mesa_has_NV_texture_env_combine4(ctx);
       break;
    case GL_ONE:
-      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) {
-- 
2.5.5



More information about the mesa-dev mailing list