glsl: simplify disable_varying_optimizations_for_sso

We always have stage == first and stage == last when first == last, so
drop the special case. Also rephrase the comment to make the logic
clearer.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Nicolai Hähnle
2017-06-11 12:48:52 +02:00
parent 141d0831ff
commit da506cce8a

View File

@@ -4517,26 +4517,19 @@ disable_varying_optimizations_for_sso(struct gl_shader_program *prog)
if (!sh) if (!sh)
continue; continue;
if (first == last) { /* Prevent the removal of inputs to the first and outputs from the last
/* For a single shader program only allow inputs to the vertex shader * stage, unless they are the initial pipeline inputs or final pipeline
* and outputs from the fragment shader to be removed. * outputs, respectively.
*/ *
if (stage != MESA_SHADER_VERTEX) * The removal of IO between shaders in the same program is always
set_always_active_io(sh->ir, ir_var_shader_in); * allowed.
if (stage != MESA_SHADER_FRAGMENT)
set_always_active_io(sh->ir, ir_var_shader_out);
} else {
/* For multi-stage separate shader programs only allow inputs and
* outputs between the shader stages to be removed as well as inputs
* to the vertex shader and outputs from the fragment shader.
*/ */
if (stage == first && stage != MESA_SHADER_VERTEX) if (stage == first && stage != MESA_SHADER_VERTEX)
set_always_active_io(sh->ir, ir_var_shader_in); set_always_active_io(sh->ir, ir_var_shader_in);
else if (stage == last && stage != MESA_SHADER_FRAGMENT) if (stage == last && stage != MESA_SHADER_FRAGMENT)
set_always_active_io(sh->ir, ir_var_shader_out); set_always_active_io(sh->ir, ir_var_shader_out);
} }
} }
}
static void static void
link_and_validate_uniforms(struct gl_context *ctx, link_and_validate_uniforms(struct gl_context *ctx,