diff options
author | Oscar Blumberg <[email protected]> | 2019-02-11 17:46:20 +0100 |
---|---|---|
committer | Tapani Pälli <[email protected]> | 2019-02-25 08:49:06 +0200 |
commit | da9c0307637b630a8178a8169ee5ede108a77a81 (patch) | |
tree | 5829ef4356403ccff76e98094b40ed80e4127be0 /src | |
parent | bd0ad651e0e99898ef46cb9b73e37de9f6904cb4 (diff) |
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 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/glsl/ast_to_hir.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
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'", |