[Mesa-dev] [PATCH 06/77] glsl: add cache to ctx and add sha1 string fields
Timothy Arceri
timothy.arceri at collabora.com
Mon Oct 3 06:04:25 UTC 2016
From: Carl Worth <cworth at cworth.org>
V2: dont leak cache
Signed-off-by: Timothy Arceri <timothy.arceri at collabora.com>
---
src/mesa/main/context.c | 6 ++++++
src/mesa/main/mtypes.h | 5 +++++
2 files changed, 11 insertions(+)
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 697b518..a7c4a58 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -140,6 +140,7 @@
#endif
#include "compiler/glsl_types.h"
+#include "compiler/glsl/cache.h"
#include "compiler/glsl/glsl_parser_extras.h"
#include <stdbool.h>
@@ -1220,6 +1221,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);
@@ -1260,6 +1263,7 @@ fail:
free(ctx->BeginEnd);
free(ctx->OutsideBeginEnd);
free(ctx->Save);
+ ralloc_free(ctx->Cache);
return GL_FALSE;
}
@@ -1327,6 +1331,8 @@ _mesa_free_context_data( struct gl_context *ctx )
free(ctx->Save);
free(ctx->ContextLost);
+ ralloc_free(ctx->Cache);
+
/* Shared context state (display lists, textures, etc) */
_mesa_reference_shared_state(ctx, &ctx->Shared, NULL);
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index e62b23f..51a0d1c 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2490,6 +2490,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 */
@@ -2718,6 +2719,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
@@ -4705,6 +4708,8 @@ struct gl_context
* Stores the arguments to glPrimitiveBoundingBox
*/
GLfloat PrimitiveBoundingBox[8];
+
+ struct program_cache *Cache;
};
/**
--
2.7.4
More information about the mesa-dev
mailing list