diff options
author | marha <marha@users.sourceforge.net> | 2013-06-18 08:23:14 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-06-18 08:23:14 +0200 |
commit | b071050b9eda9d5e5185e582dbe9f4adba863ccc (patch) | |
tree | 6da290f7da04f9afc96691608b65967f2ee0e0fa /mesalib/src/glsl/ast_to_hir.cpp | |
parent | 150771e7aabf4c864b0b970c5b8d773634793abe (diff) | |
download | vcxsrv-b071050b9eda9d5e5185e582dbe9f4adba863ccc.tar.gz vcxsrv-b071050b9eda9d5e5185e582dbe9f4adba863ccc.tar.bz2 vcxsrv-b071050b9eda9d5e5185e582dbe9f4adba863ccc.zip |
libX11 libXmu libxcb/xcb-proto mesa mkfontscale pixman xkeyboard-config git update 18 June 2013
libxcb/xcb-proto commit e5f7c750815cb5170db363a2e5b09639b7354733
xkeyboard-config commit 30d804538462213ed01e8efc0b44a8e5a0aff990
libX11 commit 9dfb0f3c0a761590bcdc1f3396b1e064da4e18e8
pixman commit 279bdcda7ec3af8ac06312f4514b1b082a279544
mkfontscale commit f731c5c36f28ddd0f25f474d2991c96f9a7a915c
libXmu commit e46ecb4e02b7f919b11efa79448d4db71d1deb69
mesa commit eb2021507556633cd6ba64cda26653e3c43e80df
Diffstat (limited to 'mesalib/src/glsl/ast_to_hir.cpp')
-rw-r--r-- | mesalib/src/glsl/ast_to_hir.cpp | 49 |
1 files changed, 39 insertions, 10 deletions
diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp index e918adeef..4b5f04980 100644 --- a/mesalib/src/glsl/ast_to_hir.cpp +++ b/mesalib/src/glsl/ast_to_hir.cpp @@ -3358,7 +3358,7 @@ ast_jump_statement::hir(exec_list *instructions, assert(state->current_function); if (opt_return_value) { - ir_rvalue *const ret = opt_return_value->hir(instructions, state); + ir_rvalue *ret = opt_return_value->hir(instructions, state); /* The value of the return type can be NULL if the shader says * 'return foo();' and foo() is a function that returns void. @@ -3370,17 +3370,46 @@ ast_jump_statement::hir(exec_list *instructions, const glsl_type *const ret_type = (ret == NULL) ? glsl_type::void_type : ret->type; - /* Implicit conversions are not allowed for return values. */ - if (state->current_function->return_type != ret_type) { + /* Implicit conversions are not allowed for return values prior to + * ARB_shading_language_420pack. + */ + if (state->current_function->return_type != ret_type) { YYLTYPE loc = this->get_location(); - _mesa_glsl_error(& loc, state, - "`return' with wrong type %s, in function `%s' " - "returning %s", - ret_type->name, - state->current_function->function_name(), - state->current_function->return_type->name); - } + if (state->ARB_shading_language_420pack_enable) { + if (!apply_implicit_conversion(state->current_function->return_type, + ret, state)) { + _mesa_glsl_error(& loc, state, + "Could not implicitly convert return value " + "to %s, in function `%s'", + state->current_function->return_type->name, + state->current_function->function_name()); + } + } else { + _mesa_glsl_error(& loc, state, + "`return' with wrong type %s, in function `%s' " + "returning %s", + ret_type->name, + state->current_function->function_name(), + state->current_function->return_type->name); + } + } else if (state->current_function->return_type->base_type == + GLSL_TYPE_VOID) { + YYLTYPE loc = this->get_location(); + + /* The ARB_shading_language_420pack, GLSL ES 3.0, and GLSL 4.20 + * specs add a clarification: + * + * "A void function can only use return without a return argument, even if + * the return argument has void type. Return statements only accept values: + * + * void func1() { } + * void func2() { return func1(); } // illegal return statement" + */ + _mesa_glsl_error(& loc, state, + "void functions can only use `return' without a " + "return argument"); + } inst = new(ctx) ir_return(ret); } else { |