[Mesa-dev] [PATCH 01/14] glsl_to_tgsi: use array_id for temp arrays instead of hacking high bits
Nicolai Hähnle
nhaehnle at gmail.com
Tue Oct 18 09:21:45 UTC 2016
On 17.10.2016 15:39, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> ---
> src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 31 ++++++++++++++++++------------
> 1 file changed, 19 insertions(+), 12 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> index fd2485d..5bc2661 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
[snip]
> @@ -2488,33 +2495,35 @@ glsl_to_tgsi_visitor::visit(ir_dereference_variable *ir)
> }
> case ir_var_system_value:
> entry = new(mem_ctx) variable_storage(var,
> PROGRAM_SYSTEM_VALUE,
> var->data.location);
> break;
> case ir_var_auto:
> case ir_var_temporary:
> st_src_reg src = get_temp(var->type);
>
> - entry = new(mem_ctx) variable_storage(var, src.file, src.index);
> + entry = new(mem_ctx) variable_storage(var, src.file, src.index,
> + src.array_id);
> this->variables.push_tail(entry);
>
> break;
> }
>
> if (!entry) {
> printf("Failed to make storage for %s\n", var->name);
> exit(1);
> }
> }
>
> - this->result = st_src_reg(entry->file, entry->index, var->type, entry->component);
> + this->result = st_src_reg(entry->file, entry->index, var->type,
> + entry->component, entry->array_id);
> this->result.array_id = entry->array_id;
This assignment can be removed now.
Apart from that, this patch is
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
> if (this->shader->Stage == MESA_SHADER_VERTEX && var->data.mode == ir_var_shader_in && var->type->is_double())
> this->result.is_double_vertex_input = true;
> if (!native_integers)
> this->result.type = GLSL_TYPE_FLOAT;
> }
>
> static void
> shrink_array_declarations(struct inout_decl *decls, unsigned count,
> GLbitfield64* usage_mask,
> @@ -5489,30 +5498,28 @@ dst_register(struct st_translate *t, gl_register_file file, unsigned index,
> memset(t->temps + t->temps_size, 0, inc * sizeof(struct ureg_dst));
> t->temps_size += inc;
> }
>
> 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);
> + assert(array_id && array_id <= t->num_temp_arrays);
> + array = array_id - 1;
>
> if (ureg_dst_is_undef(t->arrays[array]))
> t->arrays[array] = ureg_DECL_array_temporary(
> t->ureg, t->array_sizes[array], TRUE);
>
> - return ureg_dst_array_offset(t->arrays[array],
> - (int)(index & 0xFFFF) - 0x8000);
> + return ureg_dst_array_offset(t->arrays[array], index);
>
> case PROGRAM_OUTPUT:
> if (!array_id) {
> if (t->procType == PIPE_SHADER_FRAGMENT)
> assert(index < 2 * FRAG_RESULT_MAX);
> else if (t->procType == PIPE_SHADER_TESS_CTRL ||
> t->procType == PIPE_SHADER_TESS_EVAL)
> assert(index < VARYING_SLOT_TESS_MAX);
> else
> assert(index < VARYING_SLOT_MAX);
>
More information about the mesa-dev
mailing list