From: Tomasz Lis <tomasz....@intel.com>

Replaces old use of floatMode attribute with new, extended range of
values in __DRI_ATTRIB_RENDER_TYPE. Also adds new conditions, where
the float modes support requires it. Enables support for not only
float configs, but packed float configs as well. Requires MESA
to be patched with "Float fbconfigs frontend patch [3/3]".

Signed-off-by: Tomasz Lis <tomasz....@intel.com>
---
 glx/glxcmds.c          |   12 +++++++++++-
 glx/glxdricommon.c     |   27 ++++++++++++++++++++++++---
 hw/xwin/glx/indirect.c |    4 +++-
 3 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 720a1a8..3d3dea2 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -1385,6 +1385,7 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID 
fbconfigId,
     __GLXconfig *config;
     __GLXscreen *pGlxScreen;
     PixmapPtr pPixmap;
+    int depth;
     int err;
 
     LEGAL_NEW_RESOURCE(glxDrawableId, client);
@@ -1394,10 +1395,19 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID 
fbconfigId,
     if (!validGlxFBConfig(client, pGlxScreen, fbconfigId, &config, &err))
         return err;
 
+    if (config->renderType & (GLX_RGBA_FLOAT_BIT_ARB |
+            GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT)) {
+        /* There are no float X pixmaps - create a dummy one, with 1 BPP. */
+       depth = 1;
+    } else {
+       depth = config->rgbBits;
+    }
+
+
     __glXenterServer(GL_FALSE);
     pPixmap = (*pGlxScreen->pScreen->CreatePixmap) (pGlxScreen->pScreen,
                                                     width, height,
-                                                    config->rgbBits, 0);
+                                                    depth, 0);
     __glXleaveServer(GL_FALSE);
 
     /* Assign the pixmap the same id as the pbuffer and add it as a
diff --git a/glx/glxdricommon.c b/glx/glxdricommon.c
index b027f24..ab9a0bf 100644
--- a/glx/glxdricommon.c
+++ b/glx/glxdricommon.c
@@ -36,6 +36,7 @@
 #include <GL/internal/dri_interface.h>
 #include <os.h>
 #include "glxserver.h"
+#include "glxext.h"
 #include "glxcontext.h"
 #include "glxscreens.h"
 #include "glxdricommon.h"
@@ -127,6 +128,7 @@ createModeFromConfig(const __DRIcoreExtension * core,
                      unsigned int visualType, unsigned int drawableType)
 {
     __GLXDRIconfig *config;
+    GLint renderType = 0;
     unsigned int attrib, value;
     int i;
 
@@ -138,11 +140,14 @@ createModeFromConfig(const __DRIcoreExtension * core,
     while (core->indexConfigAttrib(driConfig, i++, &attrib, &value)) {
         switch (attrib) {
         case __DRI_ATTRIB_RENDER_TYPE:
-            config->config.renderType = 0;
             if (value & __DRI_ATTRIB_RGBA_BIT)
-                config->config.renderType |= GLX_RGBA_BIT;
+                renderType |= GLX_RGBA_BIT;
             if (value & __DRI_ATTRIB_COLOR_INDEX_BIT)
-                config->config.renderType |= GLX_COLOR_INDEX_BIT;
+                renderType |= GLX_COLOR_INDEX_BIT;
+            if (value & __DRI_ATTRIB_FLOAT_BIT)
+                renderType |= GLX_RGBA_FLOAT_BIT_ARB;
+            if (value & __DRI_ATTRIB_UNSIGNED_FLOAT_BIT)
+                renderType |= GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT;
             break;
         case __DRI_ATTRIB_CONFIG_CAVEAT:
             if (value & __DRI_ATTRIB_NON_CONFORMANT_CONFIG)
@@ -168,6 +173,9 @@ createModeFromConfig(const __DRIcoreExtension * core,
         }
     }
 
+    if (renderType) /* fbconfig render type are bit fields */
+    config->config.renderType = renderType;
+
     config->config.next = NULL;
     config->config.xRenderable = GL_TRUE;
     config->config.visualType = visualType;
@@ -187,6 +195,12 @@ glxConvertConfigs(const __DRIcoreExtension * core,
     head.next = NULL;
 
     for (i = 0; configs[i]; i++) {
+        /* Add only integer RGB modes as GLX_TRUE_COLOR modes */
+        int renderType = 0;
+        if 
(core->getConfigAttrib(configs[i],__DRI_ATTRIB_RENDER_TYPE,&renderType)) {
+            if ((renderType & __DRI_ATTRIB_RGBA_BIT) == 0) continue;
+        }
+        /* Add all the others */
         tail->next = createModeFromConfig(core,
                                           configs[i], GLX_TRUE_COLOR,
                                           drawableType);
@@ -197,6 +211,13 @@ glxConvertConfigs(const __DRIcoreExtension * core,
     }
 
     for (i = 0; configs[i]; i++) {
+        /* Don't add float modes at all if we don't want pbuffer drawableTypes 
*/
+        int renderType = 0;
+        if 
(core->getConfigAttrib(configs[i],__DRI_ATTRIB_RENDER_TYPE,&renderType)) {
+            if ((renderType & (__DRI_ATTRIB_UNSIGNED_FLOAT_BIT |
+                __DRI_ATTRIB_FLOAT_BIT)) && !(drawableType & GLX_PBUFFER_BIT)) 
continue;
+        }
+        /* Add all the others */
         tail->next = createModeFromConfig(core,
                                           configs[i], GLX_DIRECT_COLOR,
                                           drawableType);
diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c
index 14a4711..e389499 100644
--- a/hw/xwin/glx/indirect.c
+++ b/hw/xwin/glx/indirect.c
@@ -386,7 +386,9 @@ fbConfigsDump(unsigned int n, __GLXconfig * c)
                c->accumAlphaBits, c->sampleBuffers, c->samples,
                (c->drawableType & GLX_WINDOW_BIT) ? "y" : ".",
                (c->drawableType & GLX_PIXMAP_BIT) ? "y" : ".",
-               (c->drawableType & GLX_PBUFFER_BIT) ? "y" : ".", ".",
+               (c->drawableType & GLX_PBUFFER_BIT) ? "y" : ".",
+               (c->renderType & (GLX_RGBA_FLOAT_BIT_ARB |
+                   GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT)) ? "y" : ".",
                (c->transparentPixel != GLX_NONE_EXT) ? "y" : ".",
                c->visualSelectGroup,
                (c->visualRating == GLX_SLOW_VISUAL_EXT) ? "*" : " ");
-- 
1.7.9.5

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to