summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Hainaut <gregory.hainaut@gmail.com>2015-10-25 15:01:35 +0100
committerEmil Velikov <emil.l.velikov@gmail.com>2015-12-12 19:39:01 +0000
commit66f216d8ceda75ed0a47512a69af5f8d94ea0172 (patch)
tree6833022040a2bd61179d1dc7e315c0ca4843a761
parent4d34038ae5a01c723a2d63f1b8f9f846637dd645 (diff)
glsl: don't dead code remove SSO varyings marked as active
GL_ARB_separate_shader_objects allow matching by name variable or block interface. Input varyings can't be removed because it is will impact the location assignment. This fixes the bug 79783 and likely any application that uses GL_ARB_separate_shader_objects extension. V2 (by Timothy Arceri): * simplify now that builtins are not set as always active Signed-off-by: Gregory Hainaut <gregory.hainaut@gmail.com> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com> Reviewed-by: Tapani Pälli <tapani.palli@intel.com> https://bugs.freedesktop.org/show_bug.cgi?id=79783 (cherry picked from commit 8117f46f496fb31339fc97a2501d5b3325a1fefb) Nominated-by: Timothy Arceri <timothy.arceri@collabora.com>
-rw-r--r--src/glsl/opt_dead_code.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/glsl/opt_dead_code.cpp b/src/glsl/opt_dead_code.cpp
index c5be166e75a..c2ce0b94ece 100644
--- a/src/glsl/opt_dead_code.cpp
+++ b/src/glsl/opt_dead_code.cpp
@@ -75,6 +75,20 @@ do_dead_code(exec_list *instructions, bool uniform_locations_assigned)
|| !entry->declaration)
continue;
+ /* Section 7.4.1 (Shader Interface Matching) of the OpenGL 4.5
+ * (Core Profile) spec says:
+ *
+ * "With separable program objects, interfaces between shader
+ * stages may involve the outputs from one program object and the
+ * inputs from a second program object. For such interfaces, it is
+ * not possible to detect mismatches at link time, because the
+ * programs are linked separately. When each such program is
+ * linked, all inputs or outputs interfacing with another program
+ * stage are treated as active."
+ */
+ if (entry->var->data.always_active_io)
+ continue;
+
if (!entry->assign_list.is_empty()) {
/* Remove all the dead assignments to the variable we found.
* Don't do so if it's a shader or function output, though.