From: Kenneth Graunke Date: Tue, 24 Jul 2018 23:20:02 +0000 (-0700) Subject: iris: unbind compiled shaders if none are present X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=77b92198188e031bb355c896fe522e02e59cfe31;p=mesa.git iris: unbind compiled shaders if none are present avoids the case where you have a stale compiled shader bound, but no uncompiled shader bound, which is not just boats, but an entire marina --- diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index dd77fda2d59..98af24cf223 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -416,6 +416,8 @@ void iris_print_program_cache(struct iris_context *ice); bool iris_bind_cached_shader(struct iris_context *ice, enum iris_program_cache_id cache_id, const void *key); +void iris_unbind_shader(struct iris_context *ice, + enum iris_program_cache_id cache_id); void iris_upload_and_bind_shader(struct iris_context *ice, enum iris_program_cache_id cache_id, const void *key, diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c index 6f24acc1cce..13b75466317 100644 --- a/src/gallium/drivers/iris/iris_program.c +++ b/src/gallium/drivers/iris/iris_program.c @@ -439,8 +439,10 @@ iris_update_compiled_tcs(struct iris_context *ice) assert(!(tes && !tcs)); - if (!tcs) + if (!tcs) { + iris_unbind_shader(ice, IRIS_CACHE_TCS); return; + } const struct shader_info *tes_info = iris_get_shader_info(ice, MESA_SHADER_TESS_EVAL); @@ -513,8 +515,10 @@ iris_update_compiled_tes(struct iris_context *ice) struct iris_uncompiled_shader *ish = ice->shaders.uncompiled[MESA_SHADER_TESS_EVAL]; - if (!ish) + if (!ish) { + iris_unbind_shader(ice, IRIS_CACHE_TES); return; + } struct brw_tes_prog_key key = { .program_string_id = ish->program_id }; get_unified_tess_slots(ice, &key.inputs_read, &key.patch_inputs_read); @@ -582,8 +586,10 @@ iris_update_compiled_gs(struct iris_context *ice) struct iris_uncompiled_shader *ish = ice->shaders.uncompiled[MESA_SHADER_GEOMETRY]; - if (!ish) + if (!ish) { + iris_unbind_shader(ice, IRIS_CACHE_GS); return; + } struct brw_gs_prog_key key = { .program_string_id = ish->program_id }; ice->vtbl.populate_gs_key(ice, &key); diff --git a/src/gallium/drivers/iris/iris_program_cache.c b/src/gallium/drivers/iris/iris_program_cache.c index 6f88062f269..0b8286ecb3d 100644 --- a/src/gallium/drivers/iris/iris_program_cache.c +++ b/src/gallium/drivers/iris/iris_program_cache.c @@ -172,6 +172,16 @@ iris_bind_cached_shader(struct iris_context *ice, return true; } +void +iris_unbind_shader(struct iris_context *ice, + enum iris_program_cache_id cache_id) +{ + if (ice->shaders.prog[cache_id]) { + ice->shaders.prog[cache_id] = NULL; + ice->state.dirty |= dirty_flag_for_cache(cache_id); + } +} + const void * iris_find_previous_compile(const struct iris_context *ice, enum iris_program_cache_id cache_id,