[Mesa-dev] [PATCH 09/31] mesa: simplify handling the return value of update_program

Marek Olšák maraeo at gmail.com
Mon Jun 12 16:55:34 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

---
 src/mesa/main/state.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 960b538..5d2d9f0 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -83,21 +83,20 @@ update_program(struct gl_context *ctx)
    struct gl_program *fsProg =
       ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT];
    struct gl_program *csProg =
       ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
    const struct gl_program *prevVP = ctx->VertexProgram._Current;
    const struct gl_program *prevFP = ctx->FragmentProgram._Current;
    const struct gl_program *prevGP = ctx->GeometryProgram._Current;
    const struct gl_program *prevTCP = ctx->TessCtrlProgram._Current;
    const struct gl_program *prevTEP = ctx->TessEvalProgram._Current;
    const struct gl_program *prevCP = ctx->ComputeProgram._Current;
-   GLbitfield new_state = 0x0;
 
    /*
     * Set the ctx->VertexProgram._Current and ctx->FragmentProgram._Current
     * pointers to the programs that should be used for rendering.  If either
     * is NULL, use fixed-function code paths.
     *
     * These programs may come from several sources.  The priority is as
     * follows:
     *   1. OpenGL 2.0/ARB vertex/fragment shaders
     *   2. ARB/NV vertex/fragment programs
@@ -206,23 +205,23 @@ update_program(struct gl_context *ctx)
    }
 
    /* Let the driver know what's happening:
     */
    if (ctx->FragmentProgram._Current != prevFP ||
        ctx->VertexProgram._Current != prevVP ||
        ctx->GeometryProgram._Current != prevGP ||
        ctx->TessEvalProgram._Current != prevTEP ||
        ctx->TessCtrlProgram._Current != prevTCP ||
        ctx->ComputeProgram._Current != prevCP)
-      new_state |= _NEW_PROGRAM;
+      return _NEW_PROGRAM;
 
-   return new_state;
+   return 0;
 }
 
 
 /**
  * Examine shader constants and return either _NEW_PROGRAM_CONSTANTS or 0.
  */
 static GLbitfield
 update_program_constants(struct gl_context *ctx)
 {
    GLbitfield new_state = 0x0;
-- 
2.7.4



More information about the mesa-dev mailing list