[Mesa-dev] [PATCH v2] compiler/spirv: set is_shadow for depth comparitor sampling opcodes

Jason Ekstrand jason at jlekstrand.net
Tue Apr 3 16:32:08 UTC 2018


Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Cc: mesa-stable at lists.freedesktop.org

On Tue, Apr 3, 2018 at 2:24 AM, Iago Toral Quiroga <itoral at igalia.com>
wrote:

> From the SPIR-V spec, OpTypeImage:
>
> "Depth is whether or not this image is a depth image. (Note that
>  whether or not depth comparisons are actually done is a property of
>  the sampling opcode, not of this type declaration.)"
>
> The sampling opcodes that specify depth comparisons are
> OpImageSample{Proj}Dref{Explicit,Implicit}Lod, so we should set
> is_shadow only for these (we were using the deph property of the
> image until now).
>
> v2:
>  - Do the same for OpImageDrefGather.
>  - Set is_shadow to false if the sampling opcode is not one of these
> (Jason)
>  - Reuse an existing switch statement instead of adding a new one (Jason)
>
> Fixes crashes in:
> dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.*
> ---
>  src/compiler/spirv/spirv_to_nir.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/compiler/spirv/spirv_to_nir.c
> b/src/compiler/spirv/spirv_to_nir.c
> index 72ab426e80..c81a36fd82 100644
> --- a/src/compiler/spirv/spirv_to_nir.c
> +++ b/src/compiler/spirv/spirv_to_nir.c
> @@ -1908,7 +1908,6 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp
> opcode,
>     const struct glsl_type *image_type = sampled.type->type;
>     const enum glsl_sampler_dim sampler_dim = glsl_get_sampler_dim(image_
> type);
>     const bool is_array = glsl_sampler_type_is_array(image_type);
> -   const bool is_shadow = glsl_sampler_type_is_shadow(image_type);
>
>     /* Figure out the base texture operation */
>     nir_texop texop;
> @@ -2032,6 +2031,7 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp
> opcode,
>        break;
>     }
>
> +   bool is_shadow = false;
>     unsigned gather_component = 0;
>     switch (opcode) {
>     case SpvOpImageSampleDrefImplicitLod:
> @@ -2040,6 +2040,7 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp
> opcode,
>     case SpvOpImageSampleProjDrefExplicitLod:
>     case SpvOpImageDrefGather:
>        /* These all have an explicit depth value as their next source */
> +      is_shadow = true;
>        (*p++) = vtn_tex_src(b, w[idx++], nir_tex_src_comparator);
>        break;
>
> --
> 2.14.1
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180403/063049f0/attachment.html>


More information about the mesa-dev mailing list