spirv/nir: Add support for shadow samplers that return vec4
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 21 Jul 2016 02:55:51 +0000 (19:55 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 22 Jul 2016 23:27:35 +0000 (16:27 -0700)
While SPIR-V technically doesn't support "old style" shadow, the
shadow-compare gather instruction does return a vec4 so we need to be able
to set the old_style_shadow bit in NIR.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "12.0" <mesa-dev@lists.freedesktop.org>
src/compiler/spirv/spirv_to_nir.c

index 22cd2e73912b8250390680f253ad0a069095b6f8..c32dfaa76bad017b7244598e8c4482f16d1d3b06 100644 (file)
@@ -1479,7 +1479,8 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
    instr->sampler_dim = glsl_get_sampler_dim(image_type);
    instr->is_array = glsl_sampler_type_is_array(image_type);
    instr->is_shadow = glsl_sampler_type_is_shadow(image_type);
-   instr->is_new_style_shadow = instr->is_shadow;
+   instr->is_new_style_shadow = instr->is_shadow &&
+                                glsl_get_components(ret_type->type) == 1;
 
    if (has_coord) {
       switch (instr->sampler_dim) {