[Mesa-dev] [PATCH 78/88] glsl: don't reprocess or clear UBOs on cache fallback

Timothy Arceri timothy.arceri at collabora.com
Sat Sep 24 05:25:59 UTC 2016


---
 src/compiler/glsl/linker.cpp | 14 ++++++++------
 src/mesa/main/shaderobj.c    | 16 +++++++++-------
 2 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 9b4c2e9..849c027 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -4907,13 +4907,15 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog,
    if (prog->SeparateShader)
       disable_varying_optimizations_for_sso(prog);
 
-   /* Process UBOs */
-   if (!interstage_cross_validate_uniform_blocks(prog, false))
-      goto done;
+   if (create_program_metadata) {
+      /* Process UBOs */
+      if (!interstage_cross_validate_uniform_blocks(prog, false))
+         goto done;
 
-   /* Process SSBOs */
-   if (!interstage_cross_validate_uniform_blocks(prog, true))
-      goto done;
+      /* Process SSBOs */
+      if (!interstage_cross_validate_uniform_blocks(prog, true))
+         goto done;
+   }
 
    /* Do common optimization before assigning storage for attributes,
     * uniforms, and varyings.  Later optimization could possibly make
diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c
index 98f7b9e..7f94c1c 100644
--- a/src/mesa/main/shaderobj.c
+++ b/src/mesa/main/shaderobj.c
@@ -318,13 +318,15 @@ _mesa_clear_shader_program_data(struct gl_shader_program *shProg,
    ralloc_free(shProg->InfoLog);
    shProg->InfoLog = ralloc_strdup(shProg, "");
 
-   ralloc_free(shProg->UniformBlocks);
-   shProg->UniformBlocks = NULL;
-   shProg->NumUniformBlocks = 0;
-
-   ralloc_free(shProg->ShaderStorageBlocks);
-   shProg->ShaderStorageBlocks = NULL;
-   shProg->NumShaderStorageBlocks = 0;
+   if (!is_cache_fallback) {
+      ralloc_free(shProg->UniformBlocks);
+      shProg->UniformBlocks = NULL;
+      shProg->NumUniformBlocks = 0;
+
+      ralloc_free(shProg->ShaderStorageBlocks);
+      shProg->ShaderStorageBlocks = NULL;
+      shProg->NumShaderStorageBlocks = 0;
+   }
 
    if (shProg->AtomicBuffers && !is_cache_fallback) {
       ralloc_free(shProg->AtomicBuffers);
-- 
2.7.4



More information about the mesa-dev mailing list