From: Oscar Blumberg Date: Mon, 11 Feb 2019 16:46:20 +0000 (+0100) Subject: glsl: Fix function return typechecking X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=da9c0307637b630a8178a8169ee5ede108a77a81;p=mesa.git glsl: Fix function return typechecking apply_implicit_conversion only converts and check base types but we need actual type equality for function returns, otherwise you can return a vec2 from a function declared as returning a float. Reviewed-by: Tapani Pälli --- diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index f68ed46435b..92a9650cc05 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -6249,7 +6249,8 @@ ast_jump_statement::hir(exec_list *instructions, if (state->has_420pack()) { if (!apply_implicit_conversion(state->current_function->return_type, - ret, state)) { + ret, state) + || (ret->type != state->current_function->return_type)) { _mesa_glsl_error(& loc, state, "could not implicitly convert return value " "to %s, in function `%s'",