[Mesa-dev] [PATCH 1/2] mesa: simplify MESA_GL_VERSION_OVERRIDE behavior of API override
Marek Olšák
maraeo at gmail.com
Tue Mar 6 23:27:30 UTC 2018
From: Marek Olšák <marek.olsak at amd.com>
---
docs/envvars.html | 3 ++-
src/mesa/main/version.c | 16 +++++-----------
2 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/docs/envvars.html b/docs/envvars.html
index ea42a50..3ef3ab1 100644
--- a/docs/envvars.html
+++ b/docs/envvars.html
@@ -92,22 +92,23 @@ glGetString(GL_VERSION) and possibly the GL API type.
<li> FC is an optional suffix that indicates a forward compatible context.
This is only valid for versions >= 3.0.
<li> GL versions < 3.0 are set to a compatibility (non-Core) profile
<li> GL versions = 3.0, see below
<li> GL versions > 3.0 are set to a Core profile
<li> Examples: 2.1, 3.0, 3.0FC, 3.1, 3.1FC
<ul>
<li> 2.1 - select a compatibility (non-Core) profile with GL version 2.1
<li> 3.0 - select a compatibility (non-Core) profile with GL version 3.0
<li> 3.0FC - select a Core+Forward Compatible profile with GL version 3.0
-<li> 3.1 - select a Core profile with GL version 3.1
+<li> 3.1 - keep the same profile and set GL version 3.1
<li> 3.1FC - select a Core+Forward Compatible profile with GL version 3.1
+<li> 3.1COMPAT - select a compatibility (non-Core) profile with GL version 3.1
</ul>
<li> Mesa may not really implement all the features of the given version.
(for developers only)
</ul>
<li>MESA_GLES_VERSION_OVERRIDE - changes the value returned by
glGetString(GL_VERSION) for OpenGL ES.
<ul>
<li> The format should be MAJOR.MINOR
<li> Examples: 2.0, 3.0, 3.1
<li> Mesa may not really implement all the features of the given version.
diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index a280690..9ad49db 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -133,48 +133,42 @@ create_version_string(struct gl_context *ctx, const char *prefix)
}
}
/**
* Override the context's version and/or API type if the
* environment variable MESA_GL_VERSION_OVERRIDE is set.
*
* Example uses of MESA_GL_VERSION_OVERRIDE:
*
* 2.1: select a compatibility (non-Core) profile with GL version 2.1
- * 3.0: select a compatibility (non-Core) profile with GL version 3.0
- * 3.0FC: select a Core+Forward Compatible profile with GL version 3.0
- * 3.1: select a Core profile with GL version 3.1
- * 3.1FC: select a Core+Forward Compatible profile with GL version 3.1
+ * X.Y: override GL version to X.Y without changing the profile
+ * X.YFC: select a Core+Forward Compatible profile with GL version X.Y
+ * X.YCOMPAT: select a Compatibility profile with GL version X.Y
*/
bool
_mesa_override_gl_version_contextless(struct gl_constants *consts,
gl_api *apiOut, GLuint *versionOut)
{
int version;
bool fwd_context, compat_context;
get_gl_override(*apiOut, &version, &fwd_context, &compat_context);
if (version > 0) {
*versionOut = version;
- /* If the API is a desktop API, adjust the context flags. We may also
- * need to modify the API depending on the version. For example, Mesa
- * does not support a GL 3.3 compatibility profile.
- */
+ /* Modify the API and context flags as needed. */
if (*apiOut == API_OPENGL_CORE || *apiOut == API_OPENGL_COMPAT) {
if (version >= 30 && fwd_context) {
*apiOut = API_OPENGL_CORE;
consts->ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT;
- } else if (version >= 31 && !compat_context) {
- *apiOut = API_OPENGL_CORE;
- } else {
+ } else if (compat_context) {
*apiOut = API_OPENGL_COMPAT;
}
}
return true;
}
return false;
}
void
--
2.7.4
More information about the mesa-dev
mailing list