Mesa (master): slang: Update after glsl pp changes.

Michał Król michal at kemper.freedesktop.org
Sun Dec 20 12:21:25 PST 2009


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

Author: Michal Krol <michal at vmware.com>
Date:   Sun Dec 20 13:53:53 2009 +0100

slang: Update after glsl pp changes.

---

 src/mesa/shader/slang/slang_compile.c |   33 +++++++++++----------------------
 1 files changed, 11 insertions(+), 22 deletions(-)

diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c
index 54eb092..2622b79 100644
--- a/src/mesa/shader/slang/slang_compile.c
+++ b/src/mesa/shader/slang/slang_compile.c
@@ -2584,6 +2584,7 @@ compile_with_grammar(const char *source,
                      unsigned int shader_type,
                      unsigned int parsing_builtin)
 {
+   struct sl_pp_purify_options options;
    struct sl_pp_context *context;
    struct sl_pp_token_info *tokens;
    unsigned char *prod;
@@ -2591,18 +2592,23 @@ compile_with_grammar(const char *source,
    unsigned int version;
    unsigned int maxVersion;
    int result;
-   struct sl_pp_purify_options options;
    char errmsg[200] = "";
    unsigned int errline = 0;
-   struct sl_pp_token_info *intokens;
-   unsigned int tokens_eaten;
 
-   context = sl_pp_context_create();
+   memset(&options, 0, sizeof(options));
+
+   context = sl_pp_context_create(source, &options);
    if (!context) {
       slang_info_log_error(infolog, "out of memory");
       return GL_FALSE;
    }
 
+   if (sl_pp_version(context, &version)) {
+      slang_info_log_error(infolog, "%s", sl_pp_context_error_message(context));
+      sl_pp_context_destroy(context);
+      return GL_FALSE;
+   }
+
    if (sl_pp_context_add_extension(context, "ARB_draw_buffers", "GL_ARB_draw_buffers") ||
        sl_pp_context_add_extension(context, "ARB_texture_rectangle", "GL_ARB_texture_rectangle")) {
       slang_info_log_error(infolog, "%s", sl_pp_context_error_message(context));
@@ -2619,29 +2625,12 @@ compile_with_grammar(const char *source,
    }
 #endif
 
-   memset(&options, 0, sizeof(options));
-   if (sl_pp_tokenise(context, source, &options, &intokens)) {
+   if (sl_pp_process(context, &tokens)) {
       slang_info_log_error(infolog, "%s", sl_pp_context_error_message(context));
       sl_pp_context_destroy(context);
       return GL_FALSE;
    }
 
-   if (sl_pp_version(context, intokens, &version, &tokens_eaten)) {
-      slang_info_log_error(infolog, "%s", sl_pp_context_error_message(context));
-      sl_pp_context_destroy(context);
-      free(intokens);
-      return GL_FALSE;
-   }
-
-   if (sl_pp_process(context, &intokens[tokens_eaten], &tokens)) {
-      slang_info_log_error(infolog, "%s", sl_pp_context_error_message(context));
-      sl_pp_context_destroy(context);
-      free(intokens);
-      return GL_FALSE;
-   }
-
-   free(intokens);
-
    /* For the time being we care about only a handful of tokens. */
    {
       const struct sl_pp_token_info *src = tokens;



More information about the mesa-commit mailing list