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)
This commit is contained in:
Robert Bragg 2012-09-28 16:14:39 +01:00
parent 986ba3aa79
commit de7416fd1d

View File

@ -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 */
{
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);
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) ||