<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Jan 20, 2017 at 4:46 PM, Ian Romanick <span dir="ltr"><<a href="mailto:idr@freedesktop.org" target="_blank">idr@freedesktop.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 12/23/2016 06:46 AM, Jason Ekstrand wrote:<br>
> Bah... It's definitely illegal. I had fix glslang myself. I have some<br>
> NIR reworks planned that would make this work "properly" but it's a bit<br>
> more complicated than this hack. That said, I'm very reluctant to fix<br>
> app bugs in our driver. There are a lot of ways apps can go wrong with<br>
> Vulkan and we don't want to start down the road of hacking around them.<br>
<br>
</span>Is this something the SPIR-V validator would flag?<span class=""><br></span></blockquote><div><br></div><div>Ideally, yes. Unfortunately, I'm not sure how much SPIR-V validation actually gets done. Also, it's kind-of a weird corner of the spec that's not as clear-cut as one would like it to be. I interpreted it as "No, you can't store a sampler in a variable. That's silly" and fixed glslang. I believe I did try to get the spec fixed and it didn't really go anywhere.<br><br></div><div>--Jason<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
> On Dec 22, 2016 22:57, "Dave Airlie" <<a href="mailto:airlied@gmail.com">airlied@gmail.com</a><br>
</span>> <mailto:<a href="mailto:airlied@gmail.com">airlied@gmail.com</a>>> wrote:<br>
><br>
> From: Dave Airlie <<a href="mailto:airlied@redhat.com">airlied@redhat.com</a> <mailto:<a href="mailto:airlied@redhat.com">airlied@redhat.com</a>>><br>
<span class="">><br>
> Doom appears to generate SPIR-V that loads/store samplers before<br>
> passing them to functions, this confuses NIR, but I'm not sure<br>
> it's illegal.<br>
><br>
> Workaround this by replacing the value on store with the access<br>
> chain from the src.<br>
><br>
> This gets doom a bit further.<br>
><br>
> Signed-off-by: Dave Airlie <<a href="mailto:airlied@redhat.com">airlied@redhat.com</a><br>
</span>> <mailto:<a href="mailto:airlied@redhat.com">airlied@redhat.com</a>>><br>
<div><div class="h5">> ---<br>
> src/compiler/spirv/vtn_<wbr>variables.c | 8 ++++++++<br>
> 1 file changed, 8 insertions(+)<br>
><br>
> diff --git a/src/compiler/spirv/vtn_<wbr>variables.c<br>
> b/src/compiler/spirv/vtn_<wbr>variables.c<br>
> index be64dd9..f6672c0 100644<br>
> --- a/src/compiler/spirv/vtn_<wbr>variables.c<br>
> +++ b/src/compiler/spirv/vtn_<wbr>variables.c<br>
> @@ -1437,6 +1437,14 @@ vtn_handle_variables(struct vtn_builder *b,<br>
> SpvOp opcode,<br>
> case SpvOpStore: {<br>
> struct vtn_access_chain *dest =<br>
> vtn_value(b, w[1], vtn_value_type_access_chain)-><wbr>access_chain;<br>
> +<br>
> + if (glsl_get_base_type(dest->var-<wbr>>type->type) ==<br>
> GLSL_TYPE_SAMPLER) {<br>
> + struct vtn_value *val = vtn_untyped_value(b, w[2]);<br>
> + dest->var = val->access_chain->var;<br>
> + b->values[w[1]].value_type = vtn_value_type_invalid;<br>
> + vtn_push_value(b, w[1],<br>
> vtn_value_type_access_chain)-><wbr>access_chain = val->access_chain;<br>
> + return;<br>
> + }<br>
> struct vtn_ssa_value *src = vtn_ssa_value(b, w[2]);<br>
> vtn_variable_store(b, src, dest);<br>
> break;<br>
> --<br>
> 2.7.4<br>
><br>
> ______________________________<wbr>_________________<br>
> mesa-dev mailing list<br>
</div></div>> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a> <mailto:<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.<wbr>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>
> <<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.<wbr>org/mailman/listinfo/mesa-dev</a>><br>
<div class="HOEnZb"><div class="h5">><br>
><br>
><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>
><br>
<br>
</div></div></blockquote></div><br></div></div>