[Mesa-dev] [PATCH 1/3] mesa: simplify format check in compressed_subtexture_target_check()

Brian Paul brianp at vmware.com
Thu Jul 23 06:57:11 PDT 2015


Lose the invalidformat local variable.
---
 src/mesa/main/teximage.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 3b309ab..4fe6ee4 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -4587,19 +4587,16 @@ compressed_subtexture_target_check(struct gl_context *ctx, GLenum target,
        * core spec.
        */
       if (target != GL_TEXTURE_2D_ARRAY && target != GL_TEXTURE_CUBE_MAP_ARRAY) {
-         bool invalidformat;
          switch (format) {
-            /* These came from _mesa_is_compressed_format in glformats.c. */
-            case GL_COMPRESSED_RGBA_BPTC_UNORM:
-            case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM:
-            case GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT:
-            case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT:
-               invalidformat = false;
-               break;
-            default:
-               invalidformat = true;
-         }
-         if (invalidformat) {
+         /* These are the only 3D compression formats supported at this time */
+         case GL_COMPRESSED_RGBA_BPTC_UNORM:
+         case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM:
+         case GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT:
+         case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT:
+            /* valid format */
+            break;
+         default:
+            /* invalid format */
             _mesa_error(ctx, GL_INVALID_OPERATION,
                         "%s(invalid target %s for format %s)", caller,
                         _mesa_enum_to_string(target),
-- 
1.9.1



More information about the mesa-dev mailing list