Mesa (staging/20.0): spirv: Fix passing combined image/samplers through function calls

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Apr 27 18:08:04 UTC 2020


Module: Mesa
Branch: staging/20.0
Commit: 2b01692b9edf101439910d1eabe2dd59e6b1cce9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2b01692b9edf101439910d1eabe2dd59e6b1cce9

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Wed Apr 22 15:49:25 2020 -0500

spirv: Fix passing combined image/samplers through function calls

Fixes dEQP-VK.spirv_assembly.instruction.function_params.sampler_param

cc: mesa-stable at lists.freedesktop.org

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4684>
(cherry picked from commit bc5c43828970b49a9c6b2d08d9fb7f46a3300ae4)

---

 .pick_status.json            |  2 +-
 src/compiler/spirv/vtn_cfg.c | 10 +++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 450d3df5ef7..2db9c1ed217 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1201,7 +1201,7 @@
         "description": "spirv: Fix passing combined image/samplers through function calls",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c
index 25e2f285e79..1c52d1b9258 100644
--- a/src/compiler/spirv/vtn_cfg.c
+++ b/src/compiler/spirv/vtn_cfg.c
@@ -210,9 +210,9 @@ vtn_handle_function_call(struct vtn_builder *b, SpvOp opcode,
             vtn_value(b, arg_id, vtn_value_type_sampled_image)->sampled_image;
 
          call->params[param_idx++] =
-            nir_src_for_ssa(&sampled_image->image->deref->dest.ssa);
+            nir_src_for_ssa(vtn_pointer_to_ssa(b, sampled_image->image));
          call->params[param_idx++] =
-            nir_src_for_ssa(&sampled_image->sampler->deref->dest.ssa);
+            nir_src_for_ssa(vtn_pointer_to_ssa(b, sampled_image->sampler));
       } else if (arg_type->base_type == vtn_base_type_pointer ||
                  arg_type->base_type == vtn_base_type_image ||
                  arg_type->base_type == vtn_base_type_sampler) {
@@ -319,12 +319,16 @@ vtn_cfg_handle_prepass_instruction(struct vtn_builder *b, SpvOp opcode,
 
          val->sampled_image = ralloc(b, struct vtn_sampled_image);
 
+         struct vtn_type *image_type = rzalloc(b, struct vtn_type);
+         image_type->base_type = vtn_base_type_image;
+         image_type->type = type->type;
+
          struct vtn_type *sampler_type = rzalloc(b, struct vtn_type);
          sampler_type->base_type = vtn_base_type_sampler;
          sampler_type->type = glsl_bare_sampler_type();
 
          val->sampled_image->image =
-            vtn_load_param_pointer(b, type, b->func_param_idx++);
+            vtn_load_param_pointer(b, image_type, b->func_param_idx++);
          val->sampled_image->sampler =
             vtn_load_param_pointer(b, sampler_type, b->func_param_idx++);
       } else if (type->base_type == vtn_base_type_pointer &&



More information about the mesa-commit mailing list