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 <robdclark@gmail.com>
This commit is contained in:
Rob Clark 2019-02-18 13:54:26 -05:00
parent f5ee8c54ed
commit 97479df8aa
3 changed files with 9 additions and 6 deletions

View File

@ -228,7 +228,7 @@ ir3_shader_get_variant(struct ir3_shader *shader, struct ir3_shader_key *key,
struct ir3_shader_variant *v =
shader_variant(shader, key, created);
if (binning_pass) {
if (v && binning_pass) {
if (!v->binning)
v->binning = create_variant(shader, key, true);
return v->binning;

View File

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

View File

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