[cairo] [PATCH 0/2] gl: Provide a shader implementation of repeat wrap modes

alexandros.frantzis at linaro.org alexandros.frantzis at linaro.org
Thu May 3 03:03:25 PDT 2012


From: Alexandros Frantzis <alexandros.frantzis at linaro.org>

Hi all,

this patchset adds a shader-side implementation of repeat wrap modes in the,
for use by platforms not supporting repeat modes with NPOT textures
(GL_OES_texture_npot) natively, like current generation SGX and Tegra.

It works by wrapping the coordinate argument of texture2D() calls with a
source_wrap()/mask_wrap() function call. Depending on whether the context
supports wrap repeat mode for NPOT textures and a repeat/reflect cairo extend
mode is requested, or not, the function will either just return the coordinates
unchanged or perform the wrapping, respectively.

The wrap functions are used always, even when there is no need for manual
wrapping (in which case the coordinates are return unchanged), in order to
simplify the shader creation code. I have assumed that the shader compiler is
good at inlining small functions like these, and therefore there will not be
any performance impact. If that is not the case for some major platform, we
could consider handling this differently.

This patchset adds some of the infrastructure needed to add support for manual
repeat wrap modes when using GL_TEXTURE_RECTANGLE, too. I don't think
GL_TEXTURE_RECTANGLE is of much interest anymore, though.

Thanks,
Alexandros

Alexandros Frantzis (2):
  gl: Simplify GL wrap parameter setting code
  gl: Provide a shader implementation of repeat wrap modes

 src/cairo-gl-composite.c |   35 +++++++++++--------
 src/cairo-gl-device.c    |   16 ++++++---
 src/cairo-gl-private.h   |    1 +
 src/cairo-gl-shaders.c   |   84 +++++++++++++++++++++++++++++++++++++++-------
 4 files changed, 105 insertions(+), 31 deletions(-)

-- 
1.7.9.5



More information about the cairo mailing list