[Mesa-dev] [PATCH 33/40] glsl: create separate 32bit and 64bit versions of shader cache objects
Nicolai Hähnle
nhaehnle at gmail.com
Fri Feb 10 11:29:48 UTC 2017
On 07.02.2017 04:42, Timothy Arceri wrote:
> From: Timothy Arceri <timothy.arceri at collabora.com>
>
> Pointers will have different lengths so we simply create a different
> sha1 for each platform.
>
> In theory we should be able to share cached shaders as we cache all
> pointer as uint64_t however if a pointer is ever added to one of the
> structs we write to file with blob_write_bytes() we run the risk of
> introducing a bug that would be difficult to reproduce or report from
> a user point of veiw. It's also very unlikely that Mesa developers will
> regularly regression test the interaction of cache sharing between
> platforms.
I think we should avoid storing pointers in the first place...
Nicolai
> ---
> src/compiler/glsl/shader_cache.cpp | 2 +-
> src/compiler/glsl/shader_cache.h | 6 ++++++
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp
> index 44ca5a4..ddcaeee 100644
> --- a/src/compiler/glsl/shader_cache.cpp
> +++ b/src/compiler/glsl/shader_cache.cpp
> @@ -1348,7 +1348,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 *buf = ralloc_strdup(NULL, "vb: ");
> + char *buf = ralloc_strdup(NULL, CACHED_PROGRAM"\n vb: ");
> prog->AttributeBindings->iterate(create_binding_str, &buf);
> ralloc_strcat(&buf, "fb: ");
> prog->FragDataBindings->iterate(create_binding_str, &buf);
> diff --git a/src/compiler/glsl/shader_cache.h b/src/compiler/glsl/shader_cache.h
> index 1596c33..2994b66 100644
> --- a/src/compiler/glsl/shader_cache.h
> +++ b/src/compiler/glsl/shader_cache.h
> @@ -27,6 +27,12 @@
>
> #include "util/disk_cache.h"
>
> +#if __x86_64__
> +#define CACHED_PROGRAM "program64:"
> +#else
> +#define CACHED_PROGRAM "program32:"
> +#endif
> +
> static uint64_t inline
> ptr_to_uint64_t(void *ptr)
> {
>
More information about the mesa-dev
mailing list