[cogl/wip/rib/master-next: 18/35] make COGL_FEATURE_OFFSCREEN_BLIT a private feature



commit 25d454ed3cc8b82cf72831d8f7464559ca74e436
Author: Robert Bragg <robert linux intel com>
Date:   Wed Oct 12 22:47:42 2011 +0100

    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.

 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 2cf3cda..eff8f71 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 a13f2fb..a6c5b6e 100644
--- a/cogl/cogl-framebuffer-private.h
+++ b/cogl/cogl-framebuffer-private.h
@@ -313,7 +313,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 8305313..2fd079c 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 ae53067..8f52afc 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 4dae170..3d2d610 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->glRenderbufferStorageMultisample)
     flags |= COGL_FEATURE_OFFSCREEN_MULTISAMPLE;
diff --git a/cogl/driver/gles/cogl-gles.c b/cogl/driver/gles/cogl-gles.c
index 67ab5ae..cfff21c 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;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]