diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/context.c | 6 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 9 |
2 files changed, 15 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); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 4ac75312d6c..1cc8322d348 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1927,6 +1927,9 @@ struct gl_program bool is_arb_asm; /** Is this an ARB assembly-style program */ + /** Is this program written to on disk shader cache */ + bool program_written_to_cache; + GLbitfield64 SecondaryOutputsWritten; /**< Subset of OutputsWritten outputs written with non-zero index. */ GLbitfield TexturesUsed[MAX_COMBINED_TEXTURE_IMAGE_UNITS]; /**< TEXTURE_x_BIT bitmask */ GLbitfield SamplersUsed; /**< Bitfield of which samplers are used */ @@ -2384,6 +2387,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 */ @@ -2649,6 +2653,9 @@ struct gl_shader_program_data { GLint RefCount; /**< Reference count */ + /** SHA1 hash of linked shader program */ + unsigned char sha1[20]; + unsigned NumUniformStorage; unsigned NumHiddenUniforms; struct gl_uniform_storage *UniformStorage; @@ -4645,6 +4652,8 @@ struct gl_context * Stores the arguments to glPrimitiveBoundingBox */ GLfloat PrimitiveBoundingBox[8]; + + struct disk_cache *Cache; }; /** |