On Fri, Oct 6, 2017 at 2:36 AM, Samuel Iglesias Gonsálvez < [email protected]> wrote:
> These arguments are actually variables, not pointers. This is allowed > by SPIR-V spec but the support was missing. > In SPIR-V, even OpVariable returns a pointer. I think you could probably save yourself a lot of trouble if you used vtn_pointer_for_variable. So far as I can tell, that should make most of patches 3 and 4 unneeded. That said, I don't really get what's going on here. Could you provide a test case or even some example SPIR-V? --Jason > Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> > --- > 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 > [email protected] > https://lists.freedesktop.org/mailman/listinfo/mesa-dev >
_______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
