[Mesa-dev] [PATCH] mesa: disable on-disk shader cache unless supported by the driver

Timothy Arceri tarceri at itsqueeze.com
Thu Feb 2 05:17:02 UTC 2017


This will stop people enabling the shader cache on drivers that
don't support it via the env vars. Also this will be required once
support is enabled by default to stop drivers without support from
breaking.
---
 src/mesa/main/context.c | 3 ++-
 src/mesa/main/mtypes.h  | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 7ecd241..085cec9 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1230,7 +1230,8 @@ _mesa_initialize_context(struct gl_context *ctx,
    memset(&ctx->TextureFormatSupported, GL_TRUE,
 	  sizeof(ctx->TextureFormatSupported));
 
-   ctx->Cache = disk_cache_create();
+   if (ctx->Const.DiskShaderCache)
+      ctx->Cache = disk_cache_create();
 
    switch (ctx->API) {
    case API_OPENGL_COMPAT:
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 3dcc23d..8a0c180 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3762,6 +3762,9 @@ struct gl_constants
 
    /** GL_OES_primitive_bounding_box */
    bool NoPrimitiveBoundingBoxOutput;
+
+   /** Does this driver support an on-disk shader cache */
+   bool DiskShaderCache;
 };
 
 
-- 
2.9.3



More information about the mesa-dev mailing list