<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Thu, Jul 12, 2018 at 4:30 AM Karol Herbst <<a href="mailto:kherbst@redhat.com">kherbst@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Signed-off-by: Karol Herbst <<a href="mailto:kherbst@redhat.com" target="_blank">kherbst@redhat.com</a>><br>
---<br>
src/compiler/spirv/vtn_cfg.c | 25 ++++++++++++++++++-------<br>
1 file changed, 18 insertions(+), 7 deletions(-)<br>
<br>
diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c<br>
index ed1ab5d1c2c..2b01ede6f81 100644<br>
--- a/src/compiler/spirv/vtn_cfg.c<br>
+++ b/src/compiler/spirv/vtn_cfg.c<br>
@@ -90,7 +90,10 @@ vtn_cfg_handle_prepass_instruction(struct vtn_builder *b, SpvOp opcode,<br>
}<br>
<br>
for (unsigned i = 0; i < func_type->length; i++) {<br>
- if (func_type->params[i]->base_type == vtn_base_type_sampled_image) {<br>
+ enum vtn_base_type base_type = func_type->params[i]->base_type;<br>
+ const struct glsl_type *type = func_type->params[i]->type;<br>
+<br>
+ if (base_type == vtn_base_type_sampled_image) {<br>
/* Sampled images are two pointer parameters */<br>
func->params[idx++] = (nir_parameter) {<br>
.num_components = 1, .bit_size = 32,<br>
@@ -98,14 +101,22 @@ vtn_cfg_handle_prepass_instruction(struct vtn_builder *b, SpvOp opcode,<br>
func->params[idx++] = (nir_parameter) {<br>
.num_components = 1, .bit_size = 32,<br>
};<br>
- } else if (func_type->params[i]->base_type == vtn_base_type_pointer &&<br>
- func_type->params[i]->type != NULL) {<br>
+ } else if (base_type == vtn_base_type_pointer && type != NULL) {<br>
/* Pointers with as storage class get passed by-value */<br>
- assert(glsl_type_is_vector_or_scalar(func_type->params[i]->type));<br>
+ assert(glsl_type_is_vector_or_scalar(type));<br>
+ func->params[idx++] = (nir_parameter) {<br>
+ .num_components = glsl_get_vector_elements(type),<br>
+ .bit_size = glsl_get_bit_size(type),<br>
+ };<br>
+ } else if (base_type == vtn_base_type_scalar) {<br>
+ func->params[idx++] = (nir_parameter) {<br>
+ .num_components = 1,<br>
+ .bit_size = glsl_get_bit_size(type),<br>
+ };<br>
+ } else if (base_type == vtn_base_type_vector) {<br>
func->params[idx++] = (nir_parameter) {<br>
- .num_components =<br>
- glsl_get_vector_elements(func_type->params[i]->type),<br>
- .bit_size = glsl_get_bit_size(func_type->params[i]->type),<br>
+ .num_components = glsl_get_components(type),<br>
+ .bit_size = glsl_get_bit_size(type),<br></blockquote><div><br></div><div>This will also handle the scalar case; you don't need to separate them.</div><div><br></div><div>This change alters the pre-pass part where we build up the function prototype. However, it doesn't change any code in vtn_cfg. Are you sure it works? I strongly suspect it'll just blow up (or miscompile) further down the line.</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">
};<br>
} else {<br>
/* Everything else is a regular pointer */<br>
-- <br>
2.17.1<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">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/mailman/listinfo/mesa-dev</a><br>
</blockquote></div></div>