From da9c0307637b630a8178a8169ee5ede108a77a81 Mon Sep 17 00:00:00 2001 From: Oscar Blumberg Date: Mon, 11 Feb 2019 17:46:20 +0100 Subject: [PATCH] glsl: Fix function return typechecking MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/compiler/glsl/ast_to_hir.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index f68ed46..92a9650 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'", -- 2.7.4