freedreno/ir3: Plumb the ir3_shader_variant into legalize.

legalize is computing a lot of state that goes in the variant, let's just
store it directly instead of passing pointers around.  This leaves
max_bary in place, which is doing some surprising work (overwriting the
original total_in in some cases).

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3494>
This commit is contained in:
Eric Anholt
2020-01-22 10:53:17 -08:00
committed by Marge Bot
parent f77369086c
commit 876824908d
3 changed files with 7 additions and 9 deletions
+1 -1
View File
@@ -1138,7 +1138,7 @@ struct ir3_ra_reg_set * ir3_ra_alloc_reg_set(struct ir3_compiler *compiler);
int ir3_ra(struct ir3_shader_variant *v, struct ir3_instruction **precolor, unsigned nprecolor);
/* legalize: */
void ir3_legalize(struct ir3 *ir, bool *has_ssbo, bool *need_pixlod, int *max_bary);
void ir3_legalize(struct ir3 *ir, struct ir3_shader_variant *so, int *max_bary);
/* ************************************************************************* */
/* instruction helpers */
+1 -1
View File
@@ -3528,7 +3528,7 @@ ir3_compile_shader_nir(struct ir3_compiler *compiler,
/* We need to do legalize after (for frag shader's) the "bary.f"
* offsets (inloc) have been assigned.
*/
ir3_legalize(ir, &so->has_ssbo, &so->need_pixlod, &max_bary);
ir3_legalize(ir, so, &max_bary);
ir3_debug_print(ir, "AFTER LEGALIZE");
+5 -7
View File
@@ -41,9 +41,8 @@
struct ir3_legalize_ctx {
struct ir3_compiler *compiler;
struct ir3_shader_variant *so;
gl_shader_stage type;
bool has_ssbo;
bool need_pixlod;
int max_bary;
};
@@ -252,7 +251,7 @@ legalize_block(struct ir3_legalize_ctx *ctx, struct ir3_block *block)
if (is_tex(n) || (n->opc == OPC_META_TEX_PREFETCH)) {
regmask_set(&state->needs_sy, n->regs[0]);
ctx->need_pixlod = true;
ctx->so->need_pixlod = true;
if (n->opc == OPC_META_TEX_PREFETCH)
has_tex_prefetch = true;
} else if (n->opc == OPC_RESINFO) {
@@ -281,7 +280,7 @@ legalize_block(struct ir3_legalize_ctx *ctx, struct ir3_block *block)
}
if (is_ssbo(n->opc) || (is_atomic(n->opc) && (n->flags & IR3_INSTR_G)))
ctx->has_ssbo = true;
ctx->so->has_ssbo = true;
/* both tex/sfu appear to not always immediately consume
* their src register(s):
@@ -568,11 +567,12 @@ mark_xvergence_points(struct ir3 *ir)
}
void
ir3_legalize(struct ir3 *ir, bool *has_ssbo, bool *need_pixlod, int *max_bary)
ir3_legalize(struct ir3 *ir, struct ir3_shader_variant *so, int *max_bary)
{
struct ir3_legalize_ctx *ctx = rzalloc(ir, struct ir3_legalize_ctx);
bool progress;
ctx->so = so;
ctx->max_bary = -1;
ctx->compiler = ir->compiler;
ctx->type = ir->type;
@@ -590,8 +590,6 @@ ir3_legalize(struct ir3 *ir, bool *has_ssbo, bool *need_pixlod, int *max_bary)
}
} while (progress);
*has_ssbo = ctx->has_ssbo;
*need_pixlod = ctx->need_pixlod;
*max_bary = ctx->max_bary;
do {