[cogl] make COGL_FEATURE_VBOS a private feature



commit c86f698eb9088db0d3dd32497d29a56a9e144143
Author: Robert Bragg <robert linux intel com>
Date:   Thu Oct 13 09:36:46 2011 +0100

    make COGL_FEATURE_VBOS a private feature
    
    Cogl provides a consistent public interface regardless of whether the
    underlying GL driver supports VBOs so it doesn't make much sense to have
    this feature as part of the public api.  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_VBOS
    which cogl now checks for internally.
    
    Reviewed-by: Neil Roberts <neil linux intel com>

 cogl/cogl-attribute-buffer.c |    5 ++++-
 cogl/cogl-context.c          |    2 +-
 cogl/cogl-index-buffer.c     |    5 ++++-
 cogl/cogl-internal.h         |    3 ++-
 cogl/cogl-journal.c          |    4 +++-
 cogl/driver/gl/cogl-gl.c     |    8 +++++---
 cogl/driver/gles/cogl-gles.c |    2 +-
 7 files changed, 20 insertions(+), 9 deletions(-)
---
diff --git a/cogl/cogl-attribute-buffer.c b/cogl/cogl-attribute-buffer.c
index 981c93e..a627fac 100644
--- a/cogl/cogl-attribute-buffer.c
+++ b/cogl/cogl-attribute-buffer.c
@@ -32,6 +32,7 @@
 #include "cogl-object-private.h"
 #include "cogl-attribute-buffer.h"
 #include "cogl-attribute-buffer-private.h"
+#include "cogl-context-private.h"
 
 static void _cogl_attribute_buffer_free (CoglAttributeBuffer *array);
 
@@ -43,7 +44,9 @@ cogl_attribute_buffer_new (gsize bytes, const void *data)
   CoglAttributeBuffer *array = g_slice_new (CoglAttributeBuffer);
   gboolean use_malloc;
 
-  if (!cogl_features_available (COGL_FEATURE_VBOS))
+  _COGL_GET_CONTEXT (ctx, NULL);
+
+  if (!(ctx->private_feature_flags & COGL_PRIVATE_FEATURE_VBOS))
     use_malloc = TRUE;
   else
     use_malloc = FALSE;
diff --git a/cogl/cogl-context.c b/cogl/cogl-context.c
index 4c75c36..452c675 100644
--- a/cogl/cogl-context.c
+++ b/cogl/cogl-context.c
@@ -74,7 +74,7 @@ static void
 _cogl_init_feature_overrides (CoglContext *ctx)
 {
   if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_VBOS)))
-    ctx->feature_flags &= ~COGL_FEATURE_VBOS;
+    ctx->private_feature_flags &= ~COGL_PRIVATE_FEATURE_VBOS;
 
   if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_PBOS)))
     ctx->private_feature_flags &= ~COGL_PRIVATE_FEATURE_PBOS;
diff --git a/cogl/cogl-index-buffer.c b/cogl/cogl-index-buffer.c
index 2471550..48c2c42 100644
--- a/cogl/cogl-index-buffer.c
+++ b/cogl/cogl-index-buffer.c
@@ -32,6 +32,7 @@
 #include "cogl-object-private.h"
 #include "cogl-indices.h"
 #include "cogl-indices-private.h"
+#include "cogl-context-private.h"
 
 static void _cogl_index_buffer_free (CoglIndexBuffer *indices);
 
@@ -46,7 +47,9 @@ cogl_index_buffer_new (gsize bytes)
   CoglIndexBuffer *indices = g_slice_new (CoglIndexBuffer);
   gboolean use_malloc;
 
-  if (!cogl_features_available (COGL_FEATURE_VBOS))
+  _COGL_GET_CONTEXT (ctx, NULL);
+
+  if (!(ctx->private_feature_flags & COGL_PRIVATE_FEATURE_VBOS))
     use_malloc = TRUE;
   else
     use_malloc = FALSE;
diff --git a/cogl/cogl-internal.h b/cogl/cogl-internal.h
index b671868..946f8bc 100644
--- a/cogl/cogl-internal.h
+++ b/cogl/cogl-internal.h
@@ -132,7 +132,8 @@ typedef enum
   COGL_PRIVATE_FEATURE_STENCIL_BUFFER = 1L<<2,
   COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT = 1L<<3,
   COGL_PRIVATE_FEATURE_FOUR_CLIP_PLANES = 1L<<4,
-  COGL_PRIVATE_FEATURE_PBOS = 1L<<5
+  COGL_PRIVATE_FEATURE_PBOS = 1L<<5,
+  COGL_PRIVATE_FEATURE_VBOS = 1L<<6
 } CoglPrivateFeatureFlags;
 
 /* Sometimes when evaluating pipelines, either during comparisons or
diff --git a/cogl/cogl-journal.c b/cogl/cogl-journal.c
index c4a0238..cd2359b 100644
--- a/cogl/cogl-journal.c
+++ b/cogl/cogl-journal.c
@@ -1118,10 +1118,12 @@ create_attribute_buffer (CoglJournal *journal,
 {
   CoglAttributeBuffer *vbo;
 
+  _COGL_GET_CONTEXT (ctx, NULL);
+
   /* If CoglBuffers are being emulated with malloc then there's not
      really any point in using the pool so we'll just allocate the
      buffer directly */
-  if (!cogl_features_available (COGL_FEATURE_VBOS))
+  if (!(ctx->private_feature_flags & COGL_PRIVATE_FEATURE_VBOS))
     return cogl_attribute_buffer_new (n_bytes, NULL);
 
   vbo = journal->vbo_pool[journal->next_vbo_in_pool];
diff --git a/cogl/driver/gl/cogl-gl.c b/cogl/driver/gl/cogl-gl.c
index f0a9c4e..609e21d 100644
--- a/cogl/driver/gl/cogl-gl.c
+++ b/cogl/driver/gl/cogl-gl.c
@@ -213,9 +213,11 @@ _cogl_gl_update_features (CoglContext *context,
     flags |= COGL_FEATURE_SHADERS_GLSL;
 
   if (context->glGenBuffers)
-    flags |= (COGL_FEATURE_VBOS |
-              COGL_FEATURE_MAP_BUFFER_FOR_READ |
-              COGL_FEATURE_MAP_BUFFER_FOR_WRITE);
+    {
+      private_flags |= COGL_PRIVATE_FEATURE_VBOS;
+      flags |= (COGL_FEATURE_MAP_BUFFER_FOR_READ |
+                COGL_FEATURE_MAP_BUFFER_FOR_WRITE);
+    }
 
   if (_cogl_check_extension ("GL_ARB_texture_rectangle", gl_extensions))
     flags |= COGL_FEATURE_TEXTURE_RECTANGLE;
diff --git a/cogl/driver/gles/cogl-gles.c b/cogl/driver/gles/cogl-gles.c
index d203ba5..9b2f331 100644
--- a/cogl/driver/gles/cogl-gles.c
+++ b/cogl/driver/gles/cogl-gles.c
@@ -91,7 +91,7 @@ _cogl_gles_update_features (CoglContext *context,
       flags |= COGL_FEATURE_DEPTH_RANGE;
     }
 
-  flags |= COGL_FEATURE_VBOS;
+  private_flags |= COGL_PRIVATE_FEATURE_VBOS;
 
   /* Both GLES 1.1 and GLES 2.0 support point sprites in core */
   flags |= COGL_FEATURE_POINT_SPRITE;



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