From b2839193987ff20438a52d124001f3b310c32315 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Wed, 14 Aug 2019 13:06:37 -0400 Subject: [PATCH] glx: Eliminate glx_config::{rgb,float,colorIndex}Mode These are redundant with glx_config::renderType, let's just use that consistently. --- src/glx/glxcmds.c | 14 -------------- src/glx/glxconfig.c | 2 +- src/glx/glxconfig.h | 3 --- src/glx/glxext.c | 27 ++++++++------------------- 4 files changed, 9 insertions(+), 37 deletions(-) diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c index e3f4bc3acac..8927976f587 100644 --- a/src/glx/glxcmds.c +++ b/src/glx/glxcmds.c @@ -462,19 +462,6 @@ glXCreateContext(Display * dpy, XVisualInfo * vis, renderType = GLX_RGBA_TYPE; } else if (config->renderType & GLX_COLOR_INDEX_BIT) { renderType = GLX_COLOR_INDEX_TYPE; - } else if (config->rgbMode) { - /* If we're here, then renderType is not set correctly. Let's use a - * safeguard - any TrueColor or DirectColor mode is RGB mode. Such - * default value is needed by old DRI drivers, which didn't set - * renderType correctly as the value was just ignored. - */ - renderType = GLX_RGBA_TYPE; - } else { - /* Safeguard - only one option left, all non-RGB modes are indexed - * modes. Again, this allows drivers with invalid renderType to work - * properly. - */ - renderType = GLX_COLOR_INDEX_TYPE; } #endif @@ -936,7 +923,6 @@ init_fbconfig_for_chooser(struct glx_config * config, * glXChooseVisual. */ if (fbconfig_style_tags) { - config->rgbMode = GL_TRUE; config->doubleBufferMode = GLX_DONT_CARE; config->renderType = GLX_RGBA_BIT; } diff --git a/src/glx/glxconfig.c b/src/glx/glxconfig.c index 003b5c8e6ed..569d24bfac5 100644 --- a/src/glx/glxconfig.c +++ b/src/glx/glxconfig.c @@ -59,7 +59,7 @@ glx_config_get(struct glx_config * mode, int attribute, int *value_return) *value_return = mode->rgbBits; return 0; case GLX_RGBA: - *value_return = mode->rgbMode; + *value_return = !(mode->renderType & GLX_COLOR_INDEX_BIT); return 0; case GLX_RED_SIZE: *value_return = mode->redBits; diff --git a/src/glx/glxconfig.h b/src/glx/glxconfig.h index 10d7dbaa087..b8e9271daff 100644 --- a/src/glx/glxconfig.h +++ b/src/glx/glxconfig.h @@ -33,9 +33,6 @@ struct glx_config { struct glx_config * next; - GLboolean rgbMode; - GLboolean floatMode; - GLboolean colorIndexMode; GLuint doubleBufferMode; GLuint stereoMode; diff --git a/src/glx/glxext.c b/src/glx/glxext.c index cef81920356..f6ee0ed661d 100644 --- a/src/glx/glxext.c +++ b/src/glx/glxext.c @@ -367,7 +367,6 @@ __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 */ @@ -375,7 +374,7 @@ __glXInitializeVisualConfigFromTags(struct glx_config * config, int count, config->visualType = convert_from_x_visual_type(*bp++); - config->rgbMode = *bp++; + config->renderType = *bp++ ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT; config->redBits = *bp++; config->greenBits = *bp++; @@ -419,7 +418,10 @@ __glXInitializeVisualConfigFromTags(struct glx_config * config, int count, switch (tag) { case GLX_RGBA: - FETCH_OR_SET(rgbMode); + if (fbconfig_style_tags) + config->renderType = *bp++ ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT; + else + config->renderType = GLX_RGBA_BIT; break; case GLX_BUFFER_SIZE: config->rgbBits = *bp++; @@ -501,7 +503,7 @@ __glXInitializeVisualConfigFromTags(struct glx_config * config, int count, #endif break; case GLX_RENDER_TYPE: /* fbconfig render type bits */ - renderType = *bp++; + config->renderType = *bp++; break; case GLX_X_RENDERABLE: config->xRenderable = *bp++; @@ -594,26 +596,13 @@ __glXInitializeVisualConfigFromTags(struct glx_config * config, int count, } } - 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) + if (config->renderType & + (GLX_RGBA_FLOAT_BIT_ARB|GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT)) config->drawableType &= GLX_PBUFFER_BIT; } -- 2.30.2