[cairo] [PATCH] gl: Draw image surface to fbo gl surface using intermediate texture

Dongyeon Kim dy5.kim at samsung.com
Thu Nov 15 23:51:51 PST 2012

It is fine to set the FBO content using glTex(Sub)Image2D before the texture is bound to the framebuffer.
But what the current implementation does is that after the texture has been bound to the framebuffer to be 
the rendering target, cairo again binds the same texture as the rendering source and uploads data.
As I know this falls into a rendering feedback loop.

According to the OpenGL ES spec, a feedback loop may exist when a texture object is used as both the source and
destination of a GL operation, and when a feedback loop exists, undefined behavior results.

I will check again whether this is the driver-specific issue.

------- Original Message -------
Sender : Eric Anholt<eric at anholt.net>
Date : 2012-11-16 15:42 (GMT+09:00)
Title : Re: [cairo] [PATCH] gl: Draw image surface to fbo gl surface using intermediate texture

Dongyeon Kim writes:

> Hello,
> When I create an image surface from png, and use this surface as
> source to paint to cairo gl surface that is created using FBO, the
> resulting gl surface is just black.
> I have spent some time investigating this, and found that cairo was
> uploading data to the texture that is currently being used as target
> framebuffer.
> To fix this problem, image data should be uploaded to an intermediate
> texture, and this texture should be rendered into the FBO.
> The following patch is a suggested fix for both gl-spans and gl-traps
> compositors.

Huh?  Using glTexImage to set the contents of an FBO sounds perfectly
legal and should have expected behavior.  This sounds like a driver bug.

More information about the cairo mailing list