<p dir="ltr">R-B</p>
<div class="gmail_quote">On Apr 10, 2016 10:52 PM, "Samuel Iglesias Gonsálvez" <<a href="mailto:siglesias@igalia.com">siglesias@igalia.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This patch is still unreviewed.<br>
<br>
Sam<br>
<br>
On 05/04/16 10:29, Samuel Iglesias Gonsálvez wrote:<br>
> Signed-off-by: Samuel Iglesias Gonsálvez <<a href="mailto:siglesias@igalia.com">siglesias@igalia.com</a>><br>
> ---<br>
><br>
> This would replace this patch [0] in the series.<br>
><br>
> [0] <a href="https://lists.freedesktop.org/archives/mesa-dev/2016-March/111347.html" rel="noreferrer" target="_blank">https://lists.freedesktop.org/archives/mesa-dev/2016-March/111347.html</a><br>
><br>
> src/compiler/nir/glsl_to_nir.cpp | 24 ++++++++++++++----------<br>
> 1 file changed, 14 insertions(+), 10 deletions(-)<br>
><br>
> diff --git a/src/compiler/nir/glsl_to_nir.cpp b/src/compiler/nir/glsl_to_nir.cpp<br>
> index c77b430..4db7946 100644<br>
> --- a/src/compiler/nir/glsl_to_nir.cpp<br>
> +++ b/src/compiler/nir/glsl_to_nir.cpp<br>
> @@ -73,7 +73,7 @@ public:<br>
> void create_function(ir_function_signature *ir);<br>
><br>
> private:<br>
> - void add_instr(nir_instr *instr, unsigned num_components);<br>
> + void add_instr(nir_instr *instr, unsigned num_components, unsigned bit_size);<br>
> nir_ssa_def *evaluate_rvalue(ir_rvalue *ir);<br>
><br>
> nir_alu_instr *emit(nir_op op, unsigned dest_size, nir_ssa_def **srcs);<br>
> @@ -1156,12 +1156,13 @@ get_instr_dest(nir_instr *instr)<br>
> }<br>
><br>
> void<br>
> -nir_visitor::add_instr(nir_instr *instr, unsigned num_components)<br>
> +nir_visitor::add_instr(nir_instr *instr, unsigned num_components,<br>
> + unsigned bit_size)<br>
> {<br>
> nir_dest *dest = get_instr_dest(instr);<br>
><br>
> if (dest)<br>
> - nir_ssa_dest_init(instr, dest, num_components, 32, NULL);<br>
> + nir_ssa_dest_init(instr, dest, num_components, bit_size, NULL);<br>
><br>
> nir_builder_instr_insert(&b, instr);<br>
><br>
> @@ -1186,8 +1187,8 @@ nir_visitor::evaluate_rvalue(ir_rvalue* ir)<br>
> load_instr->num_components = ir->type->vector_elements;<br>
> load_instr->variables[0] = this->deref_head;<br>
> ralloc_steal(load_instr, load_instr->variables[0]);<br>
> - add_instr(&load_instr->instr, ir->type->vector_elements);<br>
> - load_instr->dest.ssa.bit_size = glsl_get_bit_size(ir->type->base_type);<br>
> + unsigned bit_size = glsl_get_bit_size(ir->type->base_type);<br>
> + add_instr(&load_instr->instr, ir->type->vector_elements, bit_size);<br>
> }<br>
><br>
> return this->result;<br>
> @@ -1207,11 +1208,11 @@ nir_visitor::visit(ir_expression *ir)<br>
> case ir_binop_ubo_load: {<br>
> nir_intrinsic_instr *load =<br>
> nir_intrinsic_instr_create(this->shader, nir_intrinsic_load_ubo);<br>
> + unsigned bit_size = glsl_get_bit_size(ir->type->base_type);<br>
> load->num_components = ir->type->vector_elements;<br>
> - load->dest.ssa.bit_size = glsl_get_bit_size(ir->type->base_type);<br>
> load->src[0] = nir_src_for_ssa(evaluate_rvalue(ir->operands[0]));<br>
> load->src[1] = nir_src_for_ssa(evaluate_rvalue(ir->operands[1]));<br>
> - add_instr(&load->instr, ir->type->vector_elements);<br>
> + add_instr(&load->instr, ir->type->vector_elements, bit_size);<br>
><br>
> /*<br>
> * In UBO's, a true boolean value is any non-zero value, but we consider<br>
> @@ -1276,7 +1277,8 @@ nir_visitor::visit(ir_expression *ir)<br>
> intrin->intrinsic == nir_intrinsic_interp_var_at_sample)<br>
> intrin->src[0] = nir_src_for_ssa(evaluate_rvalue(ir->operands[1]));<br>
><br>
> - add_instr(&intrin->instr, deref->type->vector_elements);<br>
> + unsigned bit_size = glsl_get_bit_size(deref->type->base_type);<br>
> + add_instr(&intrin->instr, deref->type->vector_elements, bit_size);<br>
><br>
> if (swizzle) {<br>
> unsigned swiz[4] = {<br>
> @@ -1476,7 +1478,8 @@ nir_visitor::visit(ir_expression *ir)<br>
> nir_intrinsic_get_buffer_size);<br>
> load->num_components = ir->type->vector_elements;<br>
> load->src[0] = nir_src_for_ssa(evaluate_rvalue(ir->operands[0]));<br>
> - add_instr(&load->instr, ir->type->vector_elements);<br>
> + unsigned bit_size = glsl_get_bit_size(ir->type->base_type);<br>
> + add_instr(&load->instr, ir->type->vector_elements, bit_size);<br>
> return;<br>
> }<br>
><br>
> @@ -1913,7 +1916,8 @@ nir_visitor::visit(ir_texture *ir)<br>
><br>
> assert(src_number == num_srcs);<br>
><br>
> - add_instr(&instr->instr, nir_tex_instr_dest_size(instr));<br>
> + unsigned bit_size = glsl_get_bit_size(ir->type->base_type);<br>
> + add_instr(&instr->instr, nir_tex_instr_dest_size(instr), bit_size);<br>
> }<br>
><br>
> void<br>
><br>
</blockquote></div>