<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Dec 16, 2016 at 6:48 AM, Juan A. Suarez Romero <span dir="ltr"><<a href="mailto:jasuarez@igalia.com" target="_blank">jasuarez@igalia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Samuel Iglesias Gonsálvez <<a href="mailto:siglesias@igalia.com">siglesias@igalia.com</a>><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 | 19 +++++++++++++++++++<br>
1 file changed, 19 insertions(+)<br>
<br>
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h<br>
index 544d4ba..9310dab 100644<br>
--- a/src/compiler/nir/nir.h<br>
+++ b/src/compiler/nir/nir.h<br>
@@ -670,6 +670,25 @@ 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>
+ unsigned bit_size = glsl_get_bit_size(type);<br>
+ if (glsl_type_is_boolean(type))<br>
+ return (nir_alu_type)(nir_type_bool | bit_size);<br>
+<br>
+ if (glsl_type_is_integer(type)) {<br>
+ if (glsl_get_base_type(type) == GLSL_TYPE_UINT)<br>
+ return (nir_alu_type)(nir_type_uint | bit_size);<br>
+ else<br>
+ return (nir_alu_type)(nir_type_int | bit_size);<br>
+ }<br>
+<br>
+ if (glsl_type_is_float(type))<br>
+ return (nir_alu_type)(nir_type_float | bit_size);<br>
+ unreachable("unknown type");<br></blockquote><div><br></div><div>Wouldn't this be easier to implement as<br><br></div><div>switch (glsl_get_base_type(type)) {<br></div><div>case GLSL_TYPE_BOOL:<br></div><div> return nir_type_bool32;<br></div><div>case GLSL_TYPE_UINT:<br><br></div><div>}<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+}<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.9.3<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>