[Mesa-dev] [PATCH v3 3/3] mesa: allow MESA_GL_VERSION_OVERRIDE to override the API type
Eric Anholt
eric at anholt.net
Thu Sep 27 09:34:47 PDT 2012
Jordan Justen <jordan.l.justen at intel.com> writes:
> Change the format to MAJOR.MINOR[FC]
> For example: 2.1, 3.0FC, 3.1
>
> The FC suffix indicates a forward compatible context, and
> is only valid for versions >= 3.0.
>
> Examples:
> 2.1: GL Legacy/Compatibility context
> 3.0: GL Legacy/Compatibility context
> 3.0FC: GL Core Profile context + Forward Compatible
> 3.1: GL Core Profile context
> 3.1FC: GL Core Profile context + Forward Compatible
> +void
> +_mesa_override_gl_version(struct gl_context *ctx)
> +{
> + const char *env_var = "MESA_GL_VERSION_OVERRIDE";
> + const char *version;
> + char *version_dup;
> + int n;
> + int major, minor;
> + GLboolean fc_suffix;
> +
> + version = getenv(env_var);
> + if (!version) {
> + return;
> + }
> +
> + version_dup = strdup(version);
> + assert (version_dup != NULL);
> +
> + fc_suffix = check_for_ending_and_remove(version_dup, "FC");
Given that you don't do anything else with version_dup, why create it
and modify it? Just use version without truncating it.
> + if (ctx->Version >= 30 && fc_suffix) {
> + ctx->API = API_OPENGL_CORE;
> + ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT;
> + } else if (ctx->Version >= 31) {
> + ctx->API = API_OPENGL_CORE;
> + } else {
> + ctx->API = API_OPENGL;
You're not setting the forward bit for >= 3.1 and FC like the
docs/commit msg say. With these two bits fixed, this series is:
Reviewed-by: Eric Anholt <eric at anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120927/5094cd7c/attachment-0001.pgp>
More information about the mesa-dev
mailing list