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);
}
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)
if (instr->address != addr) {
struct ir3 *ir = instr->block->shader;
instr->address = addr;
- array_insert(ir->indirects, instr);
+ array_insert(ir, ir->indirects, instr);
}
}
}
}
-#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)
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;
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);
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);
}
}