[Mesa-stable] [PATCH] i965: do not release GLSL IR for SSO programs

Tapani Pälli tapani.palli at intel.com
Tue Oct 25 06:39:37 UTC 2016


SSO shader programs can be later modified by attaching/detaching
shaders and relinked, this requires IR. This patch fixes regression
caused by 4542c7ed5fc6d8cb2495d322b4f06d802d7292cc.

Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97715
Cc: "12.0 13.0" <mesa-stable at lists.freedesktop.org>
---
 src/mesa/drivers/dri/i965/brw_link.cpp | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp
index 5ea9773..ffb66a9 100644
--- a/src/mesa/drivers/dri/i965/brw_link.cpp
+++ b/src/mesa/drivers/dri/i965/brw_link.cpp
@@ -290,14 +290,17 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
 
    build_program_resource_list(ctx, shProg);
 
-   for (stage = 0; stage < ARRAY_SIZE(shProg->_LinkedShaders); stage++) {
-      struct gl_linked_shader *shader = shProg->_LinkedShaders[stage];
-      if (!shader)
-         continue;
+   /* We can't free IR for SSO programs since those may need relinking. */
+   if (!shProg->SeparateShader) {
+      for (stage = 0; stage < ARRAY_SIZE(shProg->_LinkedShaders); stage++) {
+         struct gl_linked_shader *shader = shProg->_LinkedShaders[stage];
+         if (!shader)
+            continue;
 
-      /* The GLSL IR won't be needed anymore. */
-      ralloc_free(shader->ir);
-      shader->ir = NULL;
+         /* The GLSL IR won't be needed anymore. */
+         ralloc_free(shader->ir);
+         shader->ir = NULL;
+      }
    }
 
    return true;
-- 
2.7.4



More information about the mesa-stable mailing list