glx: Correctly set render type enum

The type specified is bits, but the context wants an enum.

v2 (idr): Fix various whitespace and formatting problems.  Rename
convFBconfRenderTypeBits2CtxRenderType to
renderTypeBitsToRenderTypeEnum.  Re-write commit message.

Signed-off-by: Daniel Czarnowski <daniel.czarnowski@intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Daniel Czarnowski 2013-10-21 19:57:53 +02:00 committed by Ian Romanick
parent eabb523aa4
commit 4e5eb15b4c
2 changed files with 41 additions and 8 deletions

View File

@ -448,7 +448,12 @@ GetGLXFBConfigs(Display * dpy, int glxMajorOpcode, int *nconfigs)
/* Fill in derived values */ /* Fill in derived values */
config->screen = screen; 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->colorIndexMode = !config->rgbMode;
config->haveAccumBuffer = config->haveAccumBuffer =

View File

@ -123,6 +123,28 @@ GetBackEndDisplay(__GLXclientState * cl, int s)
return cl->be_displays[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. ** 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 */ /* send the create context request to the back-end server */
dpy = GetBackEndDisplay(cl, screen); dpy = GetBackEndDisplay(cl, screen);
if (glxc->pFBConfig) { if (glxc->pFBConfig) {
/*Since for a certain visual both RGB and COLOR INDEX /* For a specific visual, multiple render types (i.e., both RGB
*can be on then the only parmeter to choose the renderType * and COLOR INDEX) can be accessible. The only parameter to
* should be the class of the colormap since all 4 first * choose the renderType should be the class of the colormap,
* classes does not support RGB mode only COLOR INDEX , * since the first classes do not support RGB mode (only COLOR
* and so TrueColor and DirectColor does not support COLOR INDEX*/ * INDEX), and TrueColor and DirectColor do not support COLOR
int renderType = glxc->pFBConfig->renderType; * INDEX.
*/
int renderType = GLX_RGBA_TYPE;
if (pVisual) { if (pVisual) {
switch (pVisual->class) { switch (pVisual->class) {
@ -329,7 +353,11 @@ CreateContext(__GLXclientState * cl,
renderType = GLX_RGBA_TYPE; renderType = GLX_RGBA_TYPE;
break; break;
} }
} else {
renderType =
renderTypeBitsToRenderTypeEnum(glxc->pFBConfig->renderType);
} }
if (__GLX_IS_VERSION_SUPPORTED(1, 3)) { if (__GLX_IS_VERSION_SUPPORTED(1, 3)) {
LockDisplay(dpy); LockDisplay(dpy);
GetReq(GLXCreateNewContext, be_new_req); GetReq(GLXCreateNewContext, be_new_req);
@ -3210,7 +3238,7 @@ __glXQueryContext(__GLXclientState * cl, GLbyte * pc)
*pSendBuf++ = GLX_FBCONFIG_ID; *pSendBuf++ = GLX_FBCONFIG_ID;
*pSendBuf++ = (int) (ctx->pFBConfig->id); *pSendBuf++ = (int) (ctx->pFBConfig->id);
*pSendBuf++ = GLX_RENDER_TYPE; *pSendBuf++ = GLX_RENDER_TYPE;
*pSendBuf++ = (int) (ctx->pFBConfig->renderType); *pSendBuf++ = renderTypeBitsToRenderTypeEnum(ctx->pFBConfig->renderType);
*pSendBuf++ = GLX_SCREEN; *pSendBuf++ = GLX_SCREEN;
*pSendBuf++ = (int) (ctx->pScreen->myNum); *pSendBuf++ = (int) (ctx->pScreen->myNum);