From: Kenneth Graunke Date: Fri, 24 Aug 2018 04:21:04 +0000 (-0700) Subject: iris: fix crash when binding optional shader for the first time X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=47d3019c4a4528e17711ceee16dd4191cab2f301;p=mesa.git iris: fix crash when binding optional shader for the first time --- diff --git a/src/gallium/drivers/iris/iris_program_cache.c b/src/gallium/drivers/iris/iris_program_cache.c index a27a4b9a83c..0006e8e8bea 100644 --- a/src/gallium/drivers/iris/iris_program_cache.c +++ b/src/gallium/drivers/iris/iris_program_cache.c @@ -172,7 +172,9 @@ iris_bind_cached_shader(struct iris_context *ice, if (!shader) return false; - if (memcmp(shader, ice->shaders.prog[cache_id], sizeof(*shader)) != 0) { + // XXX: why memcmp? + if (!ice->shaders.prog[cache_id] || + memcmp(shader, ice->shaders.prog[cache_id], sizeof(*shader)) != 0) { ice->shaders.prog[cache_id] = shader; ice->state.dirty |= dirty_flag_for_cache(cache_id); }