[Mesa-dev] [PATCH 02/12] mesa: make _mesa_override_glsl_version context-independent

Marek Olšák maraeo at gmail.com
Sun Aug 3 08:18:25 PDT 2014


From: Marek Olšák <marek.olsak at amd.com>

---
 src/mesa/drivers/dri/i915/intel_extensions.c | 2 +-
 src/mesa/drivers/dri/i965/intel_extensions.c | 2 +-
 src/mesa/main/context.c                      | 2 +-
 src/mesa/main/version.c                      | 4 ++--
 src/mesa/main/version.h                      | 3 ++-
 src/mesa/state_tracker/st_extensions.c       | 2 +-
 6 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_extensions.c b/src/mesa/drivers/dri/i915/intel_extensions.c
index de716a7..ab7820f 100644
--- a/src/mesa/drivers/dri/i915/intel_extensions.c
+++ b/src/mesa/drivers/dri/i915/intel_extensions.c
@@ -78,7 +78,7 @@ intelInitExtensions(struct gl_context *ctx)
    ctx->Extensions.OES_draw_texture = true;
 
    ctx->Const.GLSLVersion = 120;
-   _mesa_override_glsl_version(ctx);
+   _mesa_override_glsl_version(&ctx->Const);
 
    if (intel->gen >= 3) {
       ctx->Extensions.ARB_ES2_compatibility = true;
diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c
index 4ee8636..54ad9e4 100644
--- a/src/mesa/drivers/dri/i965/intel_extensions.c
+++ b/src/mesa/drivers/dri/i965/intel_extensions.c
@@ -248,7 +248,7 @@ intelInitExtensions(struct gl_context *ctx)
       ctx->Const.GLSLVersion = 140;
    else
       ctx->Const.GLSLVersion = 120;
-   _mesa_override_glsl_version(ctx);
+   _mesa_override_glsl_version(&ctx->Const);
 
    if (brw->gen >= 6) {
       uint64_t dummy;
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 50aae8b..0f28dbf 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -641,7 +641,7 @@ _mesa_init_constants(struct gl_context *ctx)
    /* Shading language version */
    if (_mesa_is_desktop_gl(ctx)) {
       ctx->Const.GLSLVersion = 120;
-      _mesa_override_glsl_version(ctx);
+      _mesa_override_glsl_version(&ctx->Const);
    }
    else if (ctx->API == API_OPENGLES2) {
       ctx->Const.GLSLVersion = 100;
diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index b7cc50f..7621144 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -168,7 +168,7 @@ _mesa_get_gl_version_override(void)
  * MESA_GLSL_VERSION_OVERRIDE are integers, such as "130".
  */
 void
-_mesa_override_glsl_version(struct gl_context *ctx)
+_mesa_override_glsl_version(struct gl_constants *consts)
 {
    const char *env_var = "MESA_GLSL_VERSION_OVERRIDE";
    const char *version;
@@ -179,7 +179,7 @@ _mesa_override_glsl_version(struct gl_context *ctx)
       return;
    }
 
-   n = sscanf(version, "%u", &ctx->Const.GLSLVersion);
+   n = sscanf(version, "%u", &consts->GLSLVersion);
    if (n != 1) {
       fprintf(stderr, "error: invalid value for %s: %s\n", env_var, version);
       return;
diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h
index c78f87a..42eada9 100644
--- a/src/mesa/main/version.h
+++ b/src/mesa/main/version.h
@@ -29,6 +29,7 @@
 
 
 struct gl_context;
+struct gl_constants;
 
 
 extern void
@@ -38,7 +39,7 @@ extern void
 _mesa_override_gl_version(struct gl_context *ctx);
 
 extern void
-_mesa_override_glsl_version(struct gl_context *ctx);
+_mesa_override_glsl_version(struct gl_constants *consts);
 
 extern int
 _mesa_get_gl_version_override(void);
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 60aa8cc..f04ff4c 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -617,7 +617,7 @@ void st_init_extensions(struct st_context *st)
    if (glsl_feature_level >= 330)
       ctx->Const.GLSLVersion = 330;
 
-   _mesa_override_glsl_version(st->ctx);
+   _mesa_override_glsl_version(&st->ctx->Const);
 
    if (st->options.force_glsl_version > 0 &&
        st->options.force_glsl_version <= ctx->Const.GLSLVersion) {
-- 
1.9.1



More information about the mesa-dev mailing list