* creating duplicate variants..
*/
- if (ir3_key_lowers_nir(&so->key)) {
- nir_shader *s = nir_shader_clone(ctx, so->shader->nir);
- ctx->s = ir3_optimize_nir(so->shader, s, &so->key);
- } else {
- /* fast-path for shader key that lowers nothing in NIR: */
- ctx->s = nir_shader_clone(ctx, so->shader->nir);
- }
+ ctx->s = nir_shader_clone(ctx, so->shader->nir);
+ if (ir3_key_lowers_nir(&so->key))
+ ir3_optimize_nir(so->shader, ctx->s, &so->key);
/* this needs to be the last pass run, so do this here instead of
* in ir3_optimize_nir():
} while (progress);
}
-struct nir_shader *
+void
ir3_optimize_nir(struct ir3_shader *shader, nir_shader *s,
const struct ir3_shader_key *key)
{
if (!key) {
ir3_setup_const_state(shader, s);
}
-
- return s;
}
static void
const nir_shader_compiler_options * ir3_get_compiler_options(struct ir3_compiler *compiler);
bool ir3_key_lowers_nir(const struct ir3_shader_key *key);
-struct nir_shader * ir3_optimize_nir(struct ir3_shader *shader, nir_shader *s,
+void ir3_optimize_nir(struct ir3_shader *shader, nir_shader *s,
const struct ir3_shader_key *key);
bool ir3_nir_analyze_ubo_ranges(nir_shader *nir, struct ir3_shader *shader);
NIR_PASS_V(nir, nir_lower_io_arrays_to_elements_no_indirects, false);
/* do first pass optimization, ignoring the key: */
- shader->nir = ir3_optimize_nir(shader, nir, NULL);
+ ir3_optimize_nir(shader, nir, NULL);
+
+ shader->nir = nir;
if (ir3_shader_debug & IR3_DBG_DISASM) {
printf("dump nir%d: type=%d", shader->id, shader->type);
nir_print_shader(shader->nir, stdout);
}
s.compiler = compiler;
- s.nir = ir3_optimize_nir(&s, nir, NULL);
+ s.nir = nir;
+
+ ir3_optimize_nir(&s, nir, NULL);
v.key = key;
v.shader = &s;