spirv: get the correct type for function returns.
authorDave Airlie <airlied@redhat.com>
Tue, 19 Nov 2019 22:33:10 +0000 (08:33 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 21 Nov 2019 18:37:25 +0000 (04:37 +1000)
This needs to be derived from the address format, not always 1/32.

Suggested by Jason

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/spirv/vtn_cfg.c

index cf67893c6c86c65268a43afa951a80bc89ea4ae6..67c3245126dad94e6b2c9b9f5e6d4033b06f03ff 100644 (file)
@@ -274,9 +274,12 @@ vtn_cfg_handle_prepass_instruction(struct vtn_builder *b, SpvOp opcode,
 
       unsigned idx = 0;
       if (func_type->return_type->base_type != vtn_base_type_void) {
+         nir_address_format addr_format =
+            vtn_mode_to_address_format(b, vtn_variable_mode_function);
          /* The return value is a regular pointer */
          func->params[idx++] = (nir_parameter) {
-            .num_components = 1, .bit_size = 32,
+            .num_components = nir_address_format_num_components(addr_format),
+            .bit_size = nir_address_format_bit_size(addr_format),
          };
       }