Mesa (master): glsl: subroutine signatures must match exactly

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon May 25 00:13:15 UTC 2020


Module: Mesa
Branch: master
Commit: c7943343a0fc2463987f667658a257b74cec1782
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c7943343a0fc2463987f667658a257b74cec1782

Author: Yevhenii Kolesnikov <yevhenii.kolesnikov at globallogic.com>
Date:   Wed May 20 19:16:28 2020 +0300

glsl: subroutine signatures must match exactly

>From GLSL 4.60.7 spec, section 6.1.2 "Subroutines":

It is a compile-time error if arguments and return type don’t match
between the function and each associated subroutine type.

Before, if subroutine type and implementation function were declared
with types, that could be implicitly converted, it led to a runtime crash.

Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov at globallogic.com>
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5125>

---

 src/compiler/glsl/ir_function.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/compiler/glsl/ir_function.cpp b/src/compiler/glsl/ir_function.cpp
index 97262f0f4b9..a38e5285292 100644
--- a/src/compiler/glsl/ir_function.cpp
+++ b/src/compiler/glsl/ir_function.cpp
@@ -329,6 +329,9 @@ ir_function::matching_signature(_mesa_glsl_parse_state *state,
          free(inexact_matches);
          return sig;
       case PARAMETER_LIST_INEXACT_MATCH:
+         /* Subroutine signatures must match exactly */
+         if (this->is_subroutine)
+            continue;
          inexact_matches_temp = (ir_function_signature **)
                realloc(inexact_matches,
                        sizeof(*inexact_matches) *



More information about the mesa-commit mailing list