<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 31, 2016 at 2:59 AM, Samuel Iglesias Gonsálvez <span dir="ltr"><<a href="mailto:siglesias@igalia.com" target="_blank">siglesias@igalia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Signed-off-by: Samuel Iglesias Gonsálvez <<a href="mailto:siglesias@igalia.com">siglesias@igalia.com</a>><br>
---<br>
 src/compiler/nir/glsl_to_nir.cpp         | 2 +-<br>
 src/compiler/nir/nir.c                   | 6 ++++--<br>
 src/compiler/nir/nir.h                   | 3 ++-<br>
 src/compiler/nir/nir_builder.h           | 2 +-<br>
 src/compiler/nir/nir_clone.c             | 3 ++-<br>
 src/compiler/nir/nir_control_flow.c      | 5 +++--<br>
 src/compiler/nir/nir_lower_vars_to_ssa.c | 3 ++-<br>
 src/compiler/nir/nir_phi_builder.c       | 3 ++-<br>
 src/compiler/nir/nir_to_ssa.c            | 2 +-<br>
 9 files changed, 18 insertions(+), 11 deletions(-)<br>
<br>
diff --git a/src/compiler/nir/glsl_to_nir.cpp b/src/compiler/nir/glsl_to_nir.cpp<br>
index 1fac481..c35ec7e 100644<br>
--- a/src/compiler/nir/glsl_to_nir.cpp<br>
+++ b/src/compiler/nir/glsl_to_nir.cpp<br>
@@ -735,7 +735,7 @@ nir_visitor::visit(ir_call *ir)<br>
       case nir_intrinsic_image_samples:<br>
       case nir_intrinsic_image_size: {<br>
          nir_ssa_undef_instr *instr_undef =<br>
-            nir_ssa_undef_instr_create(shader, 1);<br>
+            nir_ssa_undef_instr_create(shader, 1, 32);<br>
          nir_builder_instr_insert(&b, &instr_undef->instr);<br>
<br>
          /* Set the image variable dereference. */<br>
diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c<br>
index b67916d..e45f727 100644<br>
--- a/src/compiler/nir/nir.c<br>
+++ b/src/compiler/nir/nir.c<br>
@@ -558,12 +558,14 @@ nir_parallel_copy_instr_create(nir_shader *shader)<br>
 }<br>
<br>
 nir_ssa_undef_instr *<br>
-nir_ssa_undef_instr_create(nir_shader *shader, unsigned num_components)<br>
+nir_ssa_undef_instr_create(nir_shader *shader,<br>
+                           unsigned num_components,<br>
+                           unsigned bit_size)<br>
 {<br>
    nir_ssa_undef_instr *instr = ralloc(shader, nir_ssa_undef_instr);<br>
    instr_init(&instr->instr, nir_instr_type_ssa_undef);<br>
<br>
-   nir_ssa_def_init(&instr->instr, &instr->def, num_components, 32, NULL);<br>
+   nir_ssa_def_init(&instr->instr, &instr->def, num_components, bit_size, NULL);<br>
<br>
    return instr;<br>
 }<br>
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h<br>
index c19ae59..3a4c771 100644<br>
--- a/src/compiler/nir/nir.h<br>
+++ b/src/compiler/nir/nir.h<br>
@@ -1845,7 +1845,8 @@ nir_phi_instr *nir_phi_instr_create(nir_shader *shader);<br>
 nir_parallel_copy_instr *nir_parallel_copy_instr_create(nir_shader *shader);<br>
<br>
 nir_ssa_undef_instr *nir_ssa_undef_instr_create(nir_shader *shader,<br>
-                                                unsigned num_components);<br>
+                                                unsigned num_components,<br>
+                                                unsigned bit_size);<br>
<br>
 nir_deref_var *nir_deref_var_create(void *mem_ctx, nir_variable *var);<br>
 nir_deref_array *nir_deref_array_create(void *mem_ctx);<br>
diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h<br>
index 3dc7c25..a894aba 100644<br>
--- a/src/compiler/nir/nir_builder.h<br>
+++ b/src/compiler/nir/nir_builder.h<br>
@@ -78,7 +78,7 @@ static inline nir_ssa_def *<br>
 nir_ssa_undef(nir_builder *build, unsigned num_components, unsigned bit_size)<br>
 {<br>
    nir_ssa_undef_instr *undef =<br>
-      nir_ssa_undef_instr_create(build->shader, num_components);<br>
+      nir_ssa_undef_instr_create(build->shader, num_components, bit_size);<br>
    undef->def.bit_size = bit_size;<br>
    if (!undef)<br>
       return NULL;<br>
diff --git a/src/compiler/nir/nir_clone.c b/src/compiler/nir/nir_clone.c<br>
index 7d2e383..a3d467d 100644<br>
--- a/src/compiler/nir/nir_clone.c<br>
+++ b/src/compiler/nir/nir_clone.c<br>
@@ -372,7 +372,8 @@ static nir_ssa_undef_instr *<br>
 clone_ssa_undef(clone_state *state, const nir_ssa_undef_instr *sa)<br>
 {<br>
    nir_ssa_undef_instr *nsa =<br>
-      nir_ssa_undef_instr_create(state->ns, sa->def.num_components);<br>
+      nir_ssa_undef_instr_create(state->ns, sa->def.num_components,<br>
+                                 sa->def.bit_size);<br>
<br>
    add_remap(state, &nsa->def, &sa->def);<br>
<br>
diff --git a/src/compiler/nir/nir_control_flow.c b/src/compiler/nir/nir_control_flow.c<br>
index 33b06d0..6d9fa1b 100644<br>
--- a/src/compiler/nir/nir_control_flow.c<br>
+++ b/src/compiler/nir/nir_control_flow.c<br>
@@ -281,7 +281,8 @@ insert_phi_undef(nir_block *block, nir_block *pred)<br>
       nir_phi_instr *phi = nir_instr_as_phi(instr);<br>
       nir_ssa_undef_instr *undef =<br>
          nir_ssa_undef_instr_create(ralloc_parent(phi),<br>
-                                    phi->dest.ssa.num_components);<br>
+                                    phi->dest.ssa.num_components,<br>
+                                    32);<br></blockquote><div><br></div><div>Should be phi->dest.ssa.bit_size<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
       nir_instr_insert_before_cf_list(&impl->body, &undef->instr);<br>
       nir_phi_src *src = ralloc(phi, nir_phi_src);<br>
       src->pred = pred;<br>
@@ -691,7 +692,7 @@ replace_ssa_def_uses(nir_ssa_def *def, void *void_impl)<br>
    void *mem_ctx = ralloc_parent(impl);<br>
<br>
    nir_ssa_undef_instr *undef =<br>
-      nir_ssa_undef_instr_create(mem_ctx, def->num_components);<br>
+      nir_ssa_undef_instr_create(mem_ctx, def->num_components, 32);<br></blockquote><div><br></div><div>def->bit_size<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
    nir_instr_insert_before_cf_list(&impl->body, &undef->instr);<br>
    nir_ssa_def_rewrite_uses(def, nir_src_for_ssa(&undef->def));<br>
    return true;<br>
diff --git a/src/compiler/nir/nir_lower_vars_to_ssa.c b/src/compiler/nir/nir_lower_vars_to_ssa.c<br>
index 9f9e454..3bd8d6e 100644<br>
--- a/src/compiler/nir/nir_lower_vars_to_ssa.c<br>
+++ b/src/compiler/nir/nir_lower_vars_to_ssa.c<br>
@@ -504,7 +504,8 @@ rename_variables_block(nir_block *block, struct lower_variables_state *state)<br>
              */<br>
             nir_ssa_undef_instr *undef =<br>
                nir_ssa_undef_instr_create(state->shader,<br>
-                                          intrin->num_components);<br>
+                                          intrin->num_components,<br>
+                                          intrin->dest.ssa.bit_size);<br>
             undef->def.bit_size = intrin->dest.ssa.bit_size;<br>
<br>
             nir_instr_insert_before(&intrin->instr, &undef->instr);<br>
diff --git a/src/compiler/nir/nir_phi_builder.c b/src/compiler/nir/nir_phi_builder.c<br>
index a39e360..1f1388a 100644<br>
--- a/src/compiler/nir/nir_phi_builder.c<br>
+++ b/src/compiler/nir/nir_phi_builder.c<br>
@@ -195,7 +195,8 @@ nir_phi_builder_value_get_block_def(struct nir_phi_builder_value *val,<br>
           */<br>
          nir_ssa_undef_instr *undef =<br>
             nir_ssa_undef_instr_create(val->builder->shader,<br>
-                                       val->num_components);<br>
+                                       val->num_components,<br>
+                                       val->bit_size);<br>
          nir_instr_insert(nir_before_cf_list(&val->builder->impl->body),<br>
                           &undef->instr);<br>
          val->defs[block->index] = &undef->def;<br>
diff --git a/src/compiler/nir/nir_to_ssa.c b/src/compiler/nir/nir_to_ssa.c<br>
index d588d7d..04276cd 100644<br>
--- a/src/compiler/nir/nir_to_ssa.c<br>
+++ b/src/compiler/nir/nir_to_ssa.c<br>
@@ -160,7 +160,7 @@ static nir_ssa_def *get_ssa_src(nir_register *reg, rewrite_state *state)<br>
        * to preserve the information that this source is undefined<br>
        */<br>
       nir_ssa_undef_instr *instr =<br>
-         nir_ssa_undef_instr_create(state->mem_ctx, reg->num_components);<br>
+         nir_ssa_undef_instr_create(state->mem_ctx, reg->num_components, 32);<br></blockquote><div><br></div><div>reg->bit_size<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
       /*<br>
        * We could just insert the undefined instruction before the instruction<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.5.0<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>