mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
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 <timothy.arceri@collabora.com> Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
b8cb1a05cd
commit
ba1eb854bd
2 changed files with 15 additions and 0 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue