summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2019-02-18 13:54:26 -0500
committerRob Clark <[email protected]>2019-02-20 18:50:08 -0500
commit97479df8aaf6f00ebc70da452ea43e04f829ef2f (patch)
tree0063f211b2265005ba563ff787d1a407d7156cec /src/gallium/drivers/freedreno
parentf5ee8c54ed481f5c832f9364845680cc223a85b3 (diff)
freedreno/ir3: fix crash in compile fail case
The variant will be NULL if RA failed. Which isn't ideal, but at least lets not segfault and bring down the rest of the dEQP run with us. Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno')
-rw-r--r--src/gallium/drivers/freedreno/a6xx/fd6_draw.c9
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_cache.c4
2 files changed, 8 insertions, 5 deletions
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_draw.c b/src/gallium/drivers/freedreno/a6xx/fd6_draw.c
index adbdef24a4d..9ed79cbcb7f 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_draw.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_draw.c
@@ -186,6 +186,10 @@ fd6_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info,
fd6_ctx->prog = fd6_emit_get_prog(&emit);
}
+ /* bail if compile failed: */
+ if (!fd6_ctx->prog)
+ return NULL;
+
emit.dirty = ctx->dirty; /* *after* fixup_shader_state() */
emit.bs = fd6_emit_get_prog(&emit)->bs;
emit.vs = fd6_emit_get_prog(&emit)->vs;
@@ -194,11 +198,6 @@ fd6_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info,
const struct ir3_shader_variant *vp = emit.vs;
const struct ir3_shader_variant *fp = emit.fs;
- /* do regular pass first, since that is more likely to fail compiling: */
-
- if (!vp || !fp)
- return false;
-
ctx->stats.vs_regs += ir3_shader_halfregs(vp);
ctx->stats.fs_regs += ir3_shader_halfregs(fp);
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_cache.c b/src/gallium/drivers/freedreno/ir3/ir3_cache.c
index 2de23e49873..8e7070a727d 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_cache.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_cache.c
@@ -97,6 +97,10 @@ ir3_cache_lookup(struct ir3_cache *cache, const struct ir3_cache_key *key,
struct ir3_shader_variant *vs = ir3_shader_variant(key->vs, key->key, false, debug);
struct ir3_shader_variant *fs = ir3_shader_variant(key->fs, key->key, false, debug);
+ if (!bs || !vs || !fs) {
+ return NULL;
+ }
+
struct ir3_program_state *state =
cache->funcs->create_state(cache->data, bs, vs, fs, &key->key);
state->key = *key;