glsl: inline functions with unsupported return type before converting to nir
authorDanylo Piliaiev <danylo.piliaiev@globallogic.com>
Fri, 29 May 2020 10:51:32 +0000 (13:51 +0300)
committerMarge Bot <eric+marge@anholt.net>
Mon, 8 Jun 2020 15:01:50 +0000 (15:01 +0000)
glsl_to_nir doesn't expect non-vector/scalar return types in functions.

Fixes: 7e60d5a501f311fa5e7bca5335adc6013dc1aeb9
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3058
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3060
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Tested-by: Witold Baryluk <witold.baryluk@gmail.com>
Reviewed-by: Witold Baryluk <witold.baryluk@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5333>

src/compiler/glsl/glsl_to_nir.cpp

index a6b9f44277f88e3e86ef69cb8cd046623652c2b7..a67e11be2cb4dd057a45068e060fbf2fd07d6e86 100644 (file)
@@ -165,6 +165,12 @@ public:
          }
       }
 
+      if (!glsl_type_is_vector_or_scalar(ir->return_type) &&
+          !ir->return_type->is_void()) {
+         unsupported = true;
+         return visit_stop;
+      }
+
       return visit_continue;
    }