[Mesa-dev] [PATCH 87/88] glsl: handle 32bit and 64bit version of shader cache objects
Timothy Arceri
timothy.arceri at collabora.com
Sat Sep 24 05:26:08 UTC 2016
Pointers will have different lengths so we simple create a different
sha1 for each platform.
---
src/compiler/glsl/shader_cache.cpp | 4 ++--
src/compiler/glsl/shader_cache.h | 6 ++++++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp
index 37d6dbb..f43fdb1 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -40,10 +40,10 @@
#include "ir_optimization.h"
#include "ir_rvalue_visitor.h"
#include "ir_uniform.h"
+#include "shader_cache.h"
#include "util/mesa-sha1.h"
#include "util/string_to_uint_map.h"
#include "blob.h"
-#include "cache.h"
extern "C" {
#include "main/shaderobj.h"
@@ -1289,7 +1289,7 @@ shader_cache_read_program_metadata(struct gl_context *ctx,
/* Include bindings when creating sha1. These bindings change the resulting
* binary so they are just as important as the shader source.
*/
- char *bindings_str = ralloc_strdup(NULL, "vb: ");
+ char *bindings_str = ralloc_strdup(NULL, CACHED_PROGRAM"\n vb: ");
prog->AttributeBindings->iterate(create_binding_str, &bindings_str);
ralloc_strcat(&bindings_str, "fb: ");
prog->FragDataBindings->iterate(create_binding_str, &bindings_str);
diff --git a/src/compiler/glsl/shader_cache.h b/src/compiler/glsl/shader_cache.h
index ffcf4f8..f828eea 100644
--- a/src/compiler/glsl/shader_cache.h
+++ b/src/compiler/glsl/shader_cache.h
@@ -27,6 +27,12 @@
#include "cache.h"
+#if __x86_64__
+#define CACHED_PROGRAM "program64:"
+#else
+#define CACHED_PROGRAM "program32:"
+#endif
+
void
shader_cache_write_program_metadata(struct gl_context *ctx,
struct gl_shader_program *prog);
--
2.7.4
More information about the mesa-dev
mailing list