From abbd28f484b34525fa7037d004654232ae04be2e Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Wed, 12 Oct 2011 22:47:42 +0100 Subject: [PATCH] make COGL_FEATURE_OFFSCREEN_BLIT a private feature Cogl doesn't expose public api for blitting between framebuffers so it doesn't make much sense to have this feature as part of the public api currently. We can't break the api by removing the enum but at least we no longer ever set the feature flag. We now have a replacement private feature flag COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT which cogl now checks for internally. Reviewed-by: Neil Roberts --- cogl/cogl-blit.c | 2 +- cogl/cogl-framebuffer-private.h | 2 +- cogl/cogl-framebuffer.c | 7 +++++-- cogl/cogl-internal.h | 3 ++- cogl/driver/gl/cogl-gl.c | 2 +- cogl/driver/gles/cogl-gles.c | 2 +- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/cogl/cogl-blit.c b/cogl/cogl-blit.c index 2cf3cdaa5..eff8f7140 100644 --- a/cogl/cogl-blit.c +++ b/cogl/cogl-blit.c @@ -147,7 +147,7 @@ _cogl_blit_framebuffer_begin (CoglBlitData *data) format and the blit framebuffer extension is supported */ if ((cogl_texture_get_format (data->src_tex) & ~COGL_A_BIT) != (cogl_texture_get_format (data->dst_tex) & ~COGL_A_BIT) || - !cogl_features_available (COGL_FEATURE_OFFSCREEN_BLIT)) + !(ctx->private_feature_flags & COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT)) return FALSE; dst_fbo = _cogl_offscreen_new_to_texture_full diff --git a/cogl/cogl-framebuffer-private.h b/cogl/cogl-framebuffer-private.h index 6b334ce01..9d8bdb1f1 100644 --- a/cogl/cogl-framebuffer-private.h +++ b/cogl/cogl-framebuffer-private.h @@ -307,7 +307,7 @@ _cogl_push_framebuffers (CoglFramebuffer *draw_buffer, * This blits a region of the color buffer of the current draw buffer * to the current read buffer. The draw and read buffers can be set up * using _cogl_push_framebuffers(). This function should only be - * called if the COGL_FEATURE_OFFSCREEN_BLIT feature is + * called if the COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT feature is * advertised. The two buffers must both be offscreen and have the * same format. * diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c index bcaa44698..7f0654864 100644 --- a/cogl/cogl-framebuffer.c +++ b/cogl/cogl-framebuffer.c @@ -1494,7 +1494,8 @@ _cogl_framebuffer_flush_state (CoglFramebuffer *draw_buffer, /* NB: Currently we only take advantage of binding separate * read/write buffers for offscreen framebuffer blit * purposes. */ - g_return_if_fail (cogl_features_available (COGL_FEATURE_OFFSCREEN_BLIT)); + g_return_if_fail (ctx->private_feature_flags & + COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT); g_return_if_fail (draw_buffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN); g_return_if_fail (read_buffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN); @@ -1783,7 +1784,9 @@ _cogl_blit_framebuffer (unsigned int src_x, read_buffer = _cogl_get_read_framebuffer (); ctx = draw_buffer->context; - g_return_if_fail (cogl_features_available (COGL_FEATURE_OFFSCREEN_BLIT)); + g_return_if_fail (ctx->private_feature_flags & + COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT); + /* We can only support blitting between offscreen buffers because otherwise we would need to mirror the image and GLES2.0 doesn't support this */ diff --git a/cogl/cogl-internal.h b/cogl/cogl-internal.h index ae5306721..8f52afc9e 100644 --- a/cogl/cogl-internal.h +++ b/cogl/cogl-internal.h @@ -129,7 +129,8 @@ typedef enum { COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE = 1L<<0, COGL_PRIVATE_FEATURE_MESA_PACK_INVERT = 1L<<1, - COGL_PRIVATE_FEATURE_STENCIL_BUFFER = 1L<<2 + COGL_PRIVATE_FEATURE_STENCIL_BUFFER = 1L<<2, + COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT = 1L<<3 } CoglPrivateFeatureFlags; /* Sometimes when evaluating pipelines, either during comparisons or diff --git a/cogl/driver/gl/cogl-gl.c b/cogl/driver/gl/cogl-gl.c index 2f66d0bc4..360506494 100644 --- a/cogl/driver/gl/cogl-gl.c +++ b/cogl/driver/gl/cogl-gl.c @@ -193,7 +193,7 @@ _cogl_gl_update_features (CoglContext *context, flags |= COGL_FEATURE_OFFSCREEN; if (context->glBlitFramebuffer) - flags |= COGL_FEATURE_OFFSCREEN_BLIT; + private_flags |= COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT; if (context->glRenderbufferStorageMultisampleIMG) flags |= COGL_FEATURE_OFFSCREEN_MULTISAMPLE; diff --git a/cogl/driver/gles/cogl-gles.c b/cogl/driver/gles/cogl-gles.c index 67ab5ae42..cfff21ce6 100644 --- a/cogl/driver/gles/cogl-gles.c +++ b/cogl/driver/gles/cogl-gles.c @@ -100,7 +100,7 @@ _cogl_gles_update_features (CoglContext *context, flags |= COGL_FEATURE_OFFSCREEN; if (context->glBlitFramebuffer) - flags |= COGL_FEATURE_OFFSCREEN_BLIT; + private_flags |= COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT; if (_cogl_check_extension ("GL_OES_element_index_uint", gl_extensions)) flags |= COGL_FEATURE_UNSIGNED_INT_INDICES;