[Mesa-dev] [PATCH 16/32] glsl: add api and glsl version to hash generation for shaders

Timothy Arceri tarceri at itsqueeze.com
Tue Feb 14 00:52:29 UTC 2017


---
 src/compiler/glsl/shader_cache.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp
index 2fb734f..3e8948f 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -1300,6 +1300,14 @@ shader_cache_read_program_metadata(struct gl_context *ctx,
    ralloc_asprintf_append(&buf, "sso: %s\n",
                           prog->SeparateShader ? "T" : "F");
 
+   /* A shader might end up producing different output depending on the glsl
+    * version supported by the compiler. For example a different path might be
+    * taken by the preprocessor, so add the version to the hash input.
+    */
+   ralloc_asprintf_append(&buf, "api: %d glsl: %d fglsl: %d\n",
+                          ctx->API, ctx->Const.GLSLVersion,
+                          ctx->Const.ForceGLSLVersion);
+
    char sha1buf[41];
    for (unsigned i = 0; i < prog->NumShaders; i++) {
       struct gl_shader *sh = prog->Shaders[i];
-- 
2.9.3



More information about the mesa-dev mailing list