diff --git a/src/freedreno/ir3/ir3_cp.c b/src/freedreno/ir3/ir3_cp.c index ca80b7a8bc2..052c8a539ac 100644 --- a/src/freedreno/ir3/ir3_cp.c +++ b/src/freedreno/ir3/ir3_cp.c @@ -383,7 +383,14 @@ lower_immed(struct ir3_cp_ctx *ctx, struct ir3_instruction *instr, unsigned n, } if (i == const_state->immediate_idx) { - /* need to generate a new immediate: */ + struct ir3_compiler *compiler = instr->block->shader->compiler; + /* Add on a new immediate to be pushed, if we have space left in the + * constbuf. + */ + if (const_state->offsets.immediate + const_state->immediate_idx / 4 >= + compiler->max_const) + return false; + swiz = i % 4; idx = i / 4;