[Mesa-dev] [PATCH] compiler/spirv: set is_shadow for depth comparitor sampling opcodes
Iago Toral Quiroga
itoral at igalia.com
Mon Apr 2 11:04:24 UTC 2018
>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.)"
OpImageSample{Proj}Dref{Explicit,Implicit}Lod sampling opcodes always do
a depth comparison, regardless of the Depth property of the image type,
and as stated in the spec quote, this should be honored. For us, it means
that we always have to handle them as shadow sampling opcodes.
Fixes crashes in:
dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.*
---
src/compiler/spirv/spirv_to_nir.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 72ab426e80..f968c4d387 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -1908,7 +1908,22 @@ 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);
+
+ bool is_shadow;
+ switch (opcode) {
+ /* These opcodes are always depth-comparitors regardless of the depth
+ * property of the image
+ */
+ case SpvOpImageSampleDrefImplicitLod:
+ case SpvOpImageSampleProjDrefImplicitLod:
+ case SpvOpImageSampleDrefExplicitLod:
+ case SpvOpImageSampleProjDrefExplicitLod:
+ is_shadow = true;
+ break;
+ default:
+ is_shadow = glsl_sampler_type_is_shadow(image_type);
+ break;
+ }
/* Figure out the base texture operation */
nir_texop texop;
--
2.14.1
More information about the mesa-dev
mailing list