[Mesa-dev] [PATCH 1/3] mesa: small texstate tidy up

Timothy Arceri tarceri at itsqueeze.com
Wed Apr 5 01:41:25 UTC 2017


Possibly more efficient, either way it make the code easier to
follow.
---
 src/mesa/main/texstate.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index ada0dfd..aa99b06 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -697,27 +697,28 @@ _mesa_update_texture_state(struct gl_context *ctx)
 {
    struct gl_program *prog[MESA_SHADER_STAGES];
    int i;
    int old_max_unit = ctx->Texture._MaxEnabledTexImageUnit;
    BITSET_DECLARE(enabled_texture_units, MAX_COMBINED_TEXTURE_IMAGE_UNITS);
 
    for (i = 0; i < MESA_SHADER_STAGES; i++) {
       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;
 
    ctx->Texture._GenFlags = 0x0;
    ctx->Texture._TexMatEnabled = 0x0;
    ctx->Texture._TexGenEnabled = 0x0;
    ctx->Texture._MaxEnabledTexImageUnit = -1;
    ctx->Texture._EnabledCoordUnits = 0x0;
 
    memset(&enabled_texture_units, 0, sizeof(enabled_texture_units));
-- 
2.9.3



More information about the mesa-dev mailing list