[Mesa-dev] [PATCH 3/9] mesa: Minor clean ups in set_combiner_source

Ian Romanick idr at freedesktop.org
Fri May 19 13:38:05 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
7034243	 235248	  37280	7306771	 6f7e13	32-bit i965_dri.so after
6676127	 303400	  50608	7030135	 6b4577	64-bit i965_dri.so before
6676063	 303400	  50608	7030071	 6b4537	64-bit i965_dri.so after

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 fc1e49e..d1705e9 100644
--- a/src/mesa/main/texenv.c
+++ b/src/mesa/main/texenv.c
@@ -172,10 +172,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.
     */
@@ -185,37 +185,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:
@@ -229,16 +225,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.7.4



More information about the mesa-dev mailing list