glx: Eliminate glx_config::{rgb,float,colorIndex}Mode
authorAdam Jackson <ajax@redhat.com>
Wed, 14 Aug 2019 17:06:37 +0000 (13:06 -0400)
committerAdam Jackson <ajax@redhat.com>
Tue, 20 Aug 2019 18:05:07 +0000 (14:05 -0400)
These are redundant with glx_config::renderType, let's just use that
consistently.

src/glx/glxcmds.c
src/glx/glxconfig.c
src/glx/glxconfig.h
src/glx/glxext.c

index e3f4bc3acac33c69c1bb96370f727b52acdb5329..8927976f587bfafd30db115290ce3d2ef0be3a7b 100644 (file)
@@ -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;
        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
 
    }
 #endif
 
@@ -936,7 +923,6 @@ init_fbconfig_for_chooser(struct glx_config * config,
     * glXChooseVisual.
     */
    if (fbconfig_style_tags) {
     * glXChooseVisual.
     */
    if (fbconfig_style_tags) {
-      config->rgbMode = GL_TRUE;
       config->doubleBufferMode = GLX_DONT_CARE;
       config->renderType = GLX_RGBA_BIT;
    }
       config->doubleBufferMode = GLX_DONT_CARE;
       config->renderType = GLX_RGBA_BIT;
    }
index 003b5c8e6edc0146d2e5aa94339e8616dedb7372..569d24bfac56b6de0f8ca366c3c2e2167545cad9 100644 (file)
@@ -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->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;
       return 0;
    case GLX_RED_SIZE:
       *value_return = mode->redBits;
index 10d7dbaa0874c3cc4b29c3a12e8b1cf332c008cf..b8e9271daff6b977409a031bc1bb7c2a0d066bd3 100644 (file)
@@ -33,9 +33,6 @@
 struct glx_config {
     struct glx_config * next;
 
 struct glx_config {
     struct glx_config * next;
 
-    GLboolean rgbMode;
-    GLboolean floatMode;
-    GLboolean colorIndexMode;
     GLuint doubleBufferMode;
     GLuint stereoMode;
 
     GLuint doubleBufferMode;
     GLuint stereoMode;
 
index cef81920356e8a69f7a27ef9239fb915611cbe42..f6ee0ed661d571d2caeada6bc98c61e9e4d19cff 100644 (file)
@@ -367,7 +367,6 @@ __glXInitializeVisualConfigFromTags(struct glx_config * config, int count,
                                     Bool fbconfig_style_tags)
 {
    int i;
                                     Bool fbconfig_style_tags)
 {
    int i;
-   GLint renderType = 0;
 
    if (!tagged_only) {
       /* Copy in the first set of properties */
 
    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->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++;
 
       config->redBits = *bp++;
       config->greenBits = *bp++;
@@ -419,7 +418,10 @@ __glXInitializeVisualConfigFromTags(struct glx_config * config, int count,
       
       switch (tag) {
       case GLX_RGBA:
       
       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++;
          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 */
 #endif
          break;
       case GLX_RENDER_TYPE: /* fbconfig render type bits */
-         renderType = *bp++;
+         config->renderType = *bp++;
          break;
       case GLX_X_RENDERABLE:
          config->xRenderable = *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."
     */
    /* 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;
 }
 
       config->drawableType &= GLX_PBUFFER_BIT;
 }