When we fallback currently the gl_program objects are re-allocated.

This is likely to change when the i965 cache lands, but for now
this fixes a crash when using MESA_GLSL=cache_fb. This env var
simulates the fallback path taken when a tgsi cache item doesn't
exist due to being evicted previously or some kind of error.

Unlike i965 we are always falling back at link time so it's safe to
just re-allocate everything. We will be unnecessarily freeing and
re-allocate a bunch of things here but it's probably not a huge deal,
and can be changed when the i965 code lands.

Cc: Nicolai Hähnle <nhaeh...@gmail.com>
---
 src/mesa/state_tracker/st_shader_cache.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/mesa/state_tracker/st_shader_cache.c 
b/src/mesa/state_tracker/st_shader_cache.c
index 394adbe..bb162cd 100644
--- a/src/mesa/state_tracker/st_shader_cache.c
+++ b/src/mesa/state_tracker/st_shader_cache.c
@@ -388,19 +388,18 @@ st_load_tgsi_from_disk_cache(struct gl_context *ctx,
 fallback_recompile:
    free(buffer);
 
    if (ctx->_Shader->Flags & GLSL_CACHE_INFO)
       fprintf(stderr, "TGSI cache falling back to recompile.\n");
 
    for (unsigned i = 0; i < prog->NumShaders; i++) {
       _mesa_glsl_compile_shader(ctx, prog->Shaders[i], false, false, true);
    }
 
-   prog->data->cache_fallback = true;
    _mesa_glsl_link_shader(ctx, prog);
 
    /* Turn the fallback flag back on if we disabled it previously */
    if (cache_fb)
       ctx->_Shader->Flags |= GLSL_CACHE_FALLBACK;
 
    return true;
 }
-- 
2.9.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to