[cairo-commit] 3 commits - src/cairo-gl-composite.c src/cairo-gl-device.c src/cairo-gl-dispatch.c src/cairo-gl-dispatch-private.h
Martin Robinson
mrobinson at kemper.freedesktop.org
Wed Dec 5 16:22:35 PST 2012
src/cairo-gl-composite.c | 14 ++++++++++----
src/cairo-gl-device.c | 9 +++++++++
src/cairo-gl-dispatch-private.h | 10 +++++++---
src/cairo-gl-dispatch.c | 26 ++++++++++++++++++++++++++
4 files changed, 52 insertions(+), 7 deletions(-)
New commits:
commit ba4a4eae051cd932e59e3092ef36d4f6cded0159
Author: Chuanbo Weng <chuanbo.weng at intel.com>
Date: Tue Oct 2 13:58:49 2012 +0200
gl/msaa: Use GL_IMG_multisampled_render_to_texture when available
Some OpenGLES platforms support GL_IMG_multisampled_render_to_texture
instead of GL_EXT_multisampled_render_to_texture.
diff --git a/src/cairo-gl-device.c b/src/cairo-gl-device.c
index 89d66f2..37c837d 100644
--- a/src/cairo-gl-device.c
+++ b/src/cairo-gl-device.c
@@ -249,6 +249,14 @@ _cairo_gl_context_init (cairo_gl_context_t *ctx)
glGetIntegerv(GL_MAX_SAMPLES_EXT, &ctx->num_samples);
}
#endif
+
+#if CAIRO_HAS_GLESV2_SURFACE && defined(GL_MAX_SAMPLES_IMG)
+ if (ctx->has_packed_depth_stencil &&
+ _cairo_gl_has_extension ("GL_IMG_multisampled_render_to_texture")) {
+ glGetIntegerv(GL_MAX_SAMPLES_IMG, &ctx->num_samples);
+ }
+#endif
+
ctx->supports_msaa = ctx->num_samples > 1;
if (ctx->num_samples > MAX_MSAA_SAMPLES)
ctx->num_samples = MAX_MSAA_SAMPLES;
diff --git a/src/cairo-gl-dispatch-private.h b/src/cairo-gl-dispatch-private.h
index 0c5dc39..cabf76f 100644
--- a/src/cairo-gl-dispatch-private.h
+++ b/src/cairo-gl-dispatch-private.h
@@ -53,7 +53,7 @@ typedef struct _cairo_gl_dispatch_entry {
offsetof(cairo_gl_dispatch_t, name) }
#define DISPATCH_ENTRY_ARB_OES(name) { { "gl"#name, "gl"#name"ARB", "gl"#name"OES" }, \
offsetof(cairo_gl_dispatch_t, name) }
-#define DISPATCH_ENTRY_EXT_EXT(name) { { "gl"#name, "gl"#name"EXT", "gl"#name"EXT" }, \
+#define DISPATCH_ENTRY_EXT_IMG(name) { { "gl"#name, "gl"#name"EXT", "gl"#name"IMG" }, \
offsetof(cairo_gl_dispatch_t, name) }
#define DISPATCH_ENTRY_CUSTOM(name, name2) { { "gl"#name, "gl"#name2, "gl"#name }, \
offsetof(cairo_gl_dispatch_t, name)}
@@ -117,8 +117,12 @@ cairo_private cairo_gl_dispatch_entry_t dispatch_fbo_entries[] = {
DISPATCH_ENTRY_EXT (FramebufferRenderbuffer),
DISPATCH_ENTRY_EXT (DeleteRenderbuffers),
DISPATCH_ENTRY_EXT (BlitFramebuffer),
- DISPATCH_ENTRY_EXT_EXT (RenderbufferStorageMultisample),
- DISPATCH_ENTRY_EXT_EXT (FramebufferTexture2DMultisample),
+ DISPATCH_ENTRY_LAST
+};
+
+cairo_private cairo_gl_dispatch_entry_t dispatch_multisampling_entries[] = {
+ DISPATCH_ENTRY_EXT_IMG (RenderbufferStorageMultisample),
+ DISPATCH_ENTRY_EXT_IMG (FramebufferTexture2DMultisample),
DISPATCH_ENTRY_LAST
};
diff --git a/src/cairo-gl-dispatch.c b/src/cairo-gl-dispatch.c
index 5bffddd..76c3115 100644
--- a/src/cairo-gl-dispatch.c
+++ b/src/cairo-gl-dispatch.c
@@ -205,6 +205,27 @@ _cairo_gl_dispatch_init_fbo (cairo_gl_dispatch_t *dispatch,
return CAIRO_STATUS_SUCCESS;
}
+static cairo_status_t
+_cairo_gl_dispatch_init_multisampling (cairo_gl_dispatch_t *dispatch,
+ cairo_gl_get_proc_addr_func_t get_proc_addr,
+ int gl_version,
+ cairo_gl_flavor_t gl_flavor)
+{
+ /* 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 (_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"))
+ dispatch_name = CAIRO_GL_DISPATCH_NAME_ES;
+ }
+ _cairo_gl_dispatch_init_entries (dispatch, get_proc_addr,
+ dispatch_multisampling_entries,
+ dispatch_name);
+ return CAIRO_STATUS_SUCCESS;
+}
+
cairo_status_t
_cairo_gl_dispatch_init (cairo_gl_dispatch_t *dispatch,
cairo_gl_get_proc_addr_func_t get_proc_addr)
@@ -231,5 +252,10 @@ _cairo_gl_dispatch_init (cairo_gl_dispatch_t *dispatch,
if (status != CAIRO_STATUS_SUCCESS)
return status;
+ status = _cairo_gl_dispatch_init_multisampling (dispatch, get_proc_addr,
+ gl_version, gl_flavor);
+ if (status != CAIRO_STATUS_SUCCESS)
+ return status;
+
return CAIRO_STATUS_SUCCESS;
}
commit 3bedff0c009e645fff2d6f40976b4483871e73e1
Author: Henry Song <henry.song at samsung.com>
Date: Tue May 15 20:32:44 2012 +0200
gl: Properly disable ctx->spans when necessary
When compositing starts, if we are not using the spans compositor, we
should set the spans member of the context to false.
diff --git a/src/cairo-gl-composite.c b/src/cairo-gl-composite.c
index 45fa042..e222c44 100644
--- a/src/cairo-gl-composite.c
+++ b/src/cairo-gl-composite.c
@@ -266,11 +266,18 @@ _cairo_gl_context_setup_operand (cairo_gl_context_t *ctx,
static void
_cairo_gl_context_setup_spans (cairo_gl_context_t *ctx,
+ cairo_bool_t spans_enabled,
unsigned int vertex_size,
unsigned int vertex_offset)
{
cairo_gl_dispatch_t *dispatch = &ctx->dispatch;
+ if (! spans_enabled) {
+ dispatch->DisableVertexAttribArray (CAIRO_GL_COLOR_ATTRIB_INDEX);
+ ctx->spans = FALSE;
+ return;
+ }
+
dispatch->VertexAttribPointer (CAIRO_GL_COLOR_ATTRIB_INDEX, 4,
GL_UNSIGNED_BYTE, GL_TRUE, vertex_size,
ctx->vb + vertex_offset);
@@ -681,10 +688,9 @@ _cairo_gl_composite_begin_multisample (cairo_gl_composite_t *setup,
_cairo_gl_context_setup_operand (ctx, CAIRO_GL_TEX_SOURCE, &setup->src, vertex_size, dst_size);
_cairo_gl_context_setup_operand (ctx, CAIRO_GL_TEX_MASK, &setup->mask, vertex_size, dst_size + src_size);
- if (setup->spans)
- _cairo_gl_context_setup_spans (ctx, vertex_size, dst_size + src_size + mask_size);
- else
- ctx->dispatch.DisableVertexAttribArray (CAIRO_GL_COLOR_ATTRIB_INDEX);
+
+ _cairo_gl_context_setup_spans (ctx, setup->spans, vertex_size,
+ dst_size + src_size + mask_size);
_cairo_gl_set_operator (ctx, setup->op, component_alpha);
commit 18e7234c7e56ca26d7d7a2e29b1da2bb6944bb34
Author: Henry Song <henry.song at samsung.com>
Date: Wed May 23 15:12:16 2012 +0200
gl/msaa: Also setmsaa_active to true for non-texture surfaces
This is important because there are places in the code where msaa_active
is used to decide whether or not to complete an operation with
multisampling or not.
diff --git a/src/cairo-gl-device.c b/src/cairo-gl-device.c
index 6563b3b..89d66f2 100644
--- a/src/cairo-gl-device.c
+++ b/src/cairo-gl-device.c
@@ -688,6 +688,7 @@ _cairo_gl_context_set_destination (cairo_gl_context_t *ctx,
glDisable(GL_MULTISAMPLE);
#endif
+ surface->msaa_active = multisampling;
ctx->dispatch.BindFramebuffer (GL_FRAMEBUFFER, 0);
#if CAIRO_HAS_GL_SURFACE
More information about the cairo-commit
mailing list