[Mesa-dev] [PATCH 08/12] mesa: add a context-independent variant of _mesa_override_gl_version

Ian Romanick idr at freedesktop.org
Tue Aug 5 11:06:26 PDT 2014


On 08/03/2014 08:18 AM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> ---
>  src/mesa/main/version.c | 25 ++++++++++++++++++-------
>  src/mesa/main/version.h |  8 +++++---
>  2 files changed, 23 insertions(+), 10 deletions(-)
> 
> diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
> index 7621144..c98e30c 100644
> --- a/src/mesa/main/version.c
> +++ b/src/mesa/main/version.c
> @@ -124,8 +124,9 @@ create_version_string(struct gl_context *ctx, const char *prefix)
>   * 3.1: select a Core profile with GL version 3.1
>   * 3.1FC: select a Core+Forward Compatible profile with GL version 3.1
>   */
> -void
> -_mesa_override_gl_version(struct gl_context *ctx)
> +GLboolean

bool

With that changed, this patch is

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>


> +_mesa_override_gl_version_contextless(struct gl_constants *consts,
> +                                      gl_api *apiOut, GLuint *versionOut)
>  {
>     int version;
>     GLboolean fwd_context;
> @@ -133,15 +134,25 @@ _mesa_override_gl_version(struct gl_context *ctx)
>     get_gl_override(&version, &fwd_context);
>  
>     if (version > 0) {
> -      ctx->Version = version;
> +      *versionOut = version;
>        if (version >= 30 && fwd_context) {
> -         ctx->API = API_OPENGL_CORE;
> -         ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT;
> +         *apiOut = API_OPENGL_CORE;
> +         consts->ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT;
>        } else if (version >= 31) {
> -         ctx->API = API_OPENGL_CORE;
> +         *apiOut = API_OPENGL_CORE;
>        } else {
> -         ctx->API = API_OPENGL_COMPAT;
> +         *apiOut = API_OPENGL_COMPAT;
>        }
> +      return GL_TRUE;
> +   }
> +   return GL_FALSE;
> +}
> +
> +void
> +_mesa_override_gl_version(struct gl_context *ctx)
> +{
> +   if (_mesa_override_gl_version_contextless(&ctx->Const, &ctx->API,
> +                                             &ctx->Version)) {
>        create_version_string(ctx, "");
>     }
>  }
> diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h
> index 42eada9..8dcd6a0 100644
> --- a/src/mesa/main/version.h
> +++ b/src/mesa/main/version.h
> @@ -27,14 +27,16 @@
>  #ifndef VERSION_H
>  #define VERSION_H
>  
> -
> -struct gl_context;
> -struct gl_constants;
> +#include "mtypes.h"
>  
>  
>  extern void
>  _mesa_compute_version(struct gl_context *ctx);
>  
> +extern GLboolean
> +_mesa_override_gl_version_contextless(struct gl_constants *consts,
> +                                      gl_api *apiOut, GLuint *versionOut);
> +
>  extern void
>  _mesa_override_gl_version(struct gl_context *ctx);
>  
> 



More information about the mesa-dev mailing list