From 47d3019c4a4528e17711ceee16dd4191cab2f301 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 23 Aug 2018 21:21:04 -0700 Subject: [PATCH] iris: fix crash when binding optional shader for the first time --- src/gallium/drivers/iris/iris_program_cache.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); } -- 2.30.2