[Mesa-dev] [PATCH] spirv: acknowledge multisampled input attachments

Iago Toral Quiroga itoral at igalia.com
Tue Jan 24 10:00:16 UTC 2017


This avoids tons of crashes in
dEQP-VK.pipeline.multisample_shader_builtin.sample_id.*
dEQP-VK.pipeline.multisample_shader_builtin.sample_mask.*
dEQP-VK.pipeline.multisample_shader_builtin.sample_position.*

---

With this patch some of the tests pass, some still fail and some
(from the sample_mask.write category) still crash for other reasons.

 src/compiler/spirv/spirv_to_nir.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 28ab5f1..aecda17 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -854,8 +854,12 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
          val->type->access_qualifier = SpvAccessQualifierReadWrite;
 
       if (multisampled) {
-         assert(dim == GLSL_SAMPLER_DIM_2D);
-         dim = GLSL_SAMPLER_DIM_MS;
+         if (dim == GLSL_SAMPLER_DIM_2D)
+            dim = GLSL_SAMPLER_DIM_MS;
+         else if (dim == GLSL_SAMPLER_DIM_SUBPASS)
+            dim = GLSL_SAMPLER_DIM_SUBPASS_MS;
+         else
+            assert(!"Unsupported multisampled image type");
       }
 
       val->type->image_format = translate_image_format(format);
@@ -864,7 +868,8 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
          val->type->type = glsl_sampler_type(dim, is_shadow, is_array,
                                              glsl_get_base_type(sampled_type));
       } else if (sampled == 2) {
-         assert((dim == GLSL_SAMPLER_DIM_SUBPASS) || format);
+         assert((dim == GLSL_SAMPLER_DIM_SUBPASS ||
+                 dim == GLSL_SAMPLER_DIM_SUBPASS_MS) || format);
          assert(!is_shadow);
          val->type->type = glsl_image_type(dim, is_array,
                                            glsl_get_base_type(sampled_type));
-- 
2.7.4



More information about the mesa-dev mailing list