[Mesa-dev] [PATCH 15/27] i965: don't precompile or rebuild resource list on cache fallback

Jordan Justen jordan.l.justen at intel.com
Sat Aug 19 07:44:31 UTC 2017


From: Timothy Arceri <timothy.arceri at collabora.com>

---
 src/mesa/drivers/dri/i965/brw_link.cpp | 22 ++++++++++++----------
 src/mesa/main/shaderobj.c              |  2 +-
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp
index e9158c596c..9c5b9ae310 100644
--- a/src/mesa/drivers/dri/i965/brw_link.cpp
+++ b/src/mesa/drivers/dri/i965/brw_link.cpp
@@ -291,19 +291,21 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
       }
    }
 
-   if (brw->precompile && !brw_shader_precompile(ctx, shProg))
-      return false;
+   if (!shProg->data->cache_fallback) {
+      if (brw->precompile && !brw_shader_precompile(ctx, shProg))
+         return false;
 
-   build_program_resource_list(ctx, 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;
+      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;
diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c
index f45ad850d9..5b342f865b 100644
--- a/src/mesa/main/shaderobj.c
+++ b/src/mesa/main/shaderobj.c
@@ -370,7 +370,7 @@ _mesa_clear_shader_program_data(struct gl_context *ctx,
       shProg->data->NumAtomicBuffers = 0;
    }
 
-   if (shProg->data->ProgramResourceList) {
+   if (shProg->data->ProgramResourceList && !shProg->data->cache_fallback) {
       ralloc_free(shProg->data->ProgramResourceList);
       shProg->data->ProgramResourceList = NULL;
       shProg->data->NumProgramResourceList = 0;
-- 
2.14.0



More information about the mesa-dev mailing list