diff options
author | Keith Packard <keithp@keithp.com> | 2013-10-29 09:37:30 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-10-29 09:37:30 -0700 |
commit | b32a4c91ccd479638c2bd2c0143b6ea170c717d1 (patch) | |
tree | 6fe82e8edeba911311efd01784fa129bb0c7e873 /hw | |
parent | be6680967a479eedbcab2fe1718c5f981e1029c7 (diff) | |
parent | c671e935e7c44d4711ba9588ee96cb9796b879e6 (diff) |
Merge remote-tracking branch 'idr/glx-float-fbconfig'
Diffstat (limited to 'hw')
-rw-r--r-- | hw/dmx/dmx_glxvisuals.c | 7 | ||||
-rw-r--r-- | hw/dmx/glxProxy/glxcmds.c | 42 | ||||
-rw-r--r-- | hw/xwin/glx/indirect.c | 4 |
3 files changed, 44 insertions, 9 deletions
diff --git a/hw/dmx/dmx_glxvisuals.c b/hw/dmx/dmx_glxvisuals.c index 56bd67b6e..b3bd3b79f 100644 --- a/hw/dmx/dmx_glxvisuals.c +++ b/hw/dmx/dmx_glxvisuals.c @@ -448,7 +448,12 @@ GetGLXFBConfigs(Display * dpy, int glxMajorOpcode, int *nconfigs) /* Fill in derived values */ config->screen = screen; - config->rgbMode = config->renderType & GLX_RGBA_BIT; + /* The rgbMode should be true for any mode which has distinguishible + * R, G and B components + */ + config->rgbMode = (config->renderType + & (GLX_RGBA_BIT | GLX_RGBA_FLOAT_BIT_ARB + | GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT)) != 0; config->colorIndexMode = !config->rgbMode; config->haveAccumBuffer = diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c index 335da37ac..190eeefe2 100644 --- a/hw/dmx/glxProxy/glxcmds.c +++ b/hw/dmx/glxProxy/glxcmds.c @@ -123,6 +123,28 @@ GetBackEndDisplay(__GLXclientState * cl, int s) return cl->be_displays[s]; } +/** + * Convert the render type bits from fbconfig into context render type. + */ +static int +renderTypeBitsToRenderTypeEnum(int fbRenderType) +{ + if (fbRenderType & GLX_RGBA_BIT) + return GLX_RGBA_TYPE; + + if (fbRenderType & GLX_COLOR_INDEX_BIT) + return GLX_COLOR_INDEX_TYPE; + + if (fbRenderType & GLX_RGBA_FLOAT_BIT_ARB) + return GLX_RGBA_FLOAT_TYPE_ARB; + + if (fbRenderType & GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT) + return GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT; + + /* There's no recognized renderType in the config */ + return GLX_RGBA_TYPE; +} + /* ** Create a GL context with the given properties. */ @@ -308,12 +330,14 @@ CreateContext(__GLXclientState * cl, /* send the create context request to the back-end server */ dpy = GetBackEndDisplay(cl, screen); if (glxc->pFBConfig) { - /*Since for a certain visual both RGB and COLOR INDEX - *can be on then the only parmeter to choose the renderType - * should be the class of the colormap since all 4 first - * classes does not support RGB mode only COLOR INDEX , - * and so TrueColor and DirectColor does not support COLOR INDEX*/ - int renderType = glxc->pFBConfig->renderType; + /* For a specific visual, multiple render types (i.e., both RGB + * and COLOR INDEX) can be accessible. The only parameter to + * choose the renderType should be the class of the colormap, + * since the first classes do not support RGB mode (only COLOR + * INDEX), and TrueColor and DirectColor do not support COLOR + * INDEX. + */ + int renderType = GLX_RGBA_TYPE; if (pVisual) { switch (pVisual->class) { @@ -329,7 +353,11 @@ CreateContext(__GLXclientState * cl, renderType = GLX_RGBA_TYPE; break; } + } else { + renderType = + renderTypeBitsToRenderTypeEnum(glxc->pFBConfig->renderType); } + if (__GLX_IS_VERSION_SUPPORTED(1, 3)) { LockDisplay(dpy); GetReq(GLXCreateNewContext, be_new_req); @@ -3210,7 +3238,7 @@ __glXQueryContext(__GLXclientState * cl, GLbyte * pc) *pSendBuf++ = GLX_FBCONFIG_ID; *pSendBuf++ = (int) (ctx->pFBConfig->id); *pSendBuf++ = GLX_RENDER_TYPE; - *pSendBuf++ = (int) (ctx->pFBConfig->renderType); + *pSendBuf++ = renderTypeBitsToRenderTypeEnum(ctx->pFBConfig->renderType); *pSendBuf++ = GLX_SCREEN; *pSendBuf++ = (int) (ctx->pScreen->myNum); diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c index b79f023cd..4f09652f0 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) ? "*" : " "); |