mesa: small texstate tidy up
authorTimothy Arceri <tarceri@itsqueeze.com>
Tue, 4 Apr 2017 02:39:31 +0000 (12:39 +1000)
committerTimothy Arceri <tarceri@itsqueeze.com>
Wed, 5 Apr 2017 22:25:36 +0000 (08:25 +1000)
Possibly more efficient, either way it makes the code easier to
follow.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/mesa/main/texstate.c

index ada0dfdb6608fe9edd9967f47ba09c15d042aeb0..aa99b0667cbe880052fb11f4d175be9996750b97 100644 (file)
@@ -704,13 +704,14 @@ _mesa_update_texture_state(struct gl_context *ctx)
       if (ctx->_Shader->CurrentProgram[i]) {
          prog[i] = ctx->_Shader->CurrentProgram[i];
       } else {
-         if (i == MESA_SHADER_FRAGMENT && ctx->FragmentProgram._Enabled)
-            prog[i] = ctx->FragmentProgram.Current;
-         else
-            prog[i] = NULL;
+         prog[i] = NULL;
       }
    }
 
+   if (prog[MESA_SHADER_FRAGMENT] == NULL && ctx->FragmentProgram._Enabled) {
+      prog[MESA_SHADER_FRAGMENT] = ctx->FragmentProgram.Current;
+   }
+
    /* TODO: only set this if there are actual changes */
    ctx->NewState |= _NEW_TEXTURE_OBJECT | _NEW_TEXTURE_STATE;