diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c
index 004af0b..8c3307e 100644
--- a/src/glx/x11/dri_glx.c
+++ b/src/glx/x11/dri_glx.c
@@ -526,6 +526,8 @@ scalarEqual(__GLcontextModes *mode, unsigned int attrib, unsigned int value)
     for (i = 0; i < ARRAY_SIZE(attribMap); i++)
 	if (attribMap[i].attrib == attrib) {
 	    driValue = *(unsigned int *) ((char *) mode + attribMap[i].offset);
+	    if (driValue == GLX_DONT_CARE)
+		return GL_TRUE;
 	    return driValue == value;
 	}
 
@@ -572,7 +574,7 @@ driConfigEqual(const __DRIcoreExtension *core,
 		glxValue |= GLX_TEXTURE_2D_BIT_EXT;
 	    if (value & __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT)
 		glxValue |= GLX_TEXTURE_RECTANGLE_BIT_EXT;
-	    if (glxValue != modes->bindToTextureTargets)
+	    if (glxValue != modes->bindToTextureTargets && modes->bindToTextureTargets != GLX_DONT_CARE)
 		return GL_FALSE;
 	    break;	
 
diff --git a/src/glx/x11/glcontextmodes.c b/src/glx/x11/glcontextmodes.c
index 58c548a..2a8e48d 100644
--- a/src/glx/x11/glcontextmodes.c
+++ b/src/glx/x11/glcontextmodes.c
@@ -415,7 +415,7 @@ _gl_context_modes_create( unsigned count, size_t minimum_size )
       (*next)->bindToTextureRgb = GLX_DONT_CARE;
       (*next)->bindToTextureRgba = GLX_DONT_CARE;
       (*next)->bindToMipmapTexture = GLX_DONT_CARE;
-      (*next)->bindToTextureTargets = 0;
+      (*next)->bindToTextureTargets = GLX_DONT_CARE;
       (*next)->yInverted = GLX_DONT_CARE;
 
       next = & ((*next)->next);
