const struct ir3_const_state *const_state = ir3_const_state(v);
uint32_t base = const_state->offsets.immediate;
- int size = const_state->immediates_count;
+ int size = DIV_ROUND_UP(const_state->immediates_count, 4);
if (ir3_kernel->info.numwg != INVALID_REG) {
assert((ir3_kernel->info.numwg & 0x3) == 0);
/* Reallocate for 4 more elements whenever it's necessary */
struct ir3_const_state *const_state = ir3_const_state(ctx->so);
- if (const_state->immediate_idx == const_state->immediates_size * 4) {
+ if (const_state->immediates_count == const_state->immediates_size * 4) {
const_state->immediates = rerzalloc(const_state,
const_state->immediates,
__typeof__(const_state->immediates[0]),
const_state->immediates_size + 4);
const_state->immediates_size += 4;
- for (int i = const_state->immediate_idx; i < const_state->immediates_size * 4; i++)
+ for (int i = const_state->immediates_count; i < const_state->immediates_size * 4; i++)
const_state->immediates[i / 4].val[i % 4] = 0xd0d0d0d0;
}
- for (i = 0; i < const_state->immediate_idx; i++) {
+ for (i = 0; i < const_state->immediates_count; i++) {
swiz = i % 4;
idx = i / 4;
}
}
- if (i == const_state->immediate_idx) {
+ if (i == const_state->immediates_count) {
/* 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 >=
+ if (const_state->offsets.immediate + const_state->immediates_count / 4 >=
ir3_max_const(ctx->so))
return false;
idx = i / 4;
const_state->immediates[idx].val[swiz] = reg->uim_val;
- const_state->immediates_count = idx + 1;
- const_state->immediate_idx++;
+ const_state->immediates_count++;
}
reg->flags = new_flags;
struct ir3_const_state *const_state = ir3_const_state(variant);
assert((reg & 0x7) == 0);
int idx = reg >> (1 + 2); /* low bit is half vs full, next two bits are swiz */
- if (const_state->immediate_idx == const_state->immediates_size * 4) {
+ if (const_state->immediates_count == const_state->immediates_size * 4) {
const_state->immediates = rerzalloc(const_state,
const_state->immediates,
__typeof__(const_state->immediates[0]),
const_state->immediates[idx].val[1] = c1;
const_state->immediates[idx].val[2] = c2;
const_state->immediates[idx].val[3] = c3;
- const_state->immediates_count = idx + 1;
- const_state->immediate_idx++;
+ const_state->immediates_count++;
}
static void add_sysval(unsigned reg, unsigned compmask, gl_system_value sysval)
}
const struct ir3_const_state *const_state = ir3_const_state(so);
- for (i = 0; i < const_state->immediates_count; i++) {
+ for (i = 0; i < DIV_ROUND_UP(const_state->immediates_count, 4); i++) {
fprintf(out, "@const(c%d.x)\t", const_state->offsets.immediate + i);
fprintf(out, "0x%08x, 0x%08x, 0x%08x, 0x%08x\n",
const_state->immediates[i].val[0],
uint32_t off[IR3_MAX_SHADER_IMAGES];
} image_dims;
- unsigned immediate_idx;
unsigned immediates_count;
unsigned immediates_size;
struct {
const struct ir3_const_state *const_state = ir3_const_state(xs);
uint32_t base = const_state->offsets.immediate;
- int size = const_state->immediates_count;
+ int size = DIV_ROUND_UP(const_state->immediates_count, 4);
/* truncate size to avoid writing constants that shader
* does not use:
{
const struct ir3_const_state *const_state = ir3_const_state(v);
uint32_t base = const_state->offsets.immediate;
- int size = const_state->immediates_count;
+ int size = DIV_ROUND_UP(const_state->immediates_count, 4);
/* truncate size to avoid writing constants that shader
* does not use: