summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2016-05-06 11:28:40 +1000
committerDave Airlie <[email protected]>2016-05-23 16:19:56 +1000
commitb572b599efb29f1d28ab0595b762e2d24012d9ed (patch)
tree6dba717e46c37b0cd368fbf2f3a44d5c2af55e10 /src
parentba3414d832c0661e6b827641dbd33a2829d1812e (diff)
glsl: validate subroutine types match function signature.
This fixes: GL43-CTS.shader_subroutine.subroutines_incompatible_with_subroutine_type It just makes sure the signatures match as well as the return types. Reviewed-by: Chris Forbes <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/glsl/ast_to_hir.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index a524fbdc56f..434734d09af 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -5522,6 +5522,24 @@ ast_function::hir(exec_list *instructions,
if (!type) {
_mesa_glsl_error(& loc, state, "unknown type '%s' in subroutine function definition", decl->identifier);
}
+
+ for (int i = 0; i < state->num_subroutine_types; i++) {
+ ir_function *fn = state->subroutine_types[i];
+ ir_function_signature *tsig = NULL;
+
+ if (strcmp(fn->name, decl->identifier))
+ continue;
+
+ tsig = fn->matching_signature(state, &sig->parameters,
+ false);
+ if (!tsig) {
+ _mesa_glsl_error(& loc, state, "subroutine type mismatch '%s' - signatures do not match\n", decl->identifier);
+ } else {
+ if (tsig->return_type != sig->return_type) {
+ _mesa_glsl_error(& loc, state, "subroutine type mismatch '%s' - return types do not match\n", decl->identifier);
+ }
+ }
+ }
f->subroutine_types[idx++] = type;
}
state->subroutines = (ir_function **)reralloc(state, state->subroutines,