ector: add drawable flag to buffers

This indicates that a buffer can be used as a source to draw pixels.
Can't they all do that? Well, not exactly. A CPU buffer can't be drawn
by the GPU... not directly at least. That's what this flag is for.
This commit is contained in:
Jean-Philippe Andre 2015-12-15 19:58:43 +09:00
parent 9bd36f7c43
commit 1adc3cd915
2 changed files with 14 additions and 6 deletions

View File

@ -1,12 +1,13 @@
enum Ector.Buffer.Flag {
none = 0x00, [[Buffer may not have any backing]]
none = 0x00, [[Buffer may not have any backing, indicates an invalid buffer.]]
cpu_readable = 0x01, [[Can be read from the CPU after map. Reading may still be very slow.]]
cpu_writable = 0x02, [[Can be written to by the CPU after map. Writing may still be very slow.]]
renderable = 0x04, [[Can be rendered to, ie CPU memory for SW rendering, or an FBO for GL engine]]
cpu_readable_fast = 0x08, [[Can be read by the CPU at high speed, ie no need for glReadPixels]]
cpu_writable_fast = 0x0A, [[Can be written by the CPU at high speed, ie no need for GPU texture upload]]
uncached = 0x10, [[Backed by uncached memory, ie. slow-ish reads but faster than glReadPixels]]
/* non_coherent = 0x20, [[Memory may be mapped but will not be coherent between GPU and CPU. Call flush or invalidate to synchronize it.]] */
renderable = 0x04, [[Can be rendered to, ie CPU memory for SW rendering, or an FBO for GL engine.]]
drawable = 0x08, [[Can be used as a source of pixels to draw on Evas.]]
cpu_readable_fast = 0x10, [[Can be read by the CPU at high speed, ie no need for glReadPixels.]]
cpu_writable_fast = 0x20, [[Can be written by the CPU at high speed, ie no need for GPU texture upload.]]
uncached = 0x40, [[Backed by uncached memory, ie. slow-ish reads but faster than glReadPixels.]]
/* non_coherent = 0x80, [[Memory may be mapped but will not be coherent between GPU and CPU. Call flush or invalidate to synchronize it.]] */
}
enum Ector.Buffer.Access_Flag {

View File

@ -63,6 +63,12 @@ _ector_software_buffer_base_pixels_clear(Eo *obj, Ector_Software_Buffer_Base_Dat
if (!pd->pixels.u8)
return;
if (pd->internal.maps)
{
CRI("Can not call pixels_clear when the buffer is mapped.");
return;
}
eo_do(obj, eo_event_callback_call(ECTOR_GENERIC_BUFFER_EVENT_DETACHED, pd->pixels.u8));
if (!pd->nofree)
{
@ -320,6 +326,7 @@ EOLIAN static Ector_Buffer_Flag
_ector_software_buffer_base_ector_generic_buffer_flags_get(Eo *obj EINA_UNUSED, Ector_Software_Buffer_Base_Data *pd)
{
return ECTOR_BUFFER_FLAG_CPU_READABLE |
ECTOR_BUFFER_FLAG_DRAWABLE |
ECTOR_BUFFER_FLAG_CPU_READABLE_FAST |
ECTOR_BUFFER_FLAG_RENDERABLE |
(pd->writable ? (ECTOR_BUFFER_FLAG_CPU_WRITABLE |