From: Nicolai Hähnle <nicolai.haeh...@amd.com> Unused arrays should have been removed earlier anyway, and it allows us to remove st_translate::array_sizes. --- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 4a19fe6..1df4864 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -5143,21 +5143,20 @@ struct st_translate { int num_immediates; struct ureg_dst outputs[PIPE_MAX_SHADER_OUTPUTS]; struct ureg_src inputs[PIPE_MAX_SHADER_INPUTS]; struct ureg_dst address[3]; struct ureg_src samplers[PIPE_MAX_SAMPLERS]; struct ureg_src buffers[PIPE_MAX_SHADER_BUFFERS]; struct ureg_src images[PIPE_MAX_SHADER_IMAGES]; struct ureg_src systemValues[SYSTEM_VALUE_MAX]; struct ureg_src shared_memory; struct tgsi_texture_offset tex_offsets[MAX_GLSL_TEXTURE_OFFSET]; - unsigned *array_sizes; struct array_decl *input_arrays; struct array_decl *output_arrays; const GLuint *inputMapping; const GLuint *outputMapping; /* For every instruction that contains a label (eg CALL), keep * details so that we can go back afterwards and emit the correct * tgsi instruction number for each label. */ @@ -5350,24 +5349,20 @@ dst_register(struct st_translate *t, gl_register_file file, unsigned index, if (ureg_dst_is_undef(t->temps[index])) t->temps[index] = ureg_DECL_local_temporary(t->ureg); return t->temps[index]; case PROGRAM_ARRAY: array = index >> 16; assert(array < t->num_temp_arrays); - if (ureg_dst_is_undef(t->arrays[array])) - t->arrays[array] = ureg_DECL_array_temporary( - t->ureg, t->array_sizes[array], TGSI_WRITEMASK_XYZW, TRUE); - return ureg_dst_array_offset(t->arrays[array], (int)(index & 0xFFFF) - 0x8000); case PROGRAM_OUTPUT: if (!array_id) { if (t->procType == PIPE_SHADER_FRAGMENT) assert(index < FRAG_RESULT_MAX); else if (t->procType == PIPE_SHADER_TESS_CTRL || t->procType == PIPE_SHADER_TESS_EVAL) assert(index < VARYING_SLOT_TESS_MAX); @@ -6028,24 +6023,32 @@ st_translate_program( t = CALLOC_STRUCT(st_translate); if (!t) { ret = PIPE_ERROR_OUT_OF_MEMORY; goto out; } t->procType = procType; t->inputMapping = inputMapping; t->outputMapping = outputMapping; t->ureg = ureg; + + /* + * Declare temporary arrays. + */ t->num_temp_arrays = program->next_array; - if (t->num_temp_arrays) + if (t->num_temp_arrays) { t->arrays = (struct ureg_dst*) calloc(1, sizeof(t->arrays[0]) * t->num_temp_arrays); + for (i = 0; i < t->num_temp_arrays; ++i) + t->arrays[i] = ureg_DECL_array_temporary( + t->ureg, program->array_sizes[i], TGSI_WRITEMASK_XYZW, TRUE); + } /* * Declare input attributes. */ switch (procType) { case PIPE_SHADER_FRAGMENT: for (i = 0; i < numInputs; i++) { unsigned array_id = 0; unsigned array_size; @@ -6243,21 +6246,20 @@ st_translate_program( if (procType == PIPE_SHADER_FRAGMENT && semName == TGSI_SEMANTIC_POSITION) emit_wpos(st_context(ctx), t, proginfo, ureg, program->wpos_transform_const); sysInputs &= ~(1 << i); } } } - t->array_sizes = program->array_sizes; t->input_arrays = program->input_arrays; t->output_arrays = program->output_arrays; /* Emit constants and uniforms. TGSI uses a single index space for these, * so we put all the translated regs in t->constants. */ if (proginfo->Parameters) { t->constants = (struct ureg_src *) calloc(proginfo->Parameters->NumParameters, sizeof(t->constants[0])); if (t->constants == NULL) { -- 2.7.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev