diff options
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/vc4/vc4_program.c | 15 | ||||
-rw-r--r-- | src/gallium/drivers/vc4/vc4_qir.h | 1 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c index 589d33ab1a0..c3da5fe2c6f 100644 --- a/src/gallium/drivers/vc4/vc4_program.c +++ b/src/gallium/drivers/vc4/vc4_program.c @@ -104,6 +104,18 @@ add_uniform(struct vc4_compile *c, uint32_t uniform = c->num_uniforms++; struct qreg u = { QFILE_UNIF, uniform }; + if (uniform >= c->uniform_array_size) { + c->uniform_array_size = MAX2(MAX2(16, uniform + 1), + c->uniform_array_size * 2); + + c->uniform_data = reralloc(c, c->uniform_data, + uint32_t, + c->uniform_array_size); + c->uniform_contents = reralloc(c, c->uniform_contents, + enum quniform_contents, + c->uniform_array_size); + } + c->uniform_contents[uniform] = contents; c->uniform_data[uniform] = data; @@ -1573,9 +1585,6 @@ vc4_shader_tgsi_to_qir(struct vc4_context *vc4, c->stage = stage; - c->uniform_data = ralloc_array(c, uint32_t, 1024); - c->uniform_contents = ralloc_array(c, enum quniform_contents, 1024); - c->shader_state = key->shader_state; ret = tgsi_parse_init(&c->parser, c->shader_state->tokens); assert(ret == TGSI_PARSE_OK); diff --git a/src/gallium/drivers/vc4/vc4_qir.h b/src/gallium/drivers/vc4/vc4_qir.h index ddd1f063a38..3d8caeb8a29 100644 --- a/src/gallium/drivers/vc4/vc4_qir.h +++ b/src/gallium/drivers/vc4/vc4_qir.h @@ -238,6 +238,7 @@ struct vc4_compile { uint32_t *uniform_data; enum quniform_contents *uniform_contents; + uint32_t uniform_array_size; uint32_t num_uniforms; uint32_t num_outputs; uint32_t num_texture_samples; |