[Mesa-dev] [PATCH 09/38] main: Fix indentation in get_texture_for_framebuffer.

Laura Ekstrand laura at jlekstrand.net
Tue Mar 3 17:32:01 PST 2015


---
 src/mesa/main/fbobject.c | 148 +++++++++++++++++++++++------------------------
 1 file changed, 74 insertions(+), 74 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index f86e1a0..2ac9903 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -2465,87 +2465,87 @@ get_texture_for_framebuffer(struct gl_context *ctx,
       return false;
    }
 
-         if (textarget == 0) {
-            if (*layered) {
-               /* We're being called by gl*FramebufferTexture() and textarget
-                * is not used.
-                */
-               switch ((*texObj)->Target) {
-               case GL_TEXTURE_3D:
-               case GL_TEXTURE_1D_ARRAY_EXT:
-               case GL_TEXTURE_2D_ARRAY_EXT:
-               case GL_TEXTURE_CUBE_MAP:
-               case GL_TEXTURE_CUBE_MAP_ARRAY:
-               case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
-                  err = false;
-                  break;
-               case GL_TEXTURE_1D:
-               case GL_TEXTURE_2D:
-               case GL_TEXTURE_RECTANGLE:
-               case GL_TEXTURE_2D_MULTISAMPLE:
-                  /* These texture types are valid to pass to
-                   * glFramebufferTexture(), but since they aren't layered, it
-                   * is equivalent to calling glFramebufferTexture{1D,2D}().
-                   */
-                  err = false;
-                  *layered = false;
-                  textarget = (*texObj)->Target;
-                  break;
-               default:
-                  err = true;
-                  break;
-               }
-            } else {
-               /* We're being called by glFramebufferTextureLayer() and
-                * textarget is not used.  The only legal texture types for
-                * that function are 3D and 1D/2D arrays textures.
-                */
-               err = ((*texObj)->Target != GL_TEXTURE_3D) &&
-                  ((*texObj)->Target != GL_TEXTURE_1D_ARRAY_EXT) &&
-                  ((*texObj)->Target != GL_TEXTURE_2D_ARRAY_EXT) &&
-                  ((*texObj)->Target != GL_TEXTURE_CUBE_MAP_ARRAY) &&
-                  ((*texObj)->Target != GL_TEXTURE_2D_MULTISAMPLE_ARRAY);
-            }
-         }
-         else {
-            /* Make sure textarget is consistent with the texture's type */
-            err = ((*texObj)->Target == GL_TEXTURE_CUBE_MAP)
-                ? !_mesa_is_cube_face(textarget)
-                : ((*texObj)->Target != textarget);
+   if (textarget == 0) {
+      if (*layered) {
+         /* We're being called by gl*FramebufferTexture() and textarget
+          * is not used.
+          */
+         switch ((*texObj)->Target) {
+         case GL_TEXTURE_3D:
+         case GL_TEXTURE_1D_ARRAY_EXT:
+         case GL_TEXTURE_2D_ARRAY_EXT:
+         case GL_TEXTURE_CUBE_MAP:
+         case GL_TEXTURE_CUBE_MAP_ARRAY:
+         case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
+            err = false;
+            break;
+         case GL_TEXTURE_1D:
+         case GL_TEXTURE_2D:
+         case GL_TEXTURE_RECTANGLE:
+         case GL_TEXTURE_2D_MULTISAMPLE:
+            /* These texture types are valid to pass to
+             * glFramebufferTexture(), but since they aren't layered, it
+             * is equivalent to calling glFramebufferTexture{1D,2D}().
+             */
+            err = false;
+            *layered = false;
+            textarget = (*texObj)->Target;
+            break;
+         default:
+            err = true;
+            break;
          }
-
-      if (err) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "%s(invalid or mismatched texture target)", caller);
-         return false;
+      } else {
+         /* We're being called by glFramebufferTextureLayer() and
+          * textarget is not used.  The only legal texture types for
+          * that function are 3D and 1D/2D arrays textures.
+          */
+         err = ((*texObj)->Target != GL_TEXTURE_3D) &&
+            ((*texObj)->Target != GL_TEXTURE_1D_ARRAY_EXT) &&
+            ((*texObj)->Target != GL_TEXTURE_2D_ARRAY_EXT) &&
+            ((*texObj)->Target != GL_TEXTURE_CUBE_MAP_ARRAY) &&
+            ((*texObj)->Target != GL_TEXTURE_2D_MULTISAMPLE_ARRAY);
       }
+   }
+   else {
+      /* Make sure textarget is consistent with the texture's type */
+      err = ((*texObj)->Target == GL_TEXTURE_CUBE_MAP)
+          ? !_mesa_is_cube_face(textarget)
+          : ((*texObj)->Target != textarget);
+   }
 
-      if ((*texObj)->Target == GL_TEXTURE_3D) {
-         const GLuint maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1);
-         if (zoffset >= maxSize) {
-            _mesa_error(ctx, GL_INVALID_VALUE,
-                        "%s(invalid zoffset %u)", caller, zoffset);
-            return false;
-         }
-      }
-      else if (((*texObj)->Target == GL_TEXTURE_1D_ARRAY_EXT) ||
-               ((*texObj)->Target == GL_TEXTURE_2D_ARRAY_EXT) ||
-               ((*texObj)->Target == GL_TEXTURE_CUBE_MAP_ARRAY) ||
-               ((*texObj)->Target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY)) {
-         if (zoffset >= ctx->Const.MaxArrayTextureLayers) {
-            _mesa_error(ctx, GL_INVALID_VALUE,
-                        "%s(invalid layer %u)", caller, zoffset);
-            return false;
-         }
-      }
+   if (err) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "%s(invalid or mismatched texture target)", caller);
+      return false;
+   }
 
-      maxLevelsTarget = textarget ? textarget : (*texObj)->Target;
-      if ((level < 0) ||
-          (level >= _mesa_max_texture_levels(ctx, maxLevelsTarget))) {
+   if ((*texObj)->Target == GL_TEXTURE_3D) {
+      const GLuint maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1);
+      if (zoffset >= maxSize) {
          _mesa_error(ctx, GL_INVALID_VALUE,
-                     "%s(invalid level %d)", caller, level);
+                     "%s(invalid zoffset %u)", caller, zoffset);
          return false;
       }
+   }
+   else if (((*texObj)->Target == GL_TEXTURE_1D_ARRAY_EXT) ||
+            ((*texObj)->Target == GL_TEXTURE_2D_ARRAY_EXT) ||
+            ((*texObj)->Target == GL_TEXTURE_CUBE_MAP_ARRAY) ||
+            ((*texObj)->Target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY)) {
+      if (zoffset >= ctx->Const.MaxArrayTextureLayers) {
+         _mesa_error(ctx, GL_INVALID_VALUE,
+                     "%s(invalid layer %u)", caller, zoffset);
+         return false;
+      }
+   }
+
+   maxLevelsTarget = textarget ? textarget : (*texObj)->Target;
+   if ((level < 0) ||
+       (level >= _mesa_max_texture_levels(ctx, maxLevelsTarget))) {
+      _mesa_error(ctx, GL_INVALID_VALUE,
+                  "%s(invalid level %d)", caller, level);
+      return false;
+   }
 
    return true;
 }
-- 
2.1.0



More information about the mesa-dev mailing list