cogl-buffer: make the COGL_BUFFER_USAGE_HINT private

The usage hint should be implied by the CoglBuffer subclass type so the
public getter and setter APIs for manually changing the usage hint of a
CoglBuffer have now been removed.
This commit is contained in:
Robert Bragg 2010-07-03 21:30:33 +01:00
parent 9ceb0edf26
commit cafeb02531
3 changed files with 9 additions and 66 deletions

View File

@ -68,6 +68,11 @@ typedef enum _CoglBufferFlags
COGL_BUFFER_FLAG_MAPPED = 1UL << 1 COGL_BUFFER_FLAG_MAPPED = 1UL << 1
} CoglBufferFlags; } CoglBufferFlags;
typedef enum {
COGL_BUFFER_USAGE_HINT_TEXTURE,
COGL_BUFFER_USAGE_HINT_VERTICES
} CoglBufferUsageHint;
struct _CoglBuffer struct _CoglBuffer
{ {
CoglObject _parent; CoglObject _parent;
@ -103,6 +108,10 @@ void _cogl_buffer_initialize (CoglBuffer *buffer,
CoglBufferUsageHint usage_hint, CoglBufferUsageHint usage_hint,
CoglBufferUpdateHint update_hint); CoglBufferUpdateHint update_hint);
void _cogl_buffer_fini (CoglBuffer *buffer); void _cogl_buffer_fini (CoglBuffer *buffer);
CoglBufferUsageHint
_cogl_buffer_get_usage_hint (CoglBuffer *buffer);
void _cogl_buffer_bind (CoglBuffer *buffer, void _cogl_buffer_bind (CoglBuffer *buffer,
GLenum target); GLenum target);
GLenum _cogl_buffer_access_to_gl_enum (CoglBufferAccess access); GLenum _cogl_buffer_access_to_gl_enum (CoglBufferAccess access);

View File

@ -205,28 +205,6 @@ cogl_buffer_get_size (CoglBuffer *buffer)
return COGL_BUFFER (buffer)->size; return COGL_BUFFER (buffer)->size;
} }
void
cogl_buffer_set_usage_hint (CoglBuffer *buffer,
CoglBufferUsageHint hint)
{
if (!cogl_is_buffer (buffer))
return;
if (G_UNLIKELY (hint > COGL_BUFFER_USAGE_HINT_TEXTURE))
hint = COGL_BUFFER_USAGE_HINT_TEXTURE;
buffer->usage_hint = hint;
}
CoglBufferUsageHint
cogl_buffer_get_usage_hint (CoglBuffer *buffer)
{
if (!cogl_is_buffer (buffer))
return FALSE;
return buffer->usage_hint;
}
void void
cogl_buffer_set_update_hint (CoglBuffer *buffer, cogl_buffer_set_update_hint (CoglBuffer *buffer,
CoglBufferUpdateHint hint) CoglBufferUpdateHint hint)

View File

@ -90,50 +90,6 @@ cogl_is_buffer (const void *object);
unsigned int unsigned int
cogl_buffer_get_size (CoglBuffer *buffer); cogl_buffer_get_size (CoglBuffer *buffer);
/**
* CoglBufferUsageHint:
* @COGL_BUFFER_USAGE_HINT_TEXTURE: the buffer will be used as a source data
* for a texture
*
* The usage hint on a buffer allows the user to give some clue on how the
* buffer will be used.
*
* Since: 1.2
* Stability: Unstable
*/
typedef enum { /*< prefix=COGL_BUFFER_USAGE_HINT >*/
COGL_BUFFER_USAGE_HINT_TEXTURE,
} CoglBufferUsageHint;
/**
* cogl_buffer_set_usage_hint:
* @buffer: a buffer object
* @hint: the new hint
*
* Sets the usage hint on a buffer. See #CoglBufferUsageHint for a description
* of the available hints.
*
* Since: 1.2
* Stability: Unstable
*/
void
cogl_buffer_set_usage_hint (CoglBuffer *buffer,
CoglBufferUsageHint hint);
/**
* cogl_buffer_get_usage_hint:
* @buffer: a buffer object
*
* Retrieves the usage hint set using cogl_buffer_set_usage_hint()
*
* Return value: the #CoglBufferUsageHint currently used by the buffer
*
* Since: 1.2
* Stability: Unstable
*/
CoglBufferUsageHint
cogl_buffer_get_usage_hint (CoglBuffer *buffer);
/** /**
* CoglBufferUpdateHint: * CoglBufferUpdateHint:
* @COGL_BUFFER_UPDATE_HINT_STATIC: the buffer will not change over time * @COGL_BUFFER_UPDATE_HINT_STATIC: the buffer will not change over time