Mesa (master): Simplify GLSL extension mechanism.

Michał Król michal at kemper.freedesktop.org
Wed Feb 10 17:04:20 UTC 2010


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

Author: Michal Krol <michal at vmware.com>
Date:   Wed Feb 10 18:04:07 2010 +0100

Simplify GLSL extension mechanism.

Since extension name and extension name string are the same, collapse
them into one name.

---

 src/glsl/apps/compile.c               |    4 ++--
 src/glsl/apps/process.c               |    4 ++--
 src/glsl/pp/sl_pp_context.h           |    3 +--
 src/glsl/pp/sl_pp_extension.c         |   10 ++--------
 src/glsl/pp/sl_pp_public.h            |    3 +--
 src/mesa/shader/slang/slang_compile.c |    4 ++--
 6 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/src/glsl/apps/compile.c b/src/glsl/apps/compile.c
index c9a830b..3b3c083 100644
--- a/src/glsl/apps/compile.c
+++ b/src/glsl/apps/compile.c
@@ -134,8 +134,8 @@ main(int argc,
       return 0;
    }
 
-   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")) {
+   if (sl_pp_context_add_extension(context, "GL_ARB_draw_buffers") ||
+       sl_pp_context_add_extension(context, "GL_ARB_texture_rectangle")) {
       fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context));
 
       printf("Error: %s\n", sl_pp_context_error_message(context));
diff --git a/src/glsl/apps/process.c b/src/glsl/apps/process.c
index 5698902..2d2ab91 100644
--- a/src/glsl/apps/process.c
+++ b/src/glsl/apps/process.c
@@ -106,8 +106,8 @@ main(int argc,
       return -1;
    }
 
-   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")) {
+   if (sl_pp_context_add_extension(context, "GL_ARB_draw_buffers") ||
+       sl_pp_context_add_extension(context, "GL_ARB_texture_rectangle")) {
       fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context));
 
       printf("Error: %s\n", sl_pp_context_error_message(context));
diff --git a/src/glsl/pp/sl_pp_context.h b/src/glsl/pp/sl_pp_context.h
index 3eada38..7b9f494 100644
--- a/src/glsl/pp/sl_pp_context.h
+++ b/src/glsl/pp/sl_pp_context.h
@@ -44,8 +44,7 @@
 #define SL_PP_MAX_PREDEFINED  16
 
 struct sl_pp_extension {
-   int name;         /*< VENDOR_extension_name */
-   int name_string;  /*< GL_VENDOR_extension_name */
+   int name;   /*< GL_VENDOR_extension_name */
 };
 
 struct sl_pp_predefined {
diff --git a/src/glsl/pp/sl_pp_extension.c b/src/glsl/pp/sl_pp_extension.c
index 8af5731..630a797 100644
--- a/src/glsl/pp/sl_pp_extension.c
+++ b/src/glsl/pp/sl_pp_extension.c
@@ -34,8 +34,7 @@
 
 int
 sl_pp_context_add_extension(struct sl_pp_context *context,
-                            const char *name,
-                            const char *name_string)
+                            const char *name)
 {
    struct sl_pp_extension ext;
 
@@ -48,11 +47,6 @@ sl_pp_context_add_extension(struct sl_pp_context *context,
       return -1;
    }
 
-   ext.name_string = sl_pp_context_add_unique_str(context, name_string);
-   if (ext.name_string == -1) {
-      return -1;
-   }
-
    context->extensions[context->num_extensions++] = ext;
    return 0;
 }
@@ -86,7 +80,7 @@ sl_pp_process_extension(struct sl_pp_context *context,
 
       out.data.extension = -1;
       for (i = 0; i < context->num_extensions; i++) {
-         if (extension_name == context->extensions[i].name_string) {
+         if (extension_name == context->extensions[i].name) {
             out.data.extension = extension_name;
             break;
          }
diff --git a/src/glsl/pp/sl_pp_public.h b/src/glsl/pp/sl_pp_public.h
index 12528d6..ca6f722 100644
--- a/src/glsl/pp/sl_pp_public.h
+++ b/src/glsl/pp/sl_pp_public.h
@@ -53,8 +53,7 @@ sl_pp_context_error_position(const struct sl_pp_context *context,
 
 int
 sl_pp_context_add_extension(struct sl_pp_context *context,
-                            const char *name,
-                            const char *name_string);
+                            const char *name);
 
 int
 sl_pp_context_add_predefined(struct sl_pp_context *context,
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c
index 49fe2fa..8522741 100644
--- a/src/mesa/shader/slang/slang_compile.c
+++ b/src/mesa/shader/slang/slang_compile.c
@@ -2608,8 +2608,8 @@ compile_with_grammar(const char *source,
       return GL_FALSE;
    }
 
-   if (sl_pp_context_add_extension(context, "GL_ARB_draw_buffers", "GL_ARB_draw_buffers") ||
-       sl_pp_context_add_extension(context, "GL_ARB_texture_rectangle", "GL_ARB_texture_rectangle")) {
+   if (sl_pp_context_add_extension(context, "GL_ARB_draw_buffers") ||
+       sl_pp_context_add_extension(context, "GL_ARB_texture_rectangle")) {
       slang_info_log_error(infolog, "%s", sl_pp_context_error_message(context));
       sl_pp_context_destroy(context);
       return GL_FALSE;




More information about the mesa-commit mailing list