[Mesa-dev] [PATCH 20/20] mesa: Allow MESA_GL_VERSION_OVERRIDE with ES contexts
Rob Clark
robdclark at gmail.com
Wed Apr 29 16:30:12 PDT 2015
On Wed, Apr 29, 2015 at 7:26 PM, Ian Romanick <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> The bulk of the change is to prevent overriding the context to
> API_OPENGL_CORE based on the requested version. If the context is
> API_OPENGL_ES2, don't change it.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
\o/-by: Rob Clark <robdclark at gmail.com>
> ---
> src/mesa/drivers/dri/common/dri_util.c | 4 ++++
> src/mesa/main/context.c | 4 +---
> src/mesa/main/version.c | 16 +++++++++-------
> src/mesa/state_tracker/st_manager.c | 3 +--
> 4 files changed, 15 insertions(+), 12 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
> index d6e875f..680a907 100644
> --- a/src/mesa/drivers/dri/common/dri_util.c
> +++ b/src/mesa/drivers/dri/common/dri_util.c
> @@ -163,6 +163,10 @@ driCreateNewScreen2(int scrn, int fd,
> }
>
> int gl_version_override = _mesa_get_gl_version_override();
> + if (gl_version_override >= 20) {
> + psp->max_gl_es2_version = MAX2(psp->max_gl_es2_version,
> + gl_version_override);
> + }
> if (gl_version_override >= 31) {
> psp->max_gl_core_version = MAX2(psp->max_gl_core_version,
> gl_version_override);
> diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
> index 4aaf8b1..cd1a02b 100644
> --- a/src/mesa/main/context.c
> +++ b/src/mesa/main/context.c
> @@ -1109,9 +1109,7 @@ _mesa_initialize_context(struct gl_context *ctx,
> ctx->HasConfig = GL_FALSE;
> }
>
> - if (_mesa_is_desktop_gl(ctx)) {
> - _mesa_override_gl_version(ctx);
> - }
> + _mesa_override_gl_version(ctx);
>
> /* misc one-time initializations */
> one_time_init(ctx);
> diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
> index 1c19277..f426342 100644
> --- a/src/mesa/main/version.c
> +++ b/src/mesa/main/version.c
> @@ -134,13 +134,15 @@ _mesa_override_gl_version_contextless(struct gl_constants *consts,
>
> if (version > 0) {
> *versionOut = version;
> - 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 {
> - *apiOut = API_OPENGL_COMPAT;
> + 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 {
> + *apiOut = API_OPENGL_COMPAT;
> + }
> }
> return true;
> }
> diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
> index 840f76a..1b3b4cb 100644
> --- a/src/mesa/state_tracker/st_manager.c
> +++ b/src/mesa/state_tracker/st_manager.c
> @@ -920,8 +920,7 @@ static unsigned get_version(struct pipe_screen *screen,
> struct gl_extensions extensions = {0};
> GLuint version;
>
> - if ((api == API_OPENGL_COMPAT || api == API_OPENGL_CORE) &&
> - _mesa_override_gl_version_contextless(&consts, &api, &version)) {
> + if (_mesa_override_gl_version_contextless(&consts, &api, &version)) {
> return version;
> }
>
> --
> 2.1.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list