diff options
author | Marek Olšák <[email protected]> | 2015-05-26 15:09:20 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2015-06-05 19:44:32 +0200 |
commit | 57c98e22db3397efe42268ba0750f319cea3b0fd (patch) | |
tree | 1841fe67660d9cf6073b1a0df34b19d0c45dfb72 /src | |
parent | b6ebe7eabf54936a02acc0968e718e0c264a73f5 (diff) |
glsl_to_tgsi: don't use a static array size for "array_sizes"
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 95968120730..bf7f222e5de 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -317,7 +317,8 @@ public: int next_temp; - unsigned array_sizes[MAX_ARRAYS]; + unsigned *array_sizes; + unsigned max_num_arrays; unsigned next_array; int num_address_regs; @@ -1142,6 +1143,12 @@ glsl_to_tgsi_visitor::get_temp(const glsl_type *type) if (!options->EmitNoIndirectTemp && (type->is_array() || type->is_matrix())) { + if (next_array >= max_num_arrays) { + max_num_arrays += 32; + array_sizes = (unsigned*) + realloc(array_sizes, sizeof(array_sizes[0]) * max_num_arrays); + } + src.file = PROGRAM_ARRAY; src.index = next_array << 16 | 0x8000; array_sizes[next_array] = type_size(type); @@ -3344,6 +3351,8 @@ glsl_to_tgsi_visitor::glsl_to_tgsi_visitor() { result.file = PROGRAM_UNDEFINED; next_temp = 1; + array_sizes = NULL; + max_num_arrays = 0; next_array = 0; next_signature_id = 1; num_immediates = 0; @@ -3366,6 +3375,7 @@ glsl_to_tgsi_visitor::glsl_to_tgsi_visitor() glsl_to_tgsi_visitor::~glsl_to_tgsi_visitor() { + free(array_sizes); ralloc_free(mem_ctx); } @@ -4374,7 +4384,7 @@ struct st_translate { struct ureg_src samplers[PIPE_MAX_SAMPLERS]; struct ureg_src systemValues[SYSTEM_VALUE_MAX]; struct tgsi_texture_offset tex_offsets[MAX_GLSL_TEXTURE_OFFSET]; - unsigned array_sizes[MAX_ARRAYS]; + unsigned *array_sizes; const GLuint *inputMapping; const GLuint *outputMapping; @@ -5277,9 +5287,7 @@ st_translate_program( } } - /* Copy over array sizes - */ - memcpy(t->array_sizes, program->array_sizes, sizeof(unsigned) * program->next_array); + t->array_sizes = program->array_sizes; /* Emit constants and uniforms. TGSI uses a single index space for these, * so we put all the translated regs in t->constants. |