mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-13 10:50:28 +01:00
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@osg.samsung.com>
This commit is contained in:
parent
cd1040ed80
commit
eb5232002b
10 changed files with 25 additions and 25 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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"))
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue