[cairo-commit] src/cairo-gl-composite.c src/cairo-gl-device.c src/cairo-gl-dispatch.c src/cairo-gl-info.c src/cairo-gl-msaa-compositor.c src/cairo-gl-operand.c src/cairo-gl-private.h src/cairo-gl-shaders.c src/cairo-gl-surface.c src/cairo-gl-traps-compositor.c
Bryce Harrington
bryce at kemper.freedesktop.org
Sat Oct 29 01:04:52 UTC 2016
src/cairo-gl-composite.c | 2 +-
src/cairo-gl-device.c | 12 ++++++------
src/cairo-gl-dispatch.c | 8 ++++----
src/cairo-gl-info.c | 4 ++--
src/cairo-gl-msaa-compositor.c | 2 +-
src/cairo-gl-operand.c | 2 +-
src/cairo-gl-private.h | 2 +-
src/cairo-gl-shaders.c | 10 +++++-----
src/cairo-gl-surface.c | 6 +++---
src/cairo-gl-traps-compositor.c | 2 +-
10 files changed, 25 insertions(+), 25 deletions(-)
New commits:
commit eb5232002b16193d5ba6c1450d80616914fd9917
Author: Bryce Harrington <bryce at osg.samsung.com>
Date: Wed Oct 12 19:00:38 2016 -0700
gl: Treat GLES v2 as a separate flavor from GLES v3
To support differentiating between GLES v2 and v3, rename the flavor
enum to be version specific, as CAIRO_GL_FLAVOR_ES2.
Then, when GLES v3 support is introduced we can add it as a distinct
flavor enum (i.e. CAIRO_GL_FLAVOR_ES3).
Signed-off-by: Bryce Harrington <bryce at osg.samsung.com>
diff --git a/src/cairo-gl-composite.c b/src/cairo-gl-composite.c
index 5b14114..a95712e 100644
--- a/src/cairo-gl-composite.c
+++ b/src/cairo-gl-composite.c
@@ -174,7 +174,7 @@ _cairo_gl_texture_set_extend (cairo_gl_context_t *ctx,
switch (extend) {
case CAIRO_EXTEND_NONE:
- if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES)
+ if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES2)
wrap_mode = GL_CLAMP_TO_EDGE;
else
wrap_mode = GL_CLAMP_TO_BORDER;
diff --git a/src/cairo-gl-device.c b/src/cairo-gl-device.c
index 7235d9a..c6aba43 100644
--- a/src/cairo-gl-device.c
+++ b/src/cairo-gl-device.c
@@ -171,7 +171,7 @@ test_can_read_bgra (cairo_gl_flavor_t gl_flavor)
if (gl_flavor == CAIRO_GL_FLAVOR_DESKTOP)
return TRUE;
- assert (gl_flavor == CAIRO_GL_FLAVOR_ES);
+ assert (gl_flavor == CAIRO_GL_FLAVOR_ES2);
/* For OpenGL ES we have to look for the specific extension and BGRA only
* matches cairo's integer packed bytes on little-endian machines. */
@@ -190,7 +190,7 @@ _cairo_gl_context_init (cairo_gl_context_t *ctx)
int n;
cairo_bool_t is_desktop = gl_flavor == CAIRO_GL_FLAVOR_DESKTOP;
- cairo_bool_t is_gles = gl_flavor == CAIRO_GL_FLAVOR_ES;
+ cairo_bool_t is_gles = gl_flavor == CAIRO_GL_FLAVOR_ES2;
_cairo_device_init (&ctx->base, &_cairo_gl_device_backend);
@@ -402,7 +402,7 @@ _cairo_gl_ensure_framebuffer (cairo_gl_context_t *ctx,
does not require an explicit multisample resolution. */
#if CAIRO_HAS_GLESV2_SURFACE
if (surface->supports_msaa && _cairo_gl_msaa_compositor_enabled () &&
- ctx->gl_flavor == CAIRO_GL_FLAVOR_ES) {
+ ctx->gl_flavor == CAIRO_GL_FLAVOR_ES2) {
_cairo_gl_ensure_msaa_gles_framebuffer (ctx, surface);
} else
#endif
@@ -509,7 +509,7 @@ _cairo_gl_ensure_msaa_depth_stencil_buffer (cairo_gl_context_t *ctx,
#endif
#if CAIRO_HAS_GLESV2_SURFACE
- if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES) {
+ if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES2) {
dispatch->FramebufferRenderbuffer (GL_FRAMEBUFFER,
GL_DEPTH_ATTACHMENT,
GL_RENDERBUFFER,
@@ -712,7 +712,7 @@ _cairo_gl_context_bind_framebuffer (cairo_gl_context_t *ctx,
if (_cairo_gl_surface_is_texture (surface)) {
/* OpenGL ES surfaces only have either a multisample framebuffer or a
* singlesample framebuffer, so we cannot switch back and forth. */
- if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES) {
+ if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES2) {
_cairo_gl_ensure_framebuffer (ctx, surface);
ctx->dispatch.BindFramebuffer (GL_FRAMEBUFFER, surface->fb);
return;
@@ -749,7 +749,7 @@ _cairo_gl_context_set_destination (cairo_gl_context_t *ctx,
/* The decision whether or not to use multisampling happens when
* we create an OpenGL ES surface, so we can never switch modes. */
- if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES)
+ if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES2)
multisampling = surface->msaa_active;
changing_surface = ctx->current_target != surface || surface->needs_update;
diff --git a/src/cairo-gl-dispatch.c b/src/cairo-gl-dispatch.c
index 76c3115..3e37219 100644
--- a/src/cairo-gl-dispatch.c
+++ b/src/cairo-gl-dispatch.c
@@ -124,7 +124,7 @@ _cairo_gl_dispatch_init_buffers (cairo_gl_dispatch_t *dispatch,
else
return CAIRO_STATUS_DEVICE_ERROR;
}
- else if (gl_flavor == CAIRO_GL_FLAVOR_ES &&
+ else if (gl_flavor == CAIRO_GL_FLAVOR_ES2 &&
gl_version >= CAIRO_GL_VERSION_ENCODE (2, 0))
{
dispatch_name = CAIRO_GL_DISPATCH_NAME_ES;
@@ -156,7 +156,7 @@ _cairo_gl_dispatch_init_shaders (cairo_gl_dispatch_t *dispatch,
else
return CAIRO_STATUS_DEVICE_ERROR;
}
- else if (gl_flavor == CAIRO_GL_FLAVOR_ES &&
+ else if (gl_flavor == CAIRO_GL_FLAVOR_ES2 &&
gl_version >= CAIRO_GL_VERSION_ENCODE (2, 0))
{
dispatch_name = CAIRO_GL_DISPATCH_NAME_ES;
@@ -189,7 +189,7 @@ _cairo_gl_dispatch_init_fbo (cairo_gl_dispatch_t *dispatch,
else
return CAIRO_STATUS_DEVICE_ERROR;
}
- else if (gl_flavor == CAIRO_GL_FLAVOR_ES &&
+ else if (gl_flavor == CAIRO_GL_FLAVOR_ES2 &&
gl_version >= CAIRO_GL_VERSION_ENCODE (2, 0))
{
dispatch_name = CAIRO_GL_DISPATCH_NAME_ES;
@@ -214,7 +214,7 @@ _cairo_gl_dispatch_init_multisampling (cairo_gl_dispatch_t *dispatch,
/* For the multisampling table, there are two GLES versions of the
* extension, so we put one in the EXT slot and one in the real ES slot.*/
cairo_gl_dispatch_name_t dispatch_name = CAIRO_GL_DISPATCH_NAME_CORE;
- if (gl_flavor == CAIRO_GL_FLAVOR_ES) {
+ if (gl_flavor == CAIRO_GL_FLAVOR_ES2) {
if (_cairo_gl_has_extension ("GL_EXT_multisampled_render_to_texture"))
dispatch_name = CAIRO_GL_DISPATCH_NAME_EXT;
else if (_cairo_gl_has_extension ("GL_IMG_multisampled_render_to_texture"))
diff --git a/src/cairo-gl-info.c b/src/cairo-gl-info.c
index acefbb9..39541aa 100644
--- a/src/cairo-gl-info.c
+++ b/src/cairo-gl-info.c
@@ -65,8 +65,8 @@ _cairo_gl_get_flavor (void)
if (version == NULL)
flavor = CAIRO_GL_FLAVOR_NONE;
- else if (strstr (version, "OpenGL ES") != NULL)
- flavor = CAIRO_GL_FLAVOR_ES;
+ else if (strstr (version, "OpenGL ES 2") != NULL)
+ flavor = CAIRO_GL_FLAVOR_ES2;
else
flavor = CAIRO_GL_FLAVOR_DESKTOP;
diff --git a/src/cairo-gl-msaa-compositor.c b/src/cairo-gl-msaa-compositor.c
index 4904b9a..507459d 100644
--- a/src/cairo-gl-msaa-compositor.c
+++ b/src/cairo-gl-msaa-compositor.c
@@ -280,7 +280,7 @@ 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_ES
+ if (((cairo_gl_context_t *) surface->base.device)->gl_flavor == CAIRO_GL_FLAVOR_ES2
&& surface->supports_msaa
&& antialias == CAIRO_ANTIALIAS_NONE)
return FALSE;
diff --git a/src/cairo-gl-operand.c b/src/cairo-gl-operand.c
index 1d1465a..ca1fa4b 100644
--- a/src/cairo-gl-operand.c
+++ b/src/cairo-gl-operand.c
@@ -658,7 +658,7 @@ _cairo_gl_operand_bind_to_shader (cairo_gl_context_t *ctx,
* with CAIRO_EXTEND_NONE). When bilinear filtering is enabled,
* these shaders need the texture dimensions for their calculations.
*/
- if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES &&
+ if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES2 &&
_cairo_gl_operand_get_extend (operand) == CAIRO_EXTEND_NONE &&
_cairo_gl_operand_get_gl_filter (operand) == GL_LINEAR)
{
diff --git a/src/cairo-gl-private.h b/src/cairo-gl-private.h
index cb915c8..091e095 100644
--- a/src/cairo-gl-private.h
+++ b/src/cairo-gl-private.h
@@ -103,7 +103,7 @@ typedef struct _cairo_gl_surface cairo_gl_surface_t;
typedef enum cairo_gl_flavor {
CAIRO_GL_FLAVOR_NONE = 0,
CAIRO_GL_FLAVOR_DESKTOP = 1,
- CAIRO_GL_FLAVOR_ES = 2
+ CAIRO_GL_FLAVOR_ES2 = 2
} cairo_gl_flavor_t;
/* Indices for vertex attributes used by BindAttribLocation etc */
diff --git a/src/cairo-gl-shaders.c b/src/cairo-gl-shaders.c
index fe975d2..aceb5d2 100644
--- a/src/cairo-gl-shaders.c
+++ b/src/cairo-gl-shaders.c
@@ -398,7 +398,7 @@ cairo_gl_shader_emit_color (cairo_output_stream_t *stream,
"vec4 get_%s()\n"
"{\n",
rectstr, namestr, namestr, namestr, namestr);
- if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES &&
+ if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES2 &&
_cairo_gl_shader_needs_border_fade (op))
{
_cairo_output_stream_printf (stream,
@@ -425,7 +425,7 @@ cairo_gl_shader_emit_color (cairo_output_stream_t *stream,
"vec4 get_%s()\n"
"{\n",
namestr, namestr, rectstr, namestr, namestr);
- if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES &&
+ if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES2 &&
_cairo_gl_shader_needs_border_fade (op))
{
_cairo_output_stream_printf (stream,
@@ -462,7 +462,7 @@ cairo_gl_shader_emit_color (cairo_output_stream_t *stream,
" float is_valid = step (-%s_radius_0, t * %s_circle_d.z);\n",
namestr, namestr, rectstr, namestr, namestr, namestr, namestr,
namestr, namestr, namestr, namestr, namestr);
- if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES &&
+ if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES2 &&
_cairo_gl_shader_needs_border_fade (op))
{
_cairo_output_stream_printf (stream,
@@ -507,7 +507,7 @@ cairo_gl_shader_emit_color (cairo_output_stream_t *stream,
" float upper_t = mix (t.y, t.x, is_valid.x);\n",
namestr, namestr, rectstr, namestr, namestr, namestr, namestr,
namestr, namestr, namestr, namestr, namestr, namestr);
- if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES &&
+ if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES2 &&
_cairo_gl_shader_needs_border_fade (op))
{
_cairo_output_stream_printf (stream,
@@ -674,7 +674,7 @@ cairo_gl_shader_get_fragment_source (cairo_gl_context_t *ctx,
_cairo_gl_shader_emit_wrap (ctx, stream, src, CAIRO_GL_TEX_SOURCE);
_cairo_gl_shader_emit_wrap (ctx, stream, mask, CAIRO_GL_TEX_MASK);
- if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES) {
+ if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES2) {
if (_cairo_gl_shader_needs_border_fade (src))
_cairo_gl_shader_emit_border_fade (stream, src, CAIRO_GL_TEX_SOURCE);
if (_cairo_gl_shader_needs_border_fade (mask))
diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index 5950fbb..e5e8205 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -922,7 +922,7 @@ _cairo_gl_surface_draw_image (cairo_gl_surface_t *dst,
* alignment constraint
*/
if (src->stride < 0 ||
- (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES &&
+ (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES2 &&
(src->width * cpp < src->stride - 3 ||
width != src->width)))
{
@@ -1099,7 +1099,7 @@ _cairo_gl_surface_map_to_image (void *abstract_surface,
return NULL;
}
- if (_cairo_gl_surface_flavor (surface) == CAIRO_GL_FLAVOR_ES) {
+ if (_cairo_gl_surface_flavor (surface) == CAIRO_GL_FLAVOR_ES2) {
/* If only RGBA is supported, we must download data in a compatible
* format. This means that pixman will convert the data on the CPU when
* interacting with other image surfaces. For ALPHA, GLES2 does not
@@ -1319,7 +1319,7 @@ _cairo_gl_surface_resolve_multisampling (cairo_gl_surface_t *surface)
return CAIRO_INT_STATUS_SUCCESS;
/* GLES surfaces do not need explicit resolution. */
- if (((cairo_gl_context_t *) surface->base.device)->gl_flavor == CAIRO_GL_FLAVOR_ES)
+ if (((cairo_gl_context_t *) surface->base.device)->gl_flavor == CAIRO_GL_FLAVOR_ES2)
return CAIRO_INT_STATUS_SUCCESS;
if (! _cairo_gl_surface_is_texture (surface))
diff --git a/src/cairo-gl-traps-compositor.c b/src/cairo-gl-traps-compositor.c
index 125ed4e..664a27a 100644
--- a/src/cairo-gl-traps-compositor.c
+++ b/src/cairo-gl-traps-compositor.c
@@ -304,7 +304,7 @@ traps_to_operand (void *_dst,
}
/* GLES2 only supports RGB/RGBA when uploading */
- if (_cairo_gl_get_flavor () == CAIRO_GL_FLAVOR_ES) {
+ if (_cairo_gl_get_flavor () == CAIRO_GL_FLAVOR_ES2) {
cairo_surface_pattern_t pattern;
cairo_surface_t *rgba_image;
More information about the cairo-commit
mailing list