[cairo] [PATCH] Add GLESv2 support to the GL backend

Alexandros Frantzis alexandros.frantzis at linaro.org
Fri Mar 4 16:53:34 PST 2011


Hi all!

This patchset adds the final bits for the GLESv2 support to the cairo GL
backend!

The GL and GLESv2 backends coexist happily in the source code. Although
one needs to compile and link against a specific GL flavor, selection of
the backend to use is actually done at runtime. This is done to
facilitate the possible future use of a GL proxy library that enables
dynamic linking against either libGL or GLESv2 without explicit
relinking of the program.

The only exception to the runtime selection are the glDrawBuffer and
glReadBuffer functions which are included (or not) at build time. This,
too, can be handled with some more effort (dl and friends is an option),
although it is not currently a priority.

Also, note that due to the GLES2 constraints on pixel formats, the
GLESv2 backend is currently functional only on little-endian
architectures. See revisions:
gl: Add support for creating image surfaces for GLES2
gl: Add GLES2 support for drawing image surfaces on gl surfaces

Special care has been taken to keep Desktop GL functional and without
regressions at every point in the patchset. In the unlikely case you
find an issue please let me know.

At this point, on my system, the GLESv2 backend behaves as well as the
GL backend in the cairo test suite. I am getting just two additional
crashes, in pattern-getters and solid-pattern-cache-stress in the
function _pixel_to_solid(). This happens because due to the GLES2 pixel
format constraints, we sometimes need to use pixman formats that cannot
be mapped to cairo formats.

Performance-wise the GLESv2 backend performs as well as the GL backend
in a few benchmarks I tried (eg firefox-talos-gfx). My hardware
collection is quite limited, so I would be very interested to know how
well the GLESv2 backend runs on other configurations.

I haven't sent the individual patches to the mailing list, because I
wasn't sure if such a large volume of emails would be appropriate.
However, if there is no issue with that and people feel it would be
easier for them to review this way, I would be happy to send them.

The patchset can be found at:

http://git.linaro.org/gitweb?p=people/afrantzis/cairo.git;a=shortlog;h=refs/heads/gles2

git://git.linaro.org/people/afrantzis/cairo.git

Enjoy!

Alexandros Frantzis (18):
  gl: Correctly extract GL version from OpenGL ES version strings
  gl: Add function to query the GL flavor (Desktop or ES)
  gl: Store the GL flavor in the context struct.
  gl: Add GLES2 support to dispatch table initialization
  gl: Pass more information to the shader emitter functions
  gl: Add functions to get the filter and extend of gl operands.
  gl: Provide a shader implementation of GL_CLAMP_TO_BORDER for GLES2
  gl: Store gradients in 2D textures of height 1 instead of 1D textures
  gl: Require the GL_EXT_texture_format_BGRA8888 extension for GLES2
  gl: Use conventional texture upload for GLES2
  gl: Add support for creating image surfaces for GLES2
  gl: Add GLES2 support for drawing image surfaces on gl surfaces
  gl: Remove unnecessary call to glDisableClientState()
  gl: Use GL_MAX_TEXTURE_IMAGE_UNITS to query the maximum texture units
  gl: Require the GL_OES_texture_npot extension for GLES2
  gl: Add GLESv2 backend to build system
  gl: Fix build issues for GLES2
  boilerplate/egl: Add GLES2 support

 boilerplate/Makefile.win32.features |   12 ++
 boilerplate/cairo-boilerplate-egl.c |   22 +++-
 build/Makefile.win32.features       |    1 +
 build/Makefile.win32.features-h     |    3 +
 build/configure.ac.features         |    1 +
 configure.ac                        |   14 ++
 src/Makefile.sources                |    4 +
 src/Makefile.win32.features         |   16 ++
 src/cairo-gl-composite.c            |  104 ++++++++++++--
 src/cairo-gl-device.c               |   37 ++++--
 src/cairo-gl-dispatch-private.h     |   30 +++--
 src/cairo-gl-dispatch.c             |  105 +++++++++----
 src/cairo-gl-ext-def-private.h      |   44 ++++++
 src/cairo-gl-gradient-private.h     |    5 +
 src/cairo-gl-gradient.c             |   59 +++++--
 src/cairo-gl-info.c                 |   22 +++-
 src/cairo-gl-private.h              |   35 ++++-
 src/cairo-gl-shaders.c              |  271 +++++++++++++++++++++++++++-------
 src/cairo-gl-surface.c              |  284 +++++++++++++++++++++++++++++++----
 src/cairo-gl.h                      |    2 +-
 20 files changed, 899 insertions(+), 172 deletions(-)

-- 
1.7.4.1



More information about the cairo mailing list