glsl/ast: subroutineTypes can't be returned from functions.
authorDave Airlie <airlied@redhat.com>
Mon, 23 May 2016 02:14:01 +0000 (12:14 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 30 May 2016 01:25:30 +0000 (11:25 +1000)
These types can't be returned.

This fixes:
GL43-CTS.shader_subroutine.subroutines_not_allowed_as_variables_constructors_and_argument_or_return_types
for the return type case.

Reviewed-by: Chris Forbes <chrisforbes@google.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/compiler/glsl/ast_to_hir.cpp

index d6f9a750de79bc6f141a223b0b3bd40e67da192d..ccacd266bb4f7d99811842b9877753a3b85a9c8d 100644 (file)
@@ -5400,6 +5400,15 @@ ast_function::hir(exec_list *instructions,
                        name);
    }
 
+   /**/
+   if (return_type->is_subroutine()) {
+      YYLTYPE loc = this->get_location();
+      _mesa_glsl_error(&loc, state,
+                       "function `%s' return type can't be a subroutine type",
+                       name);
+   }
+
+
    /* Create an ir_function if one doesn't already exist. */
    f = state->symbols->get_function(name);
    if (f == NULL) {