glsl: simplify link_assign_uniform_storage() a bit
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 15 May 2017 10:55:06 +0000 (12:55 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 16 May 2017 07:33:06 +0000 (09:33 +0200)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/compiler/glsl/link_uniforms.cpp

index c5db1d62cb15e7fde01e2354e096befa955865e5..b11739ce78a8a1ce37c9c5e2c1c5cd5bc70cb4b9 100644 (file)
@@ -1238,12 +1238,14 @@ link_assign_uniform_storage(struct gl_context *ctx,
                                      prog->data->UniformStorage, data);
 
    for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
-      if (prog->_LinkedShaders[i] == NULL)
+      struct gl_linked_shader *shader = prog->_LinkedShaders[i];
+
+      if (!shader)
          continue;
 
       parcel.start_shader((gl_shader_stage)i);
 
-      foreach_in_list(ir_instruction, node, prog->_LinkedShaders[i]->ir) {
+      foreach_in_list(ir_instruction, node, shader->ir) {
          ir_variable *const var = node->as_variable();
 
          if ((var == NULL) || (var->data.mode != ir_var_uniform &&
@@ -1253,15 +1255,14 @@ link_assign_uniform_storage(struct gl_context *ctx,
          parcel.set_and_process(var);
       }
 
-      prog->_LinkedShaders[i]->Program->SamplersUsed =
-         parcel.shader_samplers_used;
-      prog->_LinkedShaders[i]->shadow_samplers = parcel.shader_shadow_samplers;
+      shader->Program->SamplersUsed = parcel.shader_samplers_used;
+      shader->shadow_samplers = parcel.shader_shadow_samplers;
 
-      STATIC_ASSERT(sizeof(prog->_LinkedShaders[i]->Program->sh.SamplerTargets) ==
+      STATIC_ASSERT(sizeof(shader->Program->sh.SamplerTargets) ==
                     sizeof(parcel.targets));
-      memcpy(prog->_LinkedShaders[i]->Program->sh.SamplerTargets,
+      memcpy(shader->Program->sh.SamplerTargets,
              parcel.targets,
-             sizeof(prog->_LinkedShaders[i]->Program->sh.SamplerTargets));
+             sizeof(shader->Program->sh.SamplerTargets));
    }
 
    /* If this is a fallback compile for a cache miss we already have the