Initialize GLX_EXT_texture_from_pixmap attributes correctly.
authorKristian Høgsberg <krh@redhat.com>
Wed, 2 Apr 2008 23:04:57 +0000 (19:04 -0400)
committerKristian Høgsberg <krh@redhat.com>
Wed, 2 Apr 2008 23:05:43 +0000 (19:05 -0400)
src/glx/x11/dri_glx.c
src/mesa/drivers/dri/common/dri_util.c
src/mesa/drivers/dri/common/utils.c

index 31ade0da2a3e4a0d0b5db9b004c281b9bafb54e7..004af0bf3c1daf8eda495f897ff5881e28c0a542 100644 (file)
@@ -508,11 +508,11 @@ static const struct { unsigned int attrib, offset; } attribMap[] = {
     __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT,      optimalPbufferHeight),
 #if 0
     __ATTRIB(__DRI_ATTRIB_SWAP_METHOD,                 swapMethod),
+#endif
     __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB,         bindToTextureRgb),
     __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGBA,                bindToTextureRgba),
     __ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE,      bindToMipmapTexture),
     __ATTRIB(__DRI_ATTRIB_YINVERTED,                   yInverted),
-#endif
 };
 
 #define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
@@ -564,8 +564,6 @@ driConfigEqual(const __DRIcoreExtension *core,
                return GL_FALSE;
            break;
 
-#if 0
-       /* The X server doesn't send these, so ignore them for now. */
        case __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS:
            glxValue = 0;
            if (value & __DRI_ATTRIB_TEXTURE_1D_BIT)
@@ -577,7 +575,6 @@ driConfigEqual(const __DRIcoreExtension *core,
            if (glxValue != modes->bindToTextureTargets)
                return GL_FALSE;
            break;      
-#endif
 
        default:
            if (!scalarEqual(modes, attrib, value))
index daf1d56feb9ac691f03d8f3a7e73b9fd9cea361d..b7718f50fd786671688c31b7c3f5c5ecda848547 100644 (file)
@@ -1006,6 +1006,7 @@ static const struct { unsigned int attrib, offset; } attribMap[] = {
     __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB,         bindToTextureRgb),
     __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGBA,                bindToTextureRgba),
     __ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE,      bindToMipmapTexture),
+    __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS,     bindToTextureTargets),
     __ATTRIB(__DRI_ATTRIB_YINVERTED,                   yInverted),
 
     /* The struct field doesn't matter here, these are handled by the
@@ -1013,7 +1014,6 @@ static const struct { unsigned int attrib, offset; } attribMap[] = {
      * so the iterator includes them though.*/
     __ATTRIB(__DRI_ATTRIB_RENDER_TYPE,                 level),
     __ATTRIB(__DRI_ATTRIB_CONFIG_CAVEAT,               level),
-    __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS,     level),
     __ATTRIB(__DRI_ATTRIB_SWAP_METHOD,                 level)
 };
 
@@ -1038,15 +1038,6 @@ driGetConfigAttribIndex(const __DRIconfig *config,
        else
            *value = 0;
        break;
-    case __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS:
-       *value = 0;
-       if (config->modes.bindToTextureTargets & GLX_TEXTURE_1D_BIT_EXT)
-           *value |= __DRI_ATTRIB_TEXTURE_1D_BIT;
-       if (config->modes.bindToTextureTargets & GLX_TEXTURE_2D_BIT_EXT)
-           *value |= __DRI_ATTRIB_TEXTURE_2D_BIT;
-       if (config->modes.bindToTextureTargets & GLX_TEXTURE_RECTANGLE_BIT_EXT)
-           *value |= __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT;
-       break;
     case __DRI_ATTRIB_SWAP_METHOD:
        break;
 
index 1839ef935a1b50fd1544669e9d187f603472ee60..237d51cf22b2bf05c4fdd606665223cc153e6249 100644 (file)
@@ -713,6 +713,15 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
                                           modes->accumAlphaBits) > 0);
                modes->haveDepthBuffer = (modes->depthBits > 0);
                modes->haveStencilBuffer = (modes->stencilBits > 0);
+
+               modes->bindToTextureRgb = GL_TRUE;
+               modes->bindToTextureRgba = GL_TRUE;
+               modes->bindToMipmapTexture = GL_FALSE;
+               modes->bindToTextureTargets = modes->rgbMode ?
+                   __DRI_ATTRIB_TEXTURE_1D_BIT |
+                   __DRI_ATTRIB_TEXTURE_2D_BIT |
+                   __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT :
+                   0;
            }
        }
     }