<div dir="ltr"><div><div><div>Thanks!<br><br></div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>><br><br></div>Please cc stable for both patches.<br></div>--Jason<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 26, 2017 at 9:08 AM, Lionel Landwerlin <span dir="ltr"><<a href="mailto:lionel.g.landwerlin@intel.com" target="_blank">lionel.g.landwerlin@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Looking at the following bit of SPIRV shader :<br>
<br>
...<br>
%zero = OpConstant %i32 0<br>
%ivec3_0 = OpConstantComposite %ivec3 %zero %zero %zero<br>
%vec3_undef = OpUndef %ivec3<br>
%sc_0 = OpSpecConstant %i32 0<br>
%sc_1 = OpSpecConstant %i32 0<br>
%sc_2 = OpSpecConstant %i32 0<br>
...<br>
<br>
Our compiler currently stops parsing variables & types on the OpUndef<br>
and switches to instructions, leaving the following sc_[0-2] variables<br>
untreated.<br>
<br>
Signed-off-by: Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com">lionel.g.landwerlin@intel.com</a><wbr>><br>
---<br>
src/compiler/spirv/spirv_to_<wbr>nir.c | 1 +<br>
src/compiler/spirv/vtn_<wbr>variables.c | 6 ++++++<br>
2 files changed, 7 insertions(+)<br>
<br>
diff --git a/src/compiler/spirv/spirv_to_<wbr>nir.c b/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
index 261be65e9f..2d773b4373 100644<br>
--- a/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
+++ b/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
@@ -2923,6 +2923,7 @@ vtn_handle_variable_or_type_<wbr>instruction(struct vtn_builder *b, SpvOp opcode,<br>
vtn_handle_constant(b, opcode, w, count);<br>
break;<br>
<br>
+ case SpvOpUndef:<br>
case SpvOpVariable:<br>
vtn_handle_variables(b, opcode, w, count);<br>
break;<br>
diff --git a/src/compiler/spirv/vtn_<wbr>variables.c b/src/compiler/spirv/vtn_<wbr>variables.c<br>
index b6c36f3d6a..098cfb5de7 100644<br>
--- a/src/compiler/spirv/vtn_<wbr>variables.c<br>
+++ b/src/compiler/spirv/vtn_<wbr>variables.c<br>
@@ -1287,6 +1287,12 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,<br>
const uint32_t *w, unsigned count)<br>
{<br>
switch (opcode) {<br>
+ case SpvOpUndef: {<br>
+ struct vtn_value *val = vtn_push_value(b, w[2], vtn_value_type_undef);<br>
+ val->type = vtn_value(b, w[1], vtn_value_type_type)->type;<br>
+ break;<br>
+ }<br>
+<br>
case SpvOpVariable: {<br>
struct vtn_variable *var = rzalloc(b, struct vtn_variable);<br>
var->type = vtn_value(b, w[1], vtn_value_type_type)->type;<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>