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

Timothy Arceri timothy.arceri at collabora.com
Wed Jul 13 02:48:13 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 dc426bf..527b636 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -4785,13 +4785,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 169fa98..0fcb469 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