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
This commit is contained in:
Kenneth Graunke
2018-07-24 16:20:02 -07:00
parent fd5ed7b46b
commit 77b9219818
3 changed files with 21 additions and 3 deletions

View File

@@ -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,

View File

@@ -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);

View File

@@ -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,