diff --git a/cogl/cogl-attribute-buffer.c b/cogl/cogl-attribute-buffer.c index 981c93ea2..a627fac6a 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 4c75c36f1..452c67534 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 2471550a2..48c2c423a 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 b67186896..946f8bca7 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 c4a023863..cd2359b04 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 f0a9c4e48..609e21d0b 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 d203ba5dd..9b2f331da 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;