[Mesa-dev] [PATCH 08/65] glsl: add cache to ctx and add sha1 string fields

Timothy Arceri timothy.arceri at collabora.com
Fri Apr 29 13:33:07 UTC 2016


From: Carl Worth <cworth at cworth.org>

Signed-off-by: Timothy Arceri <timothy.arceri at collabora.com>
---
 src/mesa/main/context.c | 3 +++
 src/mesa/main/mtypes.h  | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 6af02d1..16f0bbd 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -143,6 +143,7 @@
 #include "sparc/sparc.h"
 #endif
 
+#include "compiler/glsl/cache.h"
 #include "compiler/glsl/glsl_parser_extras.h"
 #include <stdbool.h>
 
@@ -1222,6 +1223,8 @@ _mesa_initialize_context(struct gl_context *ctx,
    memset(&ctx->TextureFormatSupported, GL_TRUE,
 	  sizeof(ctx->TextureFormatSupported));
 
+   ctx->Cache = cache_create();
+
    switch (ctx->API) {
    case API_OPENGL_COMPAT:
       ctx->BeginEnd = create_beginend_table(ctx);
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 17100e4..3eced51 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2246,6 +2246,7 @@ struct gl_shader
    GLuint Name;  /**< AKA the handle */
    GLint RefCount;  /**< Reference count */
    GLchar *Label;   /**< GL_KHR_debug */
+   unsigned char sha1[20]; /**< SHA1 hash of pre-processed source */
    GLboolean DeletePending;
    GLboolean CompileStatus;
    bool IsES;              /**< True if this shader uses GLSL ES */
@@ -2619,6 +2620,8 @@ struct gl_shader_program
     * Is the application intending to glGetProgramBinary this program?
     */
    GLboolean BinaryRetreivableHint;
+   unsigned char sha1[20]; /**< SHA1 hash of linked program */
+   bool program_written_to_cache;
 
    /**
     * Indicates whether program can be bound for individual pipeline stages
@@ -4565,6 +4568,8 @@ struct gl_context
     * Once this field becomes true, it is never reset to false.
     */
    GLboolean ShareGroupReset;
+
+   struct program_cache *Cache;
 };
 
 /**
-- 
2.5.5



More information about the mesa-dev mailing list