[Mesa-dev] [PATCH 2/2] compiler/spirv: set is_image_sample_dref when required

Iago Toral Quiroga itoral at igalia.com
Wed Mar 28 09:33:15 UTC 2018


Fixes crashes in:
dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.*
---
 src/compiler/spirv/spirv_to_nir.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 7888e1b746..719e74c386 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -2029,12 +2029,15 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
       break;
    }
 
+   bool is_image_sample_dref = false;
    unsigned gather_component = 0;
    switch (opcode) {
    case SpvOpImageSampleDrefImplicitLod:
    case SpvOpImageSampleDrefExplicitLod:
    case SpvOpImageSampleProjDrefImplicitLod:
    case SpvOpImageSampleProjDrefExplicitLod:
+      is_image_sample_dref = true;
+      /* Fallthrough */
    case SpvOpImageDrefGather:
       /* These all have an explicit depth value as their next source */
       (*p++) = vtn_tex_src(b, w[idx++], nir_tex_src_comparator);
@@ -2107,6 +2110,7 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
    instr->is_shadow = is_shadow;
    instr->is_new_style_shadow =
       is_shadow && glsl_get_components(ret_type->type) == 1;
+   instr->is_image_sample_dref = is_image_sample_dref;
    instr->component = gather_component;
 
    switch (glsl_get_sampler_result_type(image_type)) {
-- 
2.14.1



More information about the mesa-dev mailing list