You can just add a function to initialize the cache that drivers can optionally call. Then you don't need the const flag.
Marek On Feb 2, 2017 11:45 AM, "Timothy Arceri" <[email protected]> wrote: On Thu, 2 Feb 2017 17:32:58 +1100 Timothy Arceri <[email protected]> wrote: > On Thu, 2 Feb 2017 16:17:02 +1100 > Timothy Arceri <[email protected]> wrote: > > > 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) > > Actually I think this gets set too late from the driver. I need to > think about this some more. Ok this patch is fine I just need to set DiskShaderCache before _mesa_initialize_context() in the drivers that want to enable this which should be fine. We do the same for driver functions. > > > > + 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; > > }; > > > > > > _______________________________________________ > mesa-dev mailing list > [email protected] > https://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
