Since most shaders wouldn't need that large array of immediates, making
the array dynamic could save unnecessary spaces.
In addition, sometimes we can potentially have a much larger array
of immediates to be lowered, which might be more than 64.
Signed-off-by: Rob Clark <robdclark@gmail.com>
new_flags &= ~IR3_REG_FNEG;
}
+ /* Reallocate for 4 more elements whenever it's necessary */
+ if (ctx->immediate_idx == ctx->so->immediates_size * 4) {
+ ctx->so->immediates_size += 4;
+ ctx->so->immediates = realloc (ctx->so->immediates,
+ ctx->so->immediates_size * sizeof (ctx->so->immediates[0]));
+ }
+
for (i = 0; i < ctx->immediate_idx; i++) {
swiz = i % 4;
idx = i / 4;
ir3_destroy(v->ir);
if (v->bo)
fd_bo_del(v->bo);
+ if (v->immediates)
+ free(v->immediates);
free(v);
}
} constbase;
unsigned immediates_count;
+ unsigned immediates_size;
struct {
uint32_t val[4];
- } immediates[64];
+ } *immediates;
/* for astc srgb workaround, the number/base of additional
* alpha tex states we need, and index of original tex states