[Mesa-dev] [PATCH 10/23] glsl: Disallow 'subroutine' as a general type qualifier

Dave Airlie airlied at gmail.com
Thu Apr 23 18:42:46 PDT 2015


From: Chris Forbes <chrisf at ijw.co.nz>

Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
---
 src/glsl/ast_to_hir.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 7836936..90b732c 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2419,6 +2419,12 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
       }
    }
 
+   if (qual->flags.q.subroutine && !qual->flags.q.uniform) {
+      _mesa_glsl_error(loc, state,
+                       "`subroutine' may only be applied to uniforms, "
+                       "subroutine type declarations, or function definitions");
+   }
+
    if (qual->flags.q.constant || qual->flags.q.attribute
        || qual->flags.q.uniform
        || (qual->flags.q.varying && (state->stage == MESA_SHADER_FRAGMENT)))
-- 
2.1.0



More information about the mesa-dev mailing list