mesa: enable OpenGL 3.1 with ARB_compatibility

Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
Marek Olšák 2018-02-14 20:13:40 +01:00
parent 605a7f6db5
commit a0c8b49284
4 changed files with 17 additions and 20 deletions

View File

@ -24,10 +24,10 @@ not started
# OpenGL Core and Compatibility context support # OpenGL Core and Compatibility context support
OpenGL 3.1 and later versions are only supported with the Core profile. Some drivers do not support the Compatibility profile or ARB_compatibility.
There are no plans to support GL_ARB_compatibility. The last supported OpenGL Such drivers are limited to OpenGL 3.0 if the Core profile is not requested
version with all deprecated features is 3.0. Some of the later GL features by applications. Some of the later GL features are exposed in the 3.0 context
are exposed in the 3.0 context as extensions. as extensions.
Feature Status Feature Status

View File

@ -26,8 +26,8 @@ Mesa 18.1.0 implements the OpenGL 4.5 API, but the version reported by
glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) / glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) /
glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used. glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used.
Some drivers don't support all the features required in OpenGL 4.5. OpenGL Some drivers don't support all the features required in OpenGL 4.5. OpenGL
4.5 is <strong>only</strong> available if requested at context creation 4.5 is <strong>only</strong> available if requested at context creation.
because compatibility contexts are not supported. Compatibility contexts may report a lower version depending on each driver.
</p> </p>
@ -44,6 +44,7 @@ Note: some of the new features are only available with certain drivers.
</p> </p>
<ul> <ul>
<li>OpenGL 3.1 with ARB_compatibility on nv50, nvc0, r600, radeonsi, softpipe, llvmpipe, svga</li>
<li>GL_ARB_bindless_texture on nvc0/maxwell+</li> <li>GL_ARB_bindless_texture on nvc0/maxwell+</li>
<li>GL_EXT_semaphore on radeonsi</li> <li>GL_EXT_semaphore on radeonsi</li>
<li>GL_EXT_semaphore_fd on radeonsi</li> <li>GL_EXT_semaphore_fd on radeonsi</li>

View File

@ -381,14 +381,6 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
} }
} }
/* Mesa does not support the GL_ARB_compatibilty extension or the
* compatibility profile. This means that we treat a API_OPENGL_COMPAT 3.1 as
* API_OPENGL_CORE and reject API_OPENGL_COMPAT 3.2+.
*/
if (mesa_api == API_OPENGL_COMPAT &&
ctx_config.major_version == 3 && ctx_config.minor_version == 1)
mesa_api = API_OPENGL_CORE;
if (mesa_api == API_OPENGL_COMPAT if (mesa_api == API_OPENGL_COMPAT
&& ((ctx_config.major_version > 3) && ((ctx_config.major_version > 3)
|| (ctx_config.major_version == 3 && || (ctx_config.major_version == 3 &&

View File

@ -580,11 +580,11 @@ _mesa_get_version(const struct gl_extensions *extensions,
{ {
switch (api) { switch (api) {
case API_OPENGL_COMPAT: case API_OPENGL_COMPAT:
/* Disable GLSL 1.40 and later for legacy contexts. /* Disable higher GLSL versions for legacy contexts.
* This disallows creation of the GL 3.1 compatibility context. */ * This disallows creation of higher compatibility contexts. */
if (!consts->AllowHigherCompatVersion) { if (!consts->AllowHigherCompatVersion) {
if (consts->GLSLVersion > 130) { if (consts->GLSLVersion > 140) {
consts->GLSLVersion = 130; consts->GLSLVersion = 140;
} }
} }
/* fall through */ /* fall through */
@ -607,7 +607,7 @@ void
_mesa_compute_version(struct gl_context *ctx) _mesa_compute_version(struct gl_context *ctx)
{ {
if (ctx->Version) if (ctx->Version)
return; goto done;
ctx->Version = _mesa_get_version(&ctx->Extensions, &ctx->Const, ctx->API); ctx->Version = _mesa_get_version(&ctx->Extensions, &ctx->Const, ctx->API);
ctx->Extensions.Version = ctx->Version; ctx->Extensions.Version = ctx->Version;
@ -615,7 +615,7 @@ _mesa_compute_version(struct gl_context *ctx)
/* Make sure that the GLSL version lines up with the GL version. In some /* Make sure that the GLSL version lines up with the GL version. In some
* cases it can be too high, e.g. if an extension is missing. * cases it can be too high, e.g. if an extension is missing.
*/ */
if (ctx->API == API_OPENGL_CORE) { if (_mesa_is_desktop_gl(ctx) && ctx->Version >= 31) {
switch (ctx->Version) { switch (ctx->Version) {
case 31: case 31:
ctx->Const.GLSLVersion = 140; ctx->Const.GLSLVersion = 140;
@ -651,6 +651,10 @@ _mesa_compute_version(struct gl_context *ctx)
create_version_string(ctx, "OpenGL ES "); create_version_string(ctx, "OpenGL ES ");
break; break;
} }
done:
if (ctx->API == API_OPENGL_COMPAT && ctx->Version >= 31)
ctx->Extensions.ARB_compatibility = GL_TRUE;
} }