These arguments are actually variables, not pointers. This is allowed by SPIR-V spec but the support was missing.
Signed-off-by: Samuel Iglesias Gonsálvez <sigles...@igalia.com> --- src/compiler/spirv/vtn_cfg.c | 13 +++++++++++++ src/compiler/spirv/vtn_private.h | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c index 25ff254bcec..15d8bb426a1 100644 --- a/src/compiler/spirv/vtn_cfg.c +++ b/src/compiler/spirv/vtn_cfg.c @@ -111,6 +111,19 @@ vtn_cfg_handle_prepass_instruction(struct vtn_builder *b, SpvOp opcode, param->name = ralloc_strdup(param, val->name); val->pointer = vtn_pointer_for_variable(b, vtn_var, type); + } else if (type->base_type == vtn_base_type_image || type->base_type == vtn_base_type_sampler) { + struct vtn_variable *vtn_var = rzalloc(b, struct vtn_variable); + vtn_var->type = type; + vtn_var->var = param; + vtn_var->mode = (type->base_type == vtn_base_type_image) ? + vtn_variable_mode_image : vtn_variable_mode_sampler; + struct vtn_value *val = + vtn_push_value(b, w[2], + (type->base_type == vtn_base_type_image) ? + vtn_value_type_image_variable : vtn_value_type_sampler_variable); + val->var = vtn_var; + /* Name the parameter so it shows up nicely in NIR */ + param->name = ralloc_strdup(param, val->name); } else { /* We're a regular SSA value. */ struct vtn_ssa_value *param_ssa = diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h index 84584620fc1..f194a7ed32a 100644 --- a/src/compiler/spirv/vtn_private.h +++ b/src/compiler/spirv/vtn_private.h @@ -51,6 +51,8 @@ enum vtn_value_type { vtn_value_type_extension, vtn_value_type_image_pointer, vtn_value_type_sampled_image, + vtn_value_type_image_variable, + vtn_value_type_sampler_variable, }; enum vtn_branch_type { @@ -413,6 +415,8 @@ struct vtn_image_pointer { struct vtn_sampled_image { struct vtn_pointer *image; /* Image or array of images */ struct vtn_pointer *sampler; /* Sampler */ + struct vtn_variable *var_image; /* Image or array of images variable */ + struct vtn_variable *var_sampler; /* Sampler variable */ }; struct vtn_value { @@ -427,6 +431,7 @@ struct vtn_value { nir_constant *constant; const struct glsl_type *const_type; }; + struct vtn_variable *var; struct vtn_pointer *pointer; struct vtn_image_pointer *image; struct vtn_sampled_image *sampled_image; -- 2.13.6 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev