mesa: simplify a loop in _mesa_update_texture_state
authorMarek Olšák <marek.olsak@amd.com>
Fri, 9 Jun 2017 21:54:16 +0000 (23:54 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 21 Jun 2017 23:51:02 +0000 (01:51 +0200)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/mesa/main/texstate.c

index 1e90bf87dacb291bcd76a795df8cda2044f1a0b7..0a2883fcc69a90ea6a4a215a10baa08c3a7f9112 100644 (file)
@@ -840,13 +840,7 @@ _mesa_update_texture_state(struct gl_context *ctx)
    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 {
-         prog[i] = NULL;
-      }
-   }
+   memcpy(prog, ctx->_Shader->CurrentProgram, sizeof(prog));
 
    if (prog[MESA_SHADER_FRAGMENT] == NULL &&
        _mesa_arb_fragment_program_enabled(ctx)) {