[Mesa-dev] [PATCH 1/2] st/xlib: Honour request of 3.1 contexts through core profile where available.

2014-04-24 Thread jfonseca
From: José Fonseca jfons...@vmware.com

The GLX_ARB_create_context_profile spec says:

If version 3.1 is requested, the context returned may implement
any of the following versions:

  * Version 3.1. The GL_ARB_compatibility extension may or may not
be implemented, as determined by the implementation.

  * The core profile of version 3.2 or greater.

Mesa does not support GL_ARB_compatibility, and there are no plans to
ever support it, therefore the only chance to honour a 3.1 context is
through core profile, i.e, the 2nd alternative from the spec.

This change does that.  And with it piglit tests that require 3.1
contexts no longer skip.

Assuming there is no objection with this change, src/glx/dri_common.c
and src/gallium/state_trackers/wgl/stw_context.c should also be updated
accordingly, given they have the same logic.
---
 src/gallium/state_trackers/glx/xlib/xm_api.c | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c 
b/src/gallium/state_trackers/glx/xlib/xm_api.c
index bb2dd8e..7836c61 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -899,10 +899,23 @@ XMesaContext XMesaCreateContext( XMesaVisual v, 
XMesaContext share_list,
 *
 * The default value for GLX_CONTEXT_PROFILE_MASK_ARB is
 * GLX_CONTEXT_CORE_PROFILE_BIT_ARB.
+*
+* The spec also says:
+*
+* If version 3.1 is requested, the context returned may implement
+* any of the following versions:
+*
+*   * Version 3.1. The GL_ARB_compatibility extension may or may not
+* be implemented, as determined by the implementation.
+*   * The core profile of version 3.2 or greater.
+*
+* and because Mesa doesn't support GL_ARB_compatibility, the only chance to
+* honour a 3.1 context is through core profile.
 */
attribs.profile = ST_PROFILE_DEFAULT;
-   if ((major  3 || (major == 3  minor = 2))
-((profileMask  GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB) == 0))
+   if (((major  3 || (major == 3  minor = 2))
+ ((profileMask  GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB) == 0)) ||
+   (major == 3  minor == 1))
   attribs.profile = ST_PROFILE_OPENGL_CORE;
 
c-st = stapi-create_context(stapi, xmdpy-smapi, attribs,
-- 
1.8.3.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] st/xlib: Honour request of 3.1 contexts through core profile where available.

2014-04-24 Thread Roland Scheidegger
Am 24.04.2014 16:24, schrieb jfons...@vmware.com:
 From: José Fonseca jfons...@vmware.com
 
 The GLX_ARB_create_context_profile spec says:
 
 If version 3.1 is requested, the context returned may implement
 any of the following versions:
 
   * Version 3.1. The GL_ARB_compatibility extension may or may not
 be implemented, as determined by the implementation.
 
   * The core profile of version 3.2 or greater.
 
 Mesa does not support GL_ARB_compatibility, and there are no plans to
 ever support it, therefore the only chance to honour a 3.1 context is
 through core profile, i.e, the 2nd alternative from the spec.
 
 This change does that.  And with it piglit tests that require 3.1
 contexts no longer skip.
 
 Assuming there is no objection with this change, src/glx/dri_common.c
 and src/gallium/state_trackers/wgl/stw_context.c should also be updated
 accordingly, given they have the same logic.
 ---
  src/gallium/state_trackers/glx/xlib/xm_api.c | 17 +++--
  1 file changed, 15 insertions(+), 2 deletions(-)
 
 diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c 
 b/src/gallium/state_trackers/glx/xlib/xm_api.c
 index bb2dd8e..7836c61 100644
 --- a/src/gallium/state_trackers/glx/xlib/xm_api.c
 +++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
 @@ -899,10 +899,23 @@ XMesaContext XMesaCreateContext( XMesaVisual v, 
 XMesaContext share_list,
  *
  * The default value for GLX_CONTEXT_PROFILE_MASK_ARB is
  * GLX_CONTEXT_CORE_PROFILE_BIT_ARB.
 +*
 +* The spec also says:
 +*
 +* If version 3.1 is requested, the context returned may implement
 +* any of the following versions:
 +*
 +*   * Version 3.1. The GL_ARB_compatibility extension may or may not
 +* be implemented, as determined by the implementation.
 +*   * The core profile of version 3.2 or greater.
 +*
 +* and because Mesa doesn't support GL_ARB_compatibility, the only chance 
 to
 +* honour a 3.1 context is through core profile.
  */
 attribs.profile = ST_PROFILE_DEFAULT;
 -   if ((major  3 || (major == 3  minor = 2))
 -((profileMask  GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB) == 0))
 +   if (((major  3 || (major == 3  minor = 2))
 + ((profileMask  GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB) == 0)) 
 ||
 +   (major == 3  minor == 1))
attribs.profile = ST_PROFILE_OPENGL_CORE;
  
 c-st = stapi-create_context(stapi, xmdpy-smapi, attribs,
 

Looks good to me. The spec there really seems to be unnecessarily
complex, I guess that's due to historic reasons...

Roland
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] st/xlib: Honour request of 3.1 contexts through core profile where available.

2014-04-24 Thread Brian Paul

On 04/24/2014 08:24 AM, jfons...@vmware.com wrote:

From: José Fonseca jfons...@vmware.com

The GLX_ARB_create_context_profile spec says:

 If version 3.1 is requested, the context returned may implement
 any of the following versions:

   * Version 3.1. The GL_ARB_compatibility extension may or may not
 be implemented, as determined by the implementation.

   * The core profile of version 3.2 or greater.

Mesa does not support GL_ARB_compatibility, and there are no plans to
ever support it, therefore the only chance to honour a 3.1 context is
through core profile, i.e, the 2nd alternative from the spec.

This change does that.  And with it piglit tests that require 3.1
contexts no longer skip.

Assuming there is no objection with this change, src/glx/dri_common.c
and src/gallium/state_trackers/wgl/stw_context.c should also be updated
accordingly, given they have the same logic.
---
  src/gallium/state_trackers/glx/xlib/xm_api.c | 17 +++--
  1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c 
b/src/gallium/state_trackers/glx/xlib/xm_api.c
index bb2dd8e..7836c61 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -899,10 +899,23 @@ XMesaContext XMesaCreateContext( XMesaVisual v, 
XMesaContext share_list,
  *
  * The default value for GLX_CONTEXT_PROFILE_MASK_ARB is
  * GLX_CONTEXT_CORE_PROFILE_BIT_ARB.
+*
+* The spec also says:
+*
+* If version 3.1 is requested, the context returned may implement
+* any of the following versions:
+*
+*   * Version 3.1. The GL_ARB_compatibility extension may or may not
+* be implemented, as determined by the implementation.
+*   * The core profile of version 3.2 or greater.
+*
+* and because Mesa doesn't support GL_ARB_compatibility, the only chance to
+* honour a 3.1 context is through core profile.
  */
 attribs.profile = ST_PROFILE_DEFAULT;
-   if ((major  3 || (major == 3  minor = 2))
-((profileMask  GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB) == 0))
+   if (((major  3 || (major == 3  minor = 2))
+ ((profileMask  GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB) == 0)) ||
+   (major == 3  minor == 1))
attribs.profile = ST_PROFILE_OPENGL_CORE;

 c-st = stapi-create_context(stapi, xmdpy-smapi, attribs,



Looks OK to me.  But I find that version comparison logic is a bit 
easier with something like:


version = major * 10 + minor;

if ((version = 32)  ((profileMask  
GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB) == 0)) ||

  (version == 31))

Either way is OK.

Reviewed-by: Brian Paul bri...@vmware.com


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev