[Mesa-dev] [PATCH 2/9] glsl: simplify disable_varying_optimizations_for_sso
Nicolai Hähnle
nhaehnle at gmail.com
Mon Jun 26 09:40:40 UTC 2017
From: Nicolai Hähnle <nicolai.haehnle at amd.com>
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.
---
src/compiler/glsl/linker.cpp | 29 +++++++++++------------------
1 file changed, 11 insertions(+), 18 deletions(-)
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index adfa3b7..5366200 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -4507,38 +4507,31 @@ disable_varying_optimizations_for_sso(struct gl_shader_program *prog)
}
if (first == MESA_SHADER_STAGES)
return;
for (unsigned stage = 0; stage < MESA_SHADER_STAGES; stage++) {
gl_linked_shader *sh = prog->_LinkedShaders[stage];
if (!sh)
continue;
- if (first == last) {
- /* For a single shader program only allow inputs to the vertex shader
- * and outputs from the fragment shader to be removed.
- */
- if (stage != MESA_SHADER_VERTEX)
- set_always_active_io(sh->ir, ir_var_shader_in);
- 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)
- set_always_active_io(sh->ir, ir_var_shader_in);
- else if (stage == last && stage != MESA_SHADER_FRAGMENT)
- set_always_active_io(sh->ir, ir_var_shader_out);
- }
+ /* Prevent the removal of inputs to the first and outputs from the last
+ * stage, unless they are the initial pipeline inputs or final pipeline
+ * outputs, respectively.
+ *
+ * The removal of IO between shaders in the same program is always
+ * allowed.
+ */
+ if (stage == first && stage != MESA_SHADER_VERTEX)
+ set_always_active_io(sh->ir, ir_var_shader_in);
+ if (stage == last && stage != MESA_SHADER_FRAGMENT)
+ set_always_active_io(sh->ir, ir_var_shader_out);
}
}
static void
link_and_validate_uniforms(struct gl_context *ctx,
struct gl_shader_program *prog)
{
update_array_sizes(prog);
link_assign_uniform_locations(prog, ctx);
--
2.9.3
More information about the mesa-dev
mailing list