Mesa (master): glsl: Parse "#version 150 core" directives.

Kenneth Graunke kwg at kemper.freedesktop.org
Mon Jun 10 17:55:44 UTC 2013


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Fri Jun  7 21:28:59 2013 -0700

glsl: Parse "#version 150 core" directives.

Previously we only supported "#version 150".  This patch recognizes
"compatibility" to give the user a more descriptive error message.

Fixes Piglit's version-150-core-profile test.

Reviewed-by: Matt Turner <mattst88 at gmail.com>
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/glsl/glsl_parser_extras.cpp |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index c0dd713..85b2165 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -226,6 +226,19 @@ _mesa_glsl_parse_state::process_version_directive(YYLTYPE *locp, int version,
    if (ident) {
       if (strcmp(ident, "es") == 0) {
          es_token_present = true;
+      } else if (version >= 150) {
+         if (strcmp(ident, "core") == 0) {
+            /* Accept the token.  There's no need to record that this is
+             * a core profile shader since that's the only profile we support.
+             */
+         } else if (strcmp(ident, "compatibility") == 0) {
+            _mesa_glsl_error(locp, this,
+                             "The compatibility profile is not supported.\n");
+         } else {
+            _mesa_glsl_error(locp, this,
+                             "\"%s\" is not a valid shading language profile; "
+                             "if present, it must be \"core\".\n", ident);
+         }
       } else {
          _mesa_glsl_error(locp, this,
                           "Illegal text following version number\n");




More information about the mesa-commit mailing list