<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Oct 6, 2017 at 2:36 AM, Samuel Iglesias Gonsálvez <span dir="ltr"><<a href="mailto:siglesias@igalia.com" target="_blank">siglesias@igalia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">These arguments are actually variables, not pointers. This is allowed<br>
by SPIR-V spec but the support was missing.<br></blockquote><div><br></div><div>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.</div><div><br></div><div>That said, I don't really get what's going on here. Could you provide a test case or even some example SPIR-V?</div><div><br></div><div>--Jason<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Signed-off-by: Samuel Iglesias Gonsálvez <<a href="mailto:siglesias@igalia.com">siglesias@igalia.com</a>><br>
---<br>
src/compiler/spirv/vtn_cfg.c | 13 +++++++++++++<br>
src/compiler/spirv/vtn_<wbr>private.h | 5 +++++<br>
2 files changed, 18 insertions(+)<br>
<br>
diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c<br>
index 25ff254bcec..15d8bb426a1 100644<br>
--- a/src/compiler/spirv/vtn_cfg.c<br>
+++ b/src/compiler/spirv/vtn_cfg.c<br>
@@ -111,6 +111,19 @@ vtn_cfg_handle_prepass_<wbr>instruction(struct vtn_builder *b, SpvOp opcode,<br>
param->name = ralloc_strdup(param, val->name);<br>
<br>
val->pointer = vtn_pointer_for_variable(b, vtn_var, type);<br>
+ } else if (type->base_type == vtn_base_type_image || type->base_type == vtn_base_type_sampler) {<br>
+ struct vtn_variable *vtn_var = rzalloc(b, struct vtn_variable);<br>
+ vtn_var->type = type;<br>
+ vtn_var->var = param;<br>
+ vtn_var->mode = (type->base_type == vtn_base_type_image) ?<br>
+ vtn_variable_mode_image : vtn_variable_mode_sampler;<br>
+ struct vtn_value *val =<br>
+ vtn_push_value(b, w[2],<br>
+ (type->base_type == vtn_base_type_image) ?<br>
+ vtn_value_type_image_variable : vtn_value_type_sampler_<wbr>variable);<br>
+ val->var = vtn_var;<br>
+ /* Name the parameter so it shows up nicely in NIR */<br>
+ param->name = ralloc_strdup(param, val->name);<br>
} else {<br>
/* We're a regular SSA value. */<br>
struct vtn_ssa_value *param_ssa =<br>
diff --git a/src/compiler/spirv/vtn_<wbr>private.h b/src/compiler/spirv/vtn_<wbr>private.h<br>
index 84584620fc1..f194a7ed32a 100644<br>
--- a/src/compiler/spirv/vtn_<wbr>private.h<br>
+++ b/src/compiler/spirv/vtn_<wbr>private.h<br>
@@ -51,6 +51,8 @@ enum vtn_value_type {<br>
vtn_value_type_extension,<br>
vtn_value_type_image_pointer,<br>
vtn_value_type_sampled_image,<br>
+ vtn_value_type_image_variable,<br>
+ vtn_value_type_sampler_<wbr>variable,<br>
};<br>
<br>
enum vtn_branch_type {<br>
@@ -413,6 +415,8 @@ struct vtn_image_pointer {<br>
struct vtn_sampled_image {<br>
struct vtn_pointer *image; /* Image or array of images */<br>
struct vtn_pointer *sampler; /* Sampler */<br>
+ struct vtn_variable *var_image; /* Image or array of images variable */<br>
+ struct vtn_variable *var_sampler; /* Sampler variable */<br>
};<br>
<br>
struct vtn_value {<br>
@@ -427,6 +431,7 @@ struct vtn_value {<br>
nir_constant *constant;<br>
const struct glsl_type *const_type;<br>
};<br>
+ struct vtn_variable *var;<br>
struct vtn_pointer *pointer;<br>
struct vtn_image_pointer *image;<br>
struct vtn_sampled_image *sampled_image;<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.13.6<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>