mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
cogl-buffer: Use TEXTURE as the only value for CoglBufferUsageHint
We should try to use more explicit defines than GL for our hints. For now we only support using a CoglBuffer to generate textures.
This commit is contained in:
parent
273fd23742
commit
23717452bf
@ -147,33 +147,13 @@ GLenum
|
|||||||
_cogl_buffer_hints_to_gl_enum (CoglBufferUsageHint usage_hint,
|
_cogl_buffer_hints_to_gl_enum (CoglBufferUsageHint usage_hint,
|
||||||
CoglBufferUpdateHint update_hint)
|
CoglBufferUpdateHint update_hint)
|
||||||
{
|
{
|
||||||
if (usage_hint == COGL_BUFFER_USAGE_HINT_DRAW)
|
/* usage hint is always TEXTURE for now */
|
||||||
{
|
if (update_hint == COGL_BUFFER_UPDATE_HINT_STATIC)
|
||||||
if (update_hint == COGL_BUFFER_UPDATE_HINT_STATIC)
|
return GL_STATIC_DRAW;
|
||||||
return GL_STATIC_DRAW;
|
if (update_hint == COGL_BUFFER_UPDATE_HINT_DYNAMIC)
|
||||||
if (update_hint == COGL_BUFFER_UPDATE_HINT_DYNAMIC)
|
return GL_DYNAMIC_DRAW;
|
||||||
return GL_DYNAMIC_DRAW;
|
if (update_hint == COGL_BUFFER_UPDATE_HINT_STREAM)
|
||||||
if (update_hint == COGL_BUFFER_UPDATE_HINT_STREAM)
|
return GL_STREAM_DRAW;
|
||||||
return GL_STREAM_DRAW;
|
|
||||||
}
|
|
||||||
if (usage_hint == COGL_BUFFER_USAGE_HINT_READ)
|
|
||||||
{
|
|
||||||
if (update_hint == COGL_BUFFER_UPDATE_HINT_STATIC)
|
|
||||||
return GL_STATIC_READ;
|
|
||||||
if (update_hint == COGL_BUFFER_UPDATE_HINT_DYNAMIC)
|
|
||||||
return GL_DYNAMIC_READ;
|
|
||||||
if (update_hint == COGL_BUFFER_UPDATE_HINT_STREAM)
|
|
||||||
return GL_STREAM_READ;
|
|
||||||
}
|
|
||||||
if (usage_hint == COGL_BUFFER_USAGE_HINT_COPY)
|
|
||||||
{
|
|
||||||
if (update_hint == COGL_BUFFER_UPDATE_HINT_STATIC)
|
|
||||||
return GL_STATIC_COPY;
|
|
||||||
if (update_hint == COGL_BUFFER_UPDATE_HINT_DYNAMIC)
|
|
||||||
return GL_DYNAMIC_COPY;
|
|
||||||
if (update_hint == COGL_BUFFER_UPDATE_HINT_STREAM)
|
|
||||||
return GL_STREAM_COPY;
|
|
||||||
}
|
|
||||||
|
|
||||||
return GL_STATIC_DRAW;
|
return GL_STATIC_DRAW;
|
||||||
}
|
}
|
||||||
@ -219,8 +199,8 @@ cogl_buffer_set_usage_hint_EXP (CoglHandle handle,
|
|||||||
if (!cogl_is_buffer (handle))
|
if (!cogl_is_buffer (handle))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (G_UNLIKELY (hint > COGL_BUFFER_USAGE_HINT_COPY))
|
if (G_UNLIKELY (hint > COGL_BUFFER_USAGE_HINT_TEXTURE))
|
||||||
hint = COGL_BUFFER_USAGE_HINT_DRAW;
|
hint = COGL_BUFFER_USAGE_HINT_TEXTURE;
|
||||||
|
|
||||||
COGL_BUFFER (handle)->usage_hint = hint;
|
COGL_BUFFER (handle)->usage_hint = hint;
|
||||||
}
|
}
|
||||||
|
@ -75,12 +75,8 @@ cogl_buffer_get_size (CoglHandle handle);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* CoglBufferUsageHint:
|
* CoglBufferUsageHint:
|
||||||
* @COGL_BUFFER_USAGE_HINT_DRAW: the buffer will be used as a source for
|
* @COGL_BUFFER_USAGE_HINT_TEXTURE: the buffer will be used as a source data
|
||||||
* drawing commands (e.g. texture), the data coming from the application
|
* for a texture
|
||||||
* @COGL_BUFFER_USAGE_HINT_READ: the buffer will be read by the application,
|
|
||||||
* the data store being modified by the GPU
|
|
||||||
* @COGL_BUFFER_USAGE_HINT_COPY: the buffer will be used as a source for
|
|
||||||
* drawing commands, the data coming from the GPU
|
|
||||||
*
|
*
|
||||||
* The usage hint on a buffer allows the user to give some clue on how the
|
* The usage hint on a buffer allows the user to give some clue on how the
|
||||||
* buffer will be used.
|
* buffer will be used.
|
||||||
@ -89,9 +85,7 @@ cogl_buffer_get_size (CoglHandle handle);
|
|||||||
* Stability: Unstable
|
* Stability: Unstable
|
||||||
*/
|
*/
|
||||||
typedef enum { /*< prefix=COGL_BUFFER_USAGE_HINT >*/
|
typedef enum { /*< prefix=COGL_BUFFER_USAGE_HINT >*/
|
||||||
COGL_BUFFER_USAGE_HINT_DRAW,
|
COGL_BUFFER_USAGE_HINT_TEXTURE,
|
||||||
COGL_BUFFER_USAGE_HINT_READ,
|
|
||||||
COGL_BUFFER_USAGE_HINT_COPY,
|
|
||||||
} CoglBufferUsageHint;
|
} CoglBufferUsageHint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -148,7 +148,7 @@ cogl_pixel_buffer_new_EXP (guint size)
|
|||||||
/* parent's constructor */
|
/* parent's constructor */
|
||||||
_cogl_buffer_initialize (buffer,
|
_cogl_buffer_initialize (buffer,
|
||||||
size,
|
size,
|
||||||
COGL_BUFFER_USAGE_HINT_DRAW,
|
COGL_BUFFER_USAGE_HINT_TEXTURE,
|
||||||
COGL_BUFFER_UPDATE_HINT_STATIC);
|
COGL_BUFFER_UPDATE_HINT_STATIC);
|
||||||
|
|
||||||
/* malloc version only for GLES */
|
/* malloc version only for GLES */
|
||||||
|
Loading…
Reference in New Issue
Block a user