[Mesa-dev] [PATCH 1/3] mesa: Simplify some tests in update_array_format()

Fredrik Höglund fredrik at kde.org
Thu Mar 5 10:56:39 PST 2015


There is no need to check if these extensions are supported here;
if the data type is not supported, we will already have returned a
GL_INVALID_ENUM error.
---
 src/mesa/main/varray.c | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 42e7f89..efc1431 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -301,17 +301,9 @@ update_array_format(struct gl_context *ctx,
        *    ...
        *    • size is BGRA and normalized is FALSE;"
        */
-      bool bgra_error = false;
-
-      if (ctx->Extensions.ARB_vertex_type_2_10_10_10_rev) {
-         if (type != GL_UNSIGNED_INT_2_10_10_10_REV &&
-             type != GL_INT_2_10_10_10_REV &&
-             type != GL_UNSIGNED_BYTE)
-            bgra_error = true;
-      } else if (type != GL_UNSIGNED_BYTE)
-         bgra_error = true;
-
-      if (bgra_error) {
+      if (type != GL_UNSIGNED_INT_2_10_10_10_REV &&
+          type != GL_INT_2_10_10_10_REV &&
+          type != GL_UNSIGNED_BYTE) {
          _mesa_error(ctx, GL_INVALID_OPERATION, "%s(size=GL_BGRA and type=%s)",
                      func, _mesa_lookup_enum_by_nr(type));
          return false;
@@ -331,8 +323,7 @@ update_array_format(struct gl_context *ctx,
       return false;
    }
 
-   if (ctx->Extensions.ARB_vertex_type_2_10_10_10_rev &&
-       (type == GL_UNSIGNED_INT_2_10_10_10_REV ||
+   if ((type == GL_UNSIGNED_INT_2_10_10_10_REV ||
         type == GL_INT_2_10_10_10_REV) && size != 4) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "%s(size=%d)", func, size);
       return false;
@@ -351,8 +342,7 @@ update_array_format(struct gl_context *ctx,
       return false;
    }
 
-   if (ctx->Extensions.ARB_vertex_type_10f_11f_11f_rev &&
-         type == GL_UNSIGNED_INT_10F_11F_11F_REV && size != 3) {
+   if (type == GL_UNSIGNED_INT_10F_11F_11F_REV && size != 3) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "%s(size=%d)", func, size);
       return false;
    }
-- 
1.8.5.3



More information about the mesa-dev mailing list