mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
freedreno/ir3: convert dynamic arrays to ralloc
Want to move one of these under ir3_block, so that gives a reason to migrate the remaining malloc/realloc to ralloc. Signed-off-by: Rob Clark <robdclark@gmail.com>
This commit is contained in:
parent
870760e02e
commit
331bd3b5e1
3 changed files with 8 additions and 14 deletions
|
|
@ -63,12 +63,6 @@ struct ir3 * ir3_create(struct ir3_compiler *compiler,
|
|||
|
||||
void ir3_destroy(struct ir3 *shader)
|
||||
{
|
||||
/* TODO convert the dynamic array to ralloc too: */
|
||||
free(shader->indirects);
|
||||
free(shader->predicates);
|
||||
free(shader->baryfs);
|
||||
free(shader->keeps);
|
||||
free(shader->astc_srgb);
|
||||
ralloc_free(shader);
|
||||
}
|
||||
|
||||
|
|
@ -626,7 +620,7 @@ static void insert_instr(struct ir3_block *block,
|
|||
list_addtail(&instr->node, &block->instr_list);
|
||||
|
||||
if (is_input(instr))
|
||||
array_insert(shader->baryfs, instr);
|
||||
array_insert(shader, shader->baryfs, instr);
|
||||
}
|
||||
|
||||
struct ir3_block * ir3_block_create(struct ir3 *shader)
|
||||
|
|
@ -729,7 +723,7 @@ ir3_instr_set_address(struct ir3_instruction *instr,
|
|||
if (instr->address != addr) {
|
||||
struct ir3 *ir = instr->block->shader;
|
||||
instr->address = addr;
|
||||
array_insert(ir->indirects, instr);
|
||||
array_insert(ir, ir->indirects, instr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -854,10 +854,10 @@ static inline unsigned ir3_cat3_absneg(opc_t opc)
|
|||
}
|
||||
}
|
||||
|
||||
#define array_insert(arr, val) do { \
|
||||
#define array_insert(ctx, arr, val) do { \
|
||||
if (arr ## _count == arr ## _sz) { \
|
||||
arr ## _sz = MAX2(2 * arr ## _sz, 16); \
|
||||
arr = realloc(arr, arr ## _sz * sizeof(arr[0])); \
|
||||
arr = reralloc_size(ctx, arr, arr ## _sz * sizeof(arr[0])); \
|
||||
} \
|
||||
arr[arr ##_count++] = val; \
|
||||
} while (0)
|
||||
|
|
|
|||
|
|
@ -1306,9 +1306,9 @@ emit_intrinsic(struct ir3_compile *ctx, nir_intrinsic_instr *intr)
|
|||
cond->regs[0]->num = regid(REG_P0, 0);
|
||||
|
||||
kill = ir3_KILL(b, cond, 0);
|
||||
array_insert(ctx->ir->predicates, kill);
|
||||
array_insert(ctx->ir, ctx->ir->predicates, kill);
|
||||
|
||||
array_insert(ctx->ir->keeps, kill);
|
||||
array_insert(ctx->ir, ctx->ir->keeps, kill);
|
||||
ctx->so->has_kill = true;
|
||||
|
||||
break;
|
||||
|
|
@ -1583,7 +1583,7 @@ emit_tex(struct ir3_compile *ctx, nir_tex_instr *tex)
|
|||
sam = ir3_SAM(b, opc, type, TGSI_WRITEMASK_W, flags,
|
||||
tex_idx, tex_idx, col0, col1);
|
||||
|
||||
array_insert(ctx->ir->astc_srgb, sam);
|
||||
array_insert(ctx->ir, ctx->ir->astc_srgb, sam);
|
||||
|
||||
/* fixup .w component: */
|
||||
split_dest(b, &dst[3], sam, 3, 1);
|
||||
|
|
@ -1972,7 +1972,7 @@ emit_stream_out(struct ir3_compile *ctx)
|
|||
stg->cat6.type = TYPE_U32;
|
||||
stg->cat6.dst_offset = (strmout->output[i].dst_offset + j) * 4;
|
||||
|
||||
array_insert(ctx->ir->keeps, stg);
|
||||
array_insert(ctx->ir, ctx->ir->keeps, stg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue