Mesa (master): glx: Changes to visual configs initialization.

Ian Romanick idr at kemper.freedesktop.org
Thu Jul 18 23:03:17 UTC 2013


Module: Mesa
Branch: master
Commit: 5531ac9c47240d3ba41a47183f1347fea530ce17
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5531ac9c47240d3ba41a47183f1347fea530ce17

Author: Tomasz Lis <tomasz.lis at intel.com>
Date:   Wed Jul 17 13:49:16 2013 +0200

glx: Changes to visual configs initialization.

Correctly handle the value of renderType and drawableType in
fbconfig. Modify glXInitializeVisualConfigFromTags to read the parameter
value, or detect it if it's not there.

v2 (idr): If there was no GLX_RENDER_TYPE property, set the type based
purely on the rgbMode as the previous code did.  It is impossible for
floatMode to be set at this point, so we can't have a float config.  The
previous code regressed a large number of piglit GLX tests because those
tests don't set GLX_RENDER_TYPE in the glXChooseConfig call.  Restoring
the old behavior for that case fixes those regressions.

Also fix handling of GLX_DONT_CARE for GLX_RENDER_TYPE.  Fixes a
regression in glx-dont-care-mask.

Signed-off-by: Tomasz Lis <tomasz.lis at intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/glx/glxext.c               |   28 ++++++++++++++++++++++++----
 src/mesa/drivers/x11/fakeglx.c |    7 ++++++-
 2 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/src/glx/glxext.c b/src/glx/glxext.c
index ef1e7ad..bea1ccb 100644
--- a/src/glx/glxext.c
+++ b/src/glx/glxext.c
@@ -337,6 +337,7 @@ __glXInitializeVisualConfigFromTags(struct glx_config * config, int count,
                                     Bool fbconfig_style_tags)
 {
    int i;
+   GLint renderType = 0;
 
    if (!tagged_only) {
       /* Copy in the first set of properties */
@@ -471,8 +472,8 @@ __glXInitializeVisualConfigFromTags(struct glx_config * config, int count,
          config->drawableType |= GLX_WINDOW_BIT | GLX_PIXMAP_BIT | GLX_PBUFFER_BIT;              
 #endif
          break;
-      case GLX_RENDER_TYPE:
-         config->renderType = *bp++;
+      case GLX_RENDER_TYPE: /* fbconfig render type bits */
+         renderType = *bp++;
          break;
       case GLX_X_RENDERABLE:
          config->xRenderable = *bp++;
@@ -555,8 +556,27 @@ __glXInitializeVisualConfigFromTags(struct glx_config * config, int count,
       }
    }
 
-   config->renderType =
-      (config->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT;
+   if (renderType != 0 && renderType != GLX_DONT_CARE) {
+      config->renderType = renderType;
+      config->floatMode = (renderType &
+         (GLX_RGBA_FLOAT_BIT_ARB|GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT)) != 0;
+   } else {
+      /* If there wasn't GLX_RENDER_TYPE property, set it based on
+       * config->rgbMode.  The only way to communicate that the config is
+       * floating-point is via GLX_RENDER_TYPE, so this cannot be a float
+       * config.
+       */
+      config->renderType =
+         (config->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT;
+   }
+
+   /* The GLX_ARB_fbconfig_float spec says:
+    *
+    *     "Note that floating point rendering is only supported for
+    *     GLXPbuffer drawables."
+    */
+   if (config->floatMode)
+      config->drawableType &= ~(GLX_WINDOW_BIT|GLX_PIXMAP_BIT);
 }
 
 static struct glx_config *
diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c
index 969ee7d..7a2cfbe 100644
--- a/src/mesa/drivers/x11/fakeglx.c
+++ b/src/mesa/drivers/x11/fakeglx.c
@@ -1090,6 +1090,9 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig )
             else if (*parselist & GLX_COLOR_INDEX_BIT) {
                rgb_flag = GL_FALSE;
             }
+            else if (*parselist & (GLX_RGBA_FLOAT_BIT_ARB|GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT)) {
+               rgb_flag = GL_TRUE;
+            }
             else if (*parselist == 0) {
                rgb_flag = GL_TRUE;
             }
@@ -1761,7 +1764,9 @@ get_config( XMesaVisual xmvis, int attrib, int *value, GLboolean fbconfig )
       case GLX_RENDER_TYPE_SGIX:
          if (!fbconfig)
             return GLX_BAD_ATTRIBUTE;
-         if (xmvis->mesa_visual.rgbMode)
+         if (xmvis->mesa_visual.floatMode)
+            *value = GLX_RGBA_FLOAT_BIT_ARB;
+         else if (xmvis->mesa_visual.rgbMode)
             *value = GLX_RGBA_BIT;
          else
             *value = GLX_COLOR_INDEX_BIT;




More information about the mesa-commit mailing list