glsl: subroutine types cannot be used in constructors.
authorDave Airlie <airlied@redhat.com>
Tue, 3 May 2016 04:33:16 +0000 (14:33 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 3 May 2016 20:44:45 +0000 (06:44 +1000)
This fixes two of the cases in
GL43-CTS.shader_subroutine.subroutines_not_allowed_as_variables_constructors_and_argument_or_return_types

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/compiler/glsl/ast_function.cpp

index f50c7bf7b71e077601338ea75582beb85f09e193..37fb3e790c4876e72fda2a8ff7b2af2d5796e7a6 100644 (file)
@@ -1819,6 +1819,12 @@ ast_function_expression::hir(exec_list *instructions,
         return ir_rvalue::error_value(ctx);
       }
 
+      if (constructor_type->is_subroutine()) {
+         _mesa_glsl_error(& loc, state, "subroutine name cannot be a constructor `%s'",
+                          constructor_type->name);
+        return ir_rvalue::error_value(ctx);
+      }
+
       if (constructor_type->is_array()) {
          if (!state->check_version(120, 300, &loc,
                                    "array constructors forbidden")) {