summaryrefslogtreecommitdiff
path: root/src/glx
diff options
context:
space:
mode:
authorMichel Dänzer <michel@tungstengraphics.com>2008-04-10 15:45:52 -0400
committerKristian Høgsberg <krh@redhat.com>2008-04-10 15:47:46 -0400
commit23635510e3333ea8056311afa741c5e6d7c9ec15 (patch)
treee28d28e3eb00b616e432cffdd7fa5877548b6940 /src/glx
parent842b8b4c336657f717ee8d47fd4918be84a92d48 (diff)
Get the default GLXPixmap texture target from the server when appropriate.
Fixes compiz with direct rendering when both GLX_TEXTURE_2D_EXT and GLX_TEXTURE_RECTANGLE_EXT are supported for a GLXPixmap and the application didn't specify the texture target as a GLX drawable attribute when creating the GLX drawable.
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/x11/glx_pbuffer.c64
1 files changed, 37 insertions, 27 deletions
diff --git a/src/glx/x11/glx_pbuffer.c b/src/glx/x11/glx_pbuffer.c
index b0a8f71fd4..08743e560f 100644
--- a/src/glx/x11/glx_pbuffer.c
+++ b/src/glx/x11/glx_pbuffer.c
@@ -164,6 +164,33 @@ DestroyPbuffer( Display * dpy, GLXDrawable drawable )
}
+#ifdef GLX_DIRECT_RENDERING
+extern __GLXDRIdrawable *
+GetGLXDRIDrawable(Display *dpy, GLXDrawable drawable, int * const scrn_num);
+
+static GLenum
+determineTextureTarget(const int *attribs, int numAttribs)
+{
+ GLenum target = 0;
+ int i;
+
+ for (i = 0; i < numAttribs; i++) {
+ if (attribs[2 * i] == GLX_TEXTURE_TARGET_EXT) {
+ switch (attribs[2 * i + 1]) {
+ case GLX_TEXTURE_2D_EXT:
+ target = GL_TEXTURE_2D;
+ break;
+ case GLX_TEXTURE_RECTANGLE_EXT:
+ target = GL_TEXTURE_RECTANGLE_ARB;
+ break;
+ }
+ }
+ }
+
+ return target;
+}
+#endif
+
/**
* Get a drawable's attribute.
*
@@ -261,6 +288,16 @@ GetDrawableAttribute( Display *dpy, GLXDrawable drawable,
}
}
+#ifdef GLX_DIRECT_RENDERING
+ {
+ __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL);
+
+ if (pdraw != NULL && !pdraw->textureTarget)
+ pdraw->textureTarget = determineTextureTarget(data,
+ num_attributes);
+ }
+#endif
+
Xfree( data );
}
}
@@ -271,33 +308,6 @@ GetDrawableAttribute( Display *dpy, GLXDrawable drawable,
return 0;
}
-#ifdef GLX_DIRECT_RENDERING
-extern __GLXDRIdrawable *
-GetGLXDRIDrawable(Display *dpy, GLXDrawable drawable, int * const scrn_num);
-
-static GLenum
-determineTextureTarget(const int *attribs, int numAttribs)
-{
- GLenum target = 0;
- int i;
-
- for (i = 0; i < numAttribs; i++) {
- if (attribs[2 * i] == GLX_TEXTURE_TARGET_EXT) {
- switch (attribs[2 * i + 1]) {
- case GLX_TEXTURE_2D_EXT:
- target = GL_TEXTURE_2D;
- break;
- case GLX_TEXTURE_RECTANGLE_EXT:
- target = GL_TEXTURE_RECTANGLE_ARB;
- break;
- }
- }
- }
-
- return target;
-}
-#endif
-
/**
* Create a non-pbuffer GLX drawable.
*