summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/context.c
diff options
context:
space:
mode:
authorCarl Worth <[email protected]>2016-04-14 11:04:23 +1000
committerTimothy Arceri <[email protected]>2017-01-31 09:51:30 +1100
commitba1eb854bdb054714c5e98140c5697ed9b894c42 (patch)
tree6c5afa6edff4b3344d4152a884fc941759b0704d /src/mesa/main/context.c
parentb8cb1a05cdf8a5dc7377d8a0c8d0ef5a655126cc (diff)
glsl: add cache to ctx and add sha1 string fields
We also add a flag for detecting shaders written to shader cache. V2: dont leak cache Signed-off-by: Timothy Arceri <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/main/context.c')
-rw-r--r--src/mesa/main/context.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index bd4551e2e53..7ecd241e6eb 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -121,6 +121,7 @@
#include "shared.h"
#include "shaderobj.h"
#include "shaderimage.h"
+#include "util/disk_cache.h"
#include "util/strtod.h"
#include "stencil.h"
#include "texcompress_s3tc.h"
@@ -1229,6 +1230,8 @@ _mesa_initialize_context(struct gl_context *ctx,
memset(&ctx->TextureFormatSupported, GL_TRUE,
sizeof(ctx->TextureFormatSupported));
+ ctx->Cache = disk_cache_create();
+
switch (ctx->API) {
case API_OPENGL_COMPAT:
ctx->BeginEnd = create_beginend_table(ctx);
@@ -1269,6 +1272,7 @@ fail:
free(ctx->BeginEnd);
free(ctx->OutsideBeginEnd);
free(ctx->Save);
+ ralloc_free(ctx->Cache);
return GL_FALSE;
}
@@ -1336,6 +1340,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);