freedreno/ir3: Fix sizing of the inputs/outputs array.
If you have a struct, the var's base driver location is not the last driver location that will be accessed in that var. We have a shader struct member with this number for us, already. Fixes overflows in: dEQP-GLES31.functional.program_interface_query.program_output.type.interface_blocks.out.named_block_explicit_location.struct.mat3x2 Reviewed-by: Connor Abbott <cwabbott0@gmail.com> Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4670>
This commit is contained in:
parent
ac937bf878
commit
5593d80a2c
|
@ -3236,24 +3236,13 @@ setup_output(struct ir3_context *ctx, nir_variable *out)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
max_drvloc(struct exec_list *vars)
|
|
||||||
{
|
|
||||||
int drvloc = -1;
|
|
||||||
nir_foreach_variable (var, vars) {
|
|
||||||
drvloc = MAX2(drvloc, (int)var->data.driver_location);
|
|
||||||
}
|
|
||||||
return drvloc;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
emit_instructions(struct ir3_context *ctx)
|
emit_instructions(struct ir3_context *ctx)
|
||||||
{
|
{
|
||||||
nir_function_impl *fxn = nir_shader_get_entrypoint(ctx->s);
|
nir_function_impl *fxn = nir_shader_get_entrypoint(ctx->s);
|
||||||
|
|
||||||
ctx->ninputs = (max_drvloc(&ctx->s->inputs) + 1) * 4;
|
ctx->ninputs = ctx->s->num_inputs * 4;
|
||||||
ctx->noutputs = (max_drvloc(&ctx->s->outputs) + 1) * 4;
|
ctx->noutputs = ctx->s->num_outputs * 4;
|
||||||
|
|
||||||
ctx->inputs = rzalloc_array(ctx, struct ir3_instruction *, ctx->ninputs);
|
ctx->inputs = rzalloc_array(ctx, struct ir3_instruction *, ctx->ninputs);
|
||||||
ctx->outputs = rzalloc_array(ctx, struct ir3_instruction *, ctx->noutputs);
|
ctx->outputs = rzalloc_array(ctx, struct ir3_instruction *, ctx->noutputs);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue