[Mesa-dev] [PATCH 6/7] mesa: small _mesa_UseProgram() tidy up

Timothy Arceri tarceri at itsqueeze.com
Thu May 4 01:19:53 UTC 2017


Makes the code easier to follow
---
 src/mesa/main/shaderapi.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index b764fee..eb75a3e 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -1846,21 +1846,21 @@ _mesa_ShaderSource(GLuint shaderObj, GLsizei count,
    shader_source(sh, source);
 
    free(offsets);
 }
 
 
 void GLAPIENTRY
 _mesa_UseProgram(GLuint program)
 {
    GET_CURRENT_CONTEXT(ctx);
-   struct gl_shader_program *shProg;
+   struct gl_shader_program *shProg = NULL;
 
    if (MESA_VERBOSE & VERBOSE_API)
       _mesa_debug(ctx, "glUseProgram %u\n", program);
 
    if (_mesa_is_xfb_active_and_unpaused(ctx)) {
       _mesa_error(ctx, GL_INVALID_OPERATION,
                   "glUseProgram(transform feedback active)");
       return;
    }
 
@@ -1874,23 +1874,20 @@ _mesa_UseProgram(GLuint program)
                      "glUseProgram(program %u not linked)", program);
          return;
       }
 
 #ifdef DEBUG
       if (ctx->_Shader->Flags & GLSL_USE_PROG) {
          print_shader_info(shProg);
       }
 #endif
    }
-   else {
-      shProg = NULL;
-   }
 
    /* The ARB_separate_shader_object spec says:
     *
     *     "The executable code for an individual shader stage is taken from
     *     the current program for that stage.  If there is a current program
     *     object established by UseProgram, that program is considered current
     *     for all stages.  Otherwise, if there is a bound program pipeline
     *     object (section 2.14.PPO), the program bound to the appropriate
     *     stage of the pipeline object is considered current."
     */
-- 
2.9.3



More information about the mesa-dev mailing list