[Mesa-dev] [PATCH 25/37] mesa/glsl: add cache_fallback flag to gl_shader_program_data

Timothy Arceri t_arceri at yahoo.com.au
Mon Jan 23 23:13:04 UTC 2017


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

This will allow us to skip certain things when falling back to
a full recompile on a cache miss such as avoiding reinitialising
uniforms.

In this chage we use it to avoid reading the program metadata
from the cache and skipping linking during a fallback.
---
 src/compiler/glsl/shader_cache.cpp | 2 +-
 src/mesa/main/mtypes.h             | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp
index 5cd134a..1179c12 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -1239,7 +1239,7 @@ shader_cache_read_program_metadata(struct gl_context *ctx,
       return false;
 
    struct disk_cache *cache = ctx->Cache;
-   if (!cache)
+   if (!cache || prog->data->cache_fallback)
       return false;
 
    for (unsigned i = 0; i < prog->NumShaders; i++) {
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index a2280e2..2c1e11b 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2673,6 +2673,8 @@ struct gl_shader_program_data
    unsigned NumUniformDataSlots;
    union gl_constant_value *UniformDataSlots;
 
+   bool cache_fallback;
+
    /** List of all active resources after linking. */
    struct gl_program_resource *ProgramResourceList;
    unsigned NumProgramResourceList;
-- 
2.9.3



More information about the mesa-dev mailing list