Mesa (staging/20.1): mesa: fix fallthrough in glformats

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jul 3 23:55:14 UTC 2020


Module: Mesa
Branch: staging/20.1
Commit: 6d479349f14dfeef86dcf573350eac630c74c723
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6d479349f14dfeef86dcf573350eac630c74c723

Author: Timothy Arceri <tarceri at itsqueeze.com>
Date:   Wed Jul  1 13:04:25 2020 +1000

mesa: fix fallthrough in glformats

Before 908f817918fb this would fallthrough to GL_INVALID_OPERATION
if the validation condition was not met. But since that change it
will now only return GL_INVALID_OPERATION if
!_mesa_has_EXT_texture_compression_bptc(ctx) is true. This seems
unintended.

Here we fix up the fallthrough and add the fallthrough comment so
this doesn't happen again.

Fixes: 908f817918fb ("mesa: expose EXT_texture_compression_bptc in GLES")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3005
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5705>
(cherry picked from commit 040b07c7feebac90858f7426c2c20784642d0ca5)

---

 .pick_status.json         | 2 +-
 src/mesa/main/glformats.c | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 7c8e9c9bca5..393f4c84926 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -247,7 +247,7 @@
         "description": "mesa: fix fallthrough in glformats",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "908f817918fb14a12887f942b8358a5c648b3f92"
     },
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index dfff4a21f04..66b29ede67a 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -3059,14 +3059,15 @@ _mesa_gles_error_check_format_and_type(const struct gl_context *ctx,
             if (ctx->Version <= 20)
                return GL_INVALID_OPERATION;
             break;
-         case GL_RGB:
-            if (_mesa_has_OES_texture_float(ctx) && internalFormat == format)
-               break;
          case GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT:
          case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT:
             if (!_mesa_has_EXT_texture_compression_bptc(ctx))
                return GL_INVALID_OPERATION;
             break;
+         case GL_RGB:
+            if (_mesa_has_OES_texture_float(ctx) && internalFormat == format)
+               break;
+            /* fallthrough */
          default:
             return GL_INVALID_OPERATION;
          }



More information about the mesa-commit mailing list