<div dir="ltr"><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div>Cc: <a href="mailto:mesa-stable@lists.freedesktop.org">mesa-stable@lists.freedesktop.org</a><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 3, 2018 at 2:24 AM, Iago Toral Quiroga <span dir="ltr"><<a href="mailto:itoral@igalia.com" target="_blank">itoral@igalia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">From the SPIR-V spec, OpTypeImage:<br>
<br>
"Depth is whether or not this image is a depth image. (Note that<br>
whether or not depth comparisons are actually done is a property of<br>
the sampling opcode, not of this type declaration.)"<br>
<br>
</span>The sampling opcodes that specify depth comparisons are<br>
OpImageSample{Proj}Dref{<wbr>Explicit,Implicit}Lod, so we should set<br>
is_shadow only for these (we were using the deph property of the<br>
image until now).<br>
<br>
v2:<br>
- Do the same for OpImageDrefGather.<br>
- Set is_shadow to false if the sampling opcode is not one of these (Jason)<br>
- Reuse an existing switch statement instead of adding a new one (Jason)<br>
<span class=""><br>
Fixes crashes in:<br>
dEQP-VK.spirv_assembly.<wbr>instruction.graphics.image_<wbr>sampler.depth_property.*<br>
---<br>
</span> src/compiler/spirv/spirv_to_<wbr>nir.c | 3 ++-<br>
1 file changed, 2 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/compiler/spirv/spirv_to_<wbr>nir.c b/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
index 72ab426e80..c81a36fd82 100644<br>
--- a/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
+++ b/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
@@ -1908,7 +1908,6 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,<br>
<span class=""> const struct glsl_type *image_type = sampled.type->type;<br>
const enum glsl_sampler_dim sampler_dim = glsl_get_sampler_dim(image_<wbr>type);<br>
const bool is_array = glsl_sampler_type_is_array(<wbr>image_type);<br>
- const bool is_shadow = glsl_sampler_type_is_shadow(<wbr>image_type);<br>
<br>
</span><span class=""> /* Figure out the base texture operation */<br>
nir_texop texop;<br>
</span>@@ -2032,6 +2031,7 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,<br>
break;<br>
}<br>
<br>
+ bool is_shadow = false;<br>
unsigned gather_component = 0;<br>
switch (opcode) {<br>
case SpvOpImageSampleDrefImplicitLo<wbr>d:<br>
@@ -2040,6 +2040,7 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,<br>
case SpvOpImageSampleProjDrefExplic<wbr>itLod:<br>
case SpvOpImageDrefGather:<br>
/* These all have an explicit depth value as their next source */<br>
+ is_shadow = true;<br>
(*p++) = vtn_tex_src(b, w[idx++], nir_tex_src_comparator);<br>
break;<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
2.14.1<br>
<br>
</font></span></blockquote></div><br></div>