summaryrefslogtreecommitdiffstats
path: root/src/glx
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2009-03-18 12:07:09 -0700
committerEric Anholt <[email protected]>2009-03-20 10:41:28 -0700
commit66175aac7609ad314f25fbdff0d3958af310dc24 (patch)
treec8b80a86679d765d76285f5f98f97d6276ddc167 /src/glx
parentcf0122e892df56bc3b013e5d92e487d0fd65f23d (diff)
Fix DRI2 accelerated EXT_texture_from_pixmap with GL_RGB format.
This requires upgrading the interface so that the argument to glXBindTexImageEXT isn't just dropped on the floor. Note that this only fixes the accelerated path on Intel, as Mesa's texture format support is missing x8r8g8b8 support (right now, GL_RGB textures get uploaded as a8r8gb8, but in this case we're not doing the upload so we can't really work around it that way). Fixes bugs with compositors trying to use shaders that use alpha channels, on windows without a valid alpha channel. Bug #19910 and likely others as well. Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/x11/glx_pbuffer.c19
-rw-r--r--src/glx/x11/glxclient.h1
-rw-r--r--src/glx/x11/glxcmds.c18
3 files changed, 33 insertions, 5 deletions
diff --git a/src/glx/x11/glx_pbuffer.c b/src/glx/x11/glx_pbuffer.c
index a602cd28817..6bcf965056a 100644
--- a/src/glx/x11/glx_pbuffer.c
+++ b/src/glx/x11/glx_pbuffer.c
@@ -189,6 +189,21 @@ determineTextureTarget(const int *attribs, int numAttribs)
return target;
}
+
+
+static GLenum
+determineTextureFormat(const int *attribs, int numAttribs)
+{
+ GLenum target = 0;
+ int i;
+
+ for (i = 0; i < numAttribs; i++) {
+ if (attribs[2 * i] == GLX_TEXTURE_FORMAT_EXT)
+ return attribs[2 * i + 1];
+ }
+
+ return 0;
+}
#endif
/**
@@ -294,6 +309,9 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
if (pdraw != NULL && !pdraw->textureTarget)
pdraw->textureTarget =
determineTextureTarget((const int *) data, num_attributes);
+ if (pdraw != NULL && !pdraw->textureFormat)
+ pdraw->textureFormat =
+ determineTextureFormat((const int *) data, num_attributes);
}
#endif
@@ -374,6 +392,7 @@ CreateDrawable(Display * dpy, const __GLcontextModes * fbconfig,
}
pdraw->textureTarget = determineTextureTarget(attrib_list, i);
+ pdraw->textureFormat = determineTextureFormat(attrib_list, i);
} while (0);
#endif
diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h
index caf58bbd44a..c42e80a0e86 100644
--- a/src/glx/x11/glxclient.h
+++ b/src/glx/x11/glxclient.h
@@ -161,6 +161,7 @@ struct __GLXDRIdrawableRec {
__GLXscreenConfigs *psc;
GLenum textureTarget;
__DRIdrawable *driDrawable;
+ GLenum textureFormat; /* EXT_texture_from_pixmap support */
};
/*
diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c
index fc0e593cb35..e5c0db4c968 100644
--- a/src/glx/x11/glxcmds.c
+++ b/src/glx/x11/glxcmds.c
@@ -2631,11 +2631,19 @@ static void __glXBindTexImageEXT(Display *dpy,
if (gc->driContext) {
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL);
- if (pdraw != NULL)
- (*pdraw->psc->texBuffer->setTexBuffer)(gc->__driContext,
- pdraw->textureTarget,
- pdraw->driDrawable);
-
+ if (pdraw != NULL) {
+ if (pdraw->psc->texBuffer->base.version >= 2 &&
+ pdraw->psc->texBuffer->setTexBuffer2 != NULL) {
+ (*pdraw->psc->texBuffer->setTexBuffer2)(gc->__driContext,
+ pdraw->textureTarget,
+ pdraw->textureFormat,
+ pdraw->driDrawable);
+ } else {
+ (*pdraw->psc->texBuffer->setTexBuffer)(gc->__driContext,
+ pdraw->textureTarget,
+ pdraw->driDrawable);
+ }
+ }
return;
}
#endif