buffer: move choice about using malloc closer to driver

This moves the decision about whether a buffer should be allocated using
malloc or not into cogl-buffer.c closer to the driver since it seem
there could be other driver specific factors that might also influence
this choice that we don't currently consider.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 06d46f10bf755d3009c28904e616a0adb4586cf5)
This commit is contained in:
Robert Bragg
2012-09-19 21:34:24 +01:00
parent ffd2cf8ef8
commit 91a02e9107
5 changed files with 25 additions and 33 deletions

View File

@ -44,18 +44,11 @@ cogl_attribute_buffer_new (CoglContext *context,
const void *data)
{
CoglAttributeBuffer *array = g_slice_new (CoglAttributeBuffer);
CoglBool use_malloc;
if (!(context->private_feature_flags & COGL_PRIVATE_FEATURE_VBOS))
use_malloc = TRUE;
else
use_malloc = FALSE;
/* parent's constructor */
_cogl_buffer_initialize (COGL_BUFFER (array),
context,
bytes,
use_malloc,
COGL_BUFFER_BIND_TARGET_ATTRIBUTE_BUFFER,
COGL_BUFFER_USAGE_HINT_ATTRIBUTE_BUFFER,
COGL_BUFFER_UPDATE_HINT_STATIC);