[Mesa-dev] [PATCH 3/4] st/mesa: accept and handle configuration options from st/dri

Vadim Girlin vadimgirlin at gmail.com
Wed Apr 11 17:41:54 PDT 2012


Currently there is a single option - force_glsl_extensions_warn.

Signed-off-by: Vadim Girlin <vadimgirlin at gmail.com>
---
 src/gallium/include/state_tracker/st_api.h |   14 ++++++++++++++
 src/mesa/state_tracker/st_context.c        |   10 +++++++---
 src/mesa/state_tracker/st_context.h        |    5 ++++-
 src/mesa/state_tracker/st_extensions.c     |    2 ++
 src/mesa/state_tracker/st_manager.c        |    2 +-
 5 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h
index 3af1dfc..8d829c2 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -221,6 +221,15 @@ struct st_visual
    enum st_attachment_type render_buffer;
 };
 
+
+/**
+ * Configuration options from driconf
+ */
+struct st_config_options
+{
+	boolean force_glsl_extensions_warn;
+};
+
 /**
  * Represent the attributes of a context.
  */
@@ -243,6 +252,11 @@ struct st_context_attribs
     * The visual of the framebuffers the context will be bound to.
     */
    struct st_visual visual;
+
+   /**
+    * Configuration options.
+    */
+   struct st_config_options options;
 };
 
 /**
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index a3fd4db..dfd5870 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -111,11 +111,14 @@ st_get_msaa(void)
 
 
 static struct st_context *
-st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe )
+st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
+		const struct st_config_options *options)
 {
    uint i;
    struct st_context *st = ST_CALLOC_STRUCT( st_context );
    
+   st->options = *options;
+
    ctx->st = st;
 
    st->ctx = ctx;
@@ -179,7 +182,8 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe )
 
 struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,
                                      const struct gl_config *visual,
-                                     struct st_context *share)
+                                     struct st_context *share,
+                                     const struct st_config_options *options)
 {
    struct gl_context *ctx;
    struct gl_context *shareCtx = share ? share->ctx : NULL;
@@ -204,7 +208,7 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,
    if (debug_get_option_mesa_mvp_dp4())
       _mesa_set_mvp_with_dp4( ctx, GL_TRUE );
 
-   return st_create_context_priv(ctx, pipe);
+   return st_create_context_priv(ctx, pipe, options);
 }
 
 
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index da03719..23b780f 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -209,6 +209,8 @@ struct st_context
 
    int32_t draw_stamp;
    int32_t read_stamp;
+
+   struct st_config_options options;
 };
 
 
@@ -281,7 +283,8 @@ st_get_msaa(void);
 extern struct st_context *
 st_create_context(gl_api api, struct pipe_context *pipe,
                   const struct gl_config *visual,
-                  struct st_context *share);
+                  struct st_context *share,
+                  const struct st_config_options *options);
 
 extern void
 st_destroy_context(struct st_context *st);
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index afea0ea..7cdbf32 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -629,4 +629,6 @@ void st_init_extensions(struct st_context *st)
          break;
       }
    }
+   if (st->options.force_glsl_extensions_warn)
+	   ctx->Const.ForceGLSLExtensionsWarn = 1;
 }
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index d54b7ed..77eb20f 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -635,7 +635,7 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
    }
 
    st_visual_to_context_mode(&attribs->visual, &mode);
-   st = st_create_context(api, pipe, &mode, shared_ctx);
+   st = st_create_context(api, pipe, &mode, shared_ctx, &attribs->options);
    if (!st) {
       *error = ST_CONTEXT_ERROR_NO_MEMORY;
       pipe->destroy(pipe);
-- 
1.7.7.6



More information about the mesa-dev mailing list