[cogl/cogl-1.14: 35/174] driver-gl: re-indent misleading if-else statement



commit de7416fd1de319654bec5a4cf3537d6afbcbab70
Author: Robert Bragg <robert linux intel com>
Date:   Fri Sep 28 16:14:39 2012 +0100

    driver-gl: re-indent misleading if-else statement
    
    There was a very, very, very misleading if else statement using no
    braces for a single statement if block, followed by a blank line *and*
    followed by a comment before the else which was aligned to the 'if'
    column, all leading you to believe on first glance that there is no else
    block. The fact that Neil and I were both separately mislead by this,
    this week, is a pretty compelling reason to clarify this by deleting the
    blank line, and moving the comment inside the else block.
    
    Reviewed-by: Neil Roberts <neil linux intel com>
    
    (cherry picked from commit 96d9ea78eb56269c0de5283a5302ab095d8bdfce)

 cogl/driver/gl/gl/cogl-driver-gl.c |   51 +++++++++++++++++++-----------------
 1 files changed, 27 insertions(+), 24 deletions(-)
---
diff --git a/cogl/driver/gl/gl/cogl-driver-gl.c b/cogl/driver/gl/gl/cogl-driver-gl.c
index cefe2d6..bb24106 100644
--- a/cogl/driver/gl/gl/cogl-driver-gl.c
+++ b/cogl/driver/gl/gl/cogl-driver-gl.c
@@ -468,32 +468,35 @@ _cogl_driver_update_features (CoglContext *ctx,
       flags |= COGL_FEATURE_SHADERS_GLSL;
       COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_GLSL, TRUE);
     }
-  /* If all of the old GLSL extensions are available then we can fake
-   * the GL 2.0 GLSL support by diverting to the old function names */
-  else if (ctx->glCreateProgramObject && /* GL_ARB_shader_objects */
+  else
+    {
+      /* If all of the old GLSL extensions are available then we can fake
+       * the GL 2.0 GLSL support by diverting to the old function names */
+      if (ctx->glCreateProgramObject && /* GL_ARB_shader_objects */
            ctx->glVertexAttribPointer && /* GL_ARB_vertex_shader */
            _cogl_check_extension ("GL_ARB_fragment_shader", gl_extensions))
-    {
-      ctx->glCreateShader = ctx->glCreateShaderObject;
-      ctx->glCreateProgram = ctx->glCreateProgramObject;
-      ctx->glDeleteShader = ctx->glDeleteObject;
-      ctx->glDeleteProgram = ctx->glDeleteObject;
-      ctx->glAttachShader = ctx->glAttachObject;
-      ctx->glUseProgram = ctx->glUseProgramObject;
-      ctx->glGetProgramInfoLog = ctx->glGetInfoLog;
-      ctx->glGetShaderInfoLog = ctx->glGetInfoLog;
-      ctx->glGetShaderiv = ctx->glGetObjectParameteriv;
-      ctx->glGetProgramiv = ctx->glGetObjectParameteriv;
-      ctx->glDetachShader = ctx->glDetachObject;
-      ctx->glGetAttachedShaders = ctx->glGetAttachedObjects;
-      /* FIXME: there doesn't seem to be an equivalent for glIsShader
-       * and glIsProgram. This doesn't matter for now because Cogl
-       * doesn't use these but if we add support for simulating a
-       * GLES2 context on top of regular GL then we'll need to do
-       * something here */
-
-      flags |= COGL_FEATURE_SHADERS_GLSL;
-      COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_GLSL, TRUE);
+        {
+          ctx->glCreateShader = ctx->glCreateShaderObject;
+          ctx->glCreateProgram = ctx->glCreateProgramObject;
+          ctx->glDeleteShader = ctx->glDeleteObject;
+          ctx->glDeleteProgram = ctx->glDeleteObject;
+          ctx->glAttachShader = ctx->glAttachObject;
+          ctx->glUseProgram = ctx->glUseProgramObject;
+          ctx->glGetProgramInfoLog = ctx->glGetInfoLog;
+          ctx->glGetShaderInfoLog = ctx->glGetInfoLog;
+          ctx->glGetShaderiv = ctx->glGetObjectParameteriv;
+          ctx->glGetProgramiv = ctx->glGetObjectParameteriv;
+          ctx->glDetachShader = ctx->glDetachObject;
+          ctx->glGetAttachedShaders = ctx->glGetAttachedObjects;
+          /* FIXME: there doesn't seem to be an equivalent for glIsShader
+           * and glIsProgram. This doesn't matter for now because Cogl
+           * doesn't use these but if we add support for simulating a
+           * GLES2 context on top of regular GL then we'll need to do
+           * something here */
+
+          flags |= COGL_FEATURE_SHADERS_GLSL;
+          COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_GLSL, TRUE);
+        }
     }
 
   if ((COGL_CHECK_GL_VERSION (gl_major, gl_minor, 2, 0) ||



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]