diff --git a/configure.ac b/configure.ac
index d5c0791..5374460 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,7 +32,7 @@ dnl protocol, so Xcomposite version l.n.m corresponds to protocol version l.n
 dnl that 'revision' number appears in Xcomposite.h and has to be manually
 dnl synchronized.
 dnl
-AC_INIT(libXcomposite, 0.4.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], libXcomposite)
+AC_INIT(libXcomposite, 0.5.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], libXcomposite)
 AM_INIT_AUTOMAKE([dist-bzip2])
 AM_MAINTAINER_MODE
 
@@ -61,7 +61,7 @@ if test "$VERSION" = "" ; then
 fi
 COMPOSITEEXT_VERSION=[`echo $VERSION | sed 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`]
 AC_SUBST(COMPOSITEEXT_VERSION)
-PKG_CHECK_MODULES(XCOMPOSITE, [compositeproto >= $COMPOSITEEXT_VERSION] x11 xfixes xext fixesproto)
+PKG_CHECK_MODULES(XCOMPOSITE, [compositeproto >= $COMPOSITEEXT_VERSION] x11 xfixes xext fixesproto xrender renderproto)
 XCOMPOSITE_CFLAGS="$CWARNFLAGS $XCOMPOSITE_CFLAGS"
 AC_SUBST(XCOMPOSITE_CFLAGS)
 AC_SUBST(XCOMPOSITE_LIBS)
diff --git a/include/X11/extensions/Xcomposite.h b/include/X11/extensions/Xcomposite.h
index b97e390..a6a70c5 100644
--- a/include/X11/extensions/Xcomposite.h
+++ b/include/X11/extensions/Xcomposite.h
@@ -45,6 +45,7 @@
 
 #include <X11/extensions/composite.h>
 #include <X11/extensions/Xfixes.h>
+#include <X11/extensions/Xrender.h>
 #include <X11/Xfuncproto.h>
 
 /*
@@ -92,6 +93,12 @@ XCompositeGetOverlayWindow (Display *dpy, Window window);
 void
 XCompositeReleaseOverlayWindow (Display *dpy, Window window);
 
+void
+XCompositeSetTriangularCoordinateMesh (Display		  *dpy,
+				       Window		  window,
+				       _Xconst XTriangle *triangle,
+				       int		  nTriangle);
+
 _XFUNCPROTOEND
 
 #endif /* _XCOMPOSITE_H_ */
diff --git a/src/Xcomposite.c b/src/Xcomposite.c
index b5637b0..ff2d741 100644
--- a/src/Xcomposite.c
+++ b/src/Xcomposite.c
@@ -393,3 +393,42 @@ XCompositeReleaseOverlayWindow (Display *dpy, Window window)
     UnlockDisplay (dpy);
     SyncHandle ();
 }
+
+
+void
+XCompositeSetTriangularCoordinateMesh (Display		  *dpy,
+				       Window		  window,
+				       _Xconst XTriangle *triangle,
+				       int		  nTriangle)
+{
+    XCompositeExtDisplayInfo *info = XCompositeFindDisplay (dpy);
+    xCompositeSetTriangularCoordinateMeshReq *req;
+    int					     n;
+    long				     len;
+
+    XCompositeSimpleCheckExtension (dpy, info);
+    LockDisplay (dpy);
+    while (nTriangle)
+    {
+	GetReq (CompositeSetTriangularCoordinateMesh, req);
+	req->reqType = info->codes->major_opcode;
+	req->compositeReqType = X_CompositeSetTriangularCoordinateMesh;
+	req->window = window;
+	n = nTriangle;
+	len = ((long) n) * (SIZEOF (xTriangle) >> 2);
+	if (!dpy->bigreq_size && len > (dpy->max_request_size - req->length))
+	{
+	    n = (dpy->max_request_size - req->length) /
+		(SIZEOF (xTriangle) >> 2);
+	    len = ((long) n) * (SIZEOF (xTriangle) >> 2);
+	}
+	SetReqLen (req, len, len);
+	len <<= 2;
+	DataInt32 (dpy, (int *) triangle, len);
+	nTriangle -= n;
+	triangle  += n;
+    }
+    UnlockDisplay (dpy);
+    SyncHandle ();
+}
+
diff --git a/src/xcompositeint.h b/src/xcompositeint.h
index 7f0f868..3f5745e 100644
--- a/src/xcompositeint.h
+++ b/src/xcompositeint.h
@@ -49,6 +49,7 @@
 #include <X11/Xlib.h>
 #include <X11/Xlibint.h>
 #include <X11/Xutil.h>
+#include <X11/extensions/renderproto.h>
 #include <X11/extensions/compositeproto.h>
 #include <X11/extensions/Xcomposite.h>
 
@@ -81,4 +82,17 @@ XCompositeFindDisplay (Display *dpy);
 #define XCompositeSimpleCheckExtension(dpy,i) \
   if (!XCompositeHasExtension(i)) { return; }
 
+
+/*
+ * Xlib uses long for 32-bit values.  Xcomposite uses int.  This
+ * matters on alpha.  Note that this macro assumes that int is 32 bits
+ * except on WORD64 machines where it is 64 bits.
+ */
+
+#ifdef WORD64
+#define DataInt32(dpy,d,len)	Data32(dpy,(long *) (d),len)
+#else
+#define DataInt32(dpy,d,len)	Data(dpy,(char *) (d),len)
+#endif
+
 #endif /* _XCOMPOSITEINT_H_ */
