int
ir3_compile_shader(struct ir3_shader_variant *so,
- const struct tgsi_token *tokens, struct ir3_shader_key key)
+ const struct tgsi_token *tokens, struct ir3_shader_key key,
+ bool cp)
{
struct ir3_compile_context ctx;
struct ir3_block *block;
ir3_dump_instr_list(block->head);
}
- ir3_block_cp(block);
+ if (cp)
+ ir3_block_cp(block);
if (fd_mesa_debug & FD_DBG_OPTDUMP)
compile_dump(&ctx);
int ir3_compile_shader(struct ir3_shader_variant *so,
const struct tgsi_token *tokens,
- struct ir3_shader_key key);
+ struct ir3_shader_key key, bool cp);
int ir3_compile_shader_old(struct ir3_shader_variant *so,
const struct tgsi_token *tokens,
struct ir3_shader_key key);
}
}
+/* reset before attempting to compile again.. */
+static void reset_variant(struct ir3_shader_variant *v, const char *msg)
+{
+ debug_error(msg);
+ v->inputs_count = 0;
+ v->outputs_count = 0;
+ v->total_in = 0;
+ v->has_samp = false;
+ v->immediates_count = 0;
+}
+
static struct ir3_shader_variant *
create_variant(struct ir3_shader *shader, struct ir3_shader_key key)
{
}
if (!(fd_mesa_debug & FD_DBG_NOOPT)) {
- ret = ir3_compile_shader(v, tokens, key);
+ ret = ir3_compile_shader(v, tokens, key, true);
if (ret) {
- debug_error("new compiler failed, trying fallback!");
-
- v->inputs_count = 0;
- v->outputs_count = 0;
- v->total_in = 0;
- v->has_samp = false;
- v->immediates_count = 0;
+ reset_variant(v, "new compiler failed, trying without copy propagation!");
+ ret = ir3_compile_shader(v, tokens, key, false);
+ if (ret)
+ reset_variant(v, "new compiler failed, trying fallback!");
}
} else {
ret = -1; /* force fallback to old compiler */