diff options
author | Bryce Harrington <bryce@osg.samsung.com> | 2017-09-13 12:35:27 -0700 |
---|---|---|
committer | Bryce Harrington <bryce@osg.samsung.com> | 2017-09-13 15:18:04 -0700 |
commit | 8ff3019f51bd40c23d8a0dd5e51ce3fab6442d6e (patch) | |
tree | d1134f7f14dc337b04e32a83537851d8c53193b0 /src/cairo-gl-msaa-compositor.c | |
parent | d1f941d7ee06340c155158b32bec28fc2e1a4264 (diff) | |
download | cairo-8ff3019f51bd40c23d8a0dd5e51ce3fab6442d6e.tar.gz |
gl: Add support for OpenGL ES 3.0
This improves the OpenGL ES support to extend it to version 3.0.
A number of new features are available in glesv3 including creation of
multi-sampled renderbuffers. These renderbuffers can be blitted to
single sample textures (but not the other way around). Other features
such as PBO for image uploading, are left as followon work.
For this preliminary implementation, glesv3 backends always create
renderbuffers, which can be set as single sample or multisample. The
renderbuffer's content is blitted to the texture only when used as a
source or a mask.
Images uploaded to a texture stay there until the surface is used as a
rendering target, at which point its painted to the renderbuffer.
This patch is heavily based off of Henry Song's initial GLESv3 patch
6f7f3795 from his cairogles fork of Cairo, and incorporates subsequent
fixes and pertinent refactorings from his trunk and review feedback from
Uli.
This implements the *functional* support for glesv3, excluding the
various optimization work to utilize its features. Rendering and
performance should not be expected to improve notably from pure glesv2.
As the GL backend for Cairo remains "experimental", these changes should
likewise be considered as such.
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Diffstat (limited to 'src/cairo-gl-msaa-compositor.c')
-rw-r--r-- | src/cairo-gl-msaa-compositor.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/cairo-gl-msaa-compositor.c b/src/cairo-gl-msaa-compositor.c index 507459de3..f9cd7c296 100644 --- a/src/cairo-gl-msaa-compositor.c +++ b/src/cairo-gl-msaa-compositor.c @@ -273,6 +273,8 @@ static cairo_bool_t can_use_msaa_compositor (cairo_gl_surface_t *surface, cairo_antialias_t antialias) { + cairo_gl_flavor_t gl_flavor = ((cairo_gl_context_t *) surface->base.device)->gl_flavor; + query_surface_capabilities (surface); if (! surface->supports_stencil) return FALSE; @@ -280,8 +282,10 @@ can_use_msaa_compositor (cairo_gl_surface_t *surface, /* Multisampling OpenGL ES surfaces only maintain one multisampling framebuffer and thus must use the spans compositor to do non-antialiased rendering. */ - if (((cairo_gl_context_t *) surface->base.device)->gl_flavor == CAIRO_GL_FLAVOR_ES2 + if ((gl_flavor == CAIRO_GL_FLAVOR_ES3 || + gl_flavor == CAIRO_GL_FLAVOR_ES2) && surface->supports_msaa + && surface->num_samples > 1 && antialias == CAIRO_ANTIALIAS_NONE) return FALSE; @@ -378,6 +382,9 @@ _cairo_gl_msaa_compositor_mask_source_operator (const cairo_compositor_t *compos FALSE); if (unlikely (status)) goto finish; + + _cairo_gl_context_set_destination (ctx, dst, setup.multisample); + status = _cairo_gl_set_operands_and_operator (&setup, ctx); if (unlikely (status)) goto finish; @@ -634,6 +641,7 @@ query_surface_capabilities (cairo_gl_surface_t *surface) glGetIntegerv(GL_STENCIL_BITS, &stencil_bits); surface->supports_stencil = stencil_bits > 0; surface->supports_msaa = samples > 1; + surface->num_samples = samples; status = _cairo_gl_context_release (ctx, status); } |