[Mesa-dev] [PATCH 5/9] mesa: Minor clean ups in set_combiner_scale

Ian Romanick idr at freedesktop.org
Fri May 19 13:38:07 UTC 2017


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

   text	   data	    bss	    dec	    hex	filename
7034243	 235248	  37280	7306771	 6f7e13	32-bit i965_dri.so before
7034211	 235248	  37280	7306739	 6f7df3	32-bit i965_dri.so after
6676047	 303400	  50608	7030055	 6b4527	64-bit i965_dri.so before
6676031	 303400	  50608	7030039	 6b4517	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 | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c
index 956cc1c..0be6708 100644
--- a/src/mesa/main/texenv.c
+++ b/src/mesa/main/texenv.c
@@ -339,14 +339,11 @@ set_combiner_scale(struct gl_context *ctx,
 
    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;
@@ -366,7 +363,8 @@ set_combiner_scale(struct gl_context *ctx,
       texUnit->Combine.ScaleShiftA = shift;
       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