<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jan 5, 2017 at 2:18 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">v2 (Jason):<br>
- Refactor nir_get_nir_type_for_glsl_<wbr>type() to avoid using unneeded helpers (Jason)<br>
<br>
Signed-off-by: Samuel Iglesias Gonsálvez <<a href="mailto:siglesias@igalia.com">siglesias@igalia.com</a>><br>
---<br>
src/compiler/nir/nir.h | 27 +++++++++++++++++++++++++++<br>
1 file changed, 27 insertions(+)<br>
<br>
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h<br>
index 0596d31b903..09326a25a54 100644<br>
--- a/src/compiler/nir/nir.h<br>
+++ b/src/compiler/nir/nir.h<br>
@@ -675,6 +675,33 @@ nir_alu_type_get_base_type(<wbr>nir_alu_type type)<br>
return type & NIR_ALU_TYPE_BASE_TYPE_MASK;<br>
}<br>
<br>
+static inline nir_alu_type<br>
+nir_get_nir_type_for_glsl_<wbr>type(const struct glsl_type *type)<br>
+{<br>
+ nir_alu_type ret = nir_type_invalid;<br>
+ switch (glsl_get_base_type(type)) {<br>
+ case GLSL_TYPE_BOOL:<br>
+ ret = nir_type_bool32;<br>
+ break;<br></blockquote><div><br></div><div>These could each just return the return value rather than setting it and returning at the bottom. It'd let you get rid of all of the breaks. In any case, it's correct so<br><br></div><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ case GLSL_TYPE_UINT:<br>
+ ret = nir_type_uint32;<br>
+ break;<br>
+ case GLSL_TYPE_INT:<br>
+ ret = nir_type_int32;<br>
+ break;<br>
+ case GLSL_TYPE_FLOAT:<br>
+ ret = nir_type_float32;<br>
+ break;<br>
+ case GLSL_TYPE_DOUBLE:<br>
+ ret = nir_type_float64;<br>
+ break;<br>
+ default:<br>
+ unreachable("unknown type");<br>
+ };<br>
+<br>
+ return ret;<br>
+}<br>
+<br>
typedef enum {<br>
NIR_OP_IS_COMMUTATIVE = (1 << 0),<br>
NIR_OP_IS_ASSOCIATIVE = (1 << 1),<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.11.0<br>
<br>
______________________________<wbr>_________________<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/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>