Top | ![]() |
![]() |
![]() |
![]() |
struct | UfoBuffer |
#define | UFO_BUFFER_MAX_NDIMS |
struct | UfoBufferClass |
struct | UfoBufferParamSpec |
struct | UfoRequisition |
struct | UfoRegion |
enum | UfoBufferDepth |
enum | UfoBufferLocation |
enum | UfoBufferLayout |
#define UFO_BUFFER_PARAM_SPEC(pspec) (G_TYPE_CHECK_INSTANCE_CAST((pspec), UFO_TYPE_PARAM_BUFFER, UfoBufferParamSpec))
UfoBuffer * ufo_buffer_new (UfoRequisition *requisition
,);
gpointer context
Create a new UfoBuffer.
UfoBuffer * ufo_buffer_new_with_size (,
GList *dims);
gpointer context
Create a new UfoBuffer with a list of dimensions.
UfoBuffer * ufo_buffer_new_with_data (UfoRequisition *requisition
,,
gpointer data);
gpointer context
Create a new buffer using existing host memory.
void ufo_buffer_resize (UfoBuffer *buffer
,UfoRequisition *requisition
);
Resize an existing buffer. If the new requisition has the same size as before, resizing is a no-op.
Since:
gint ufo_buffer_cmp_dimensions (UfoBuffer *buffer
,UfoRequisition *requisition
);
Compare the size of buffer
with a given requisition
.
void ufo_buffer_get_requisition (UfoBuffer *buffer
,UfoRequisition *requisition
);
Return the size of buffer
.
gsize ufo_buffer_get_size (UfoBuffer *buffer
);
Get the number of bytes of raw data that is managed by the buffer
.
void ufo_buffer_copy (UfoBuffer *src
,UfoBuffer *dst
);
Copy contents of src
to dst
. The final memory location is determined by the
destination buffer.
UfoBuffer *
ufo_buffer_dup (UfoBuffer *buffer
);
Create a new buffer with the same requisition as buffer
. Note, that this is
not a copy of buffer
!
void ufo_buffer_swap_data (UfoBuffer *src
,UfoBuffer *dst
);
Swap the *content* of the two buffers if possible (i.e. data resides on the
same memory type) or copy from src
to dst
otherwise.
Since:
void ufo_buffer_set_host_array (UfoBuffer *buffer
,,
gpointer array);
gboolean free_data
Use this function to set a host array with a user-provided memory buffer. This is useful to expose private data of a generator filter to a subsequent consumer. Note, that the buffer *must* have an appropriate size.
void ufo_buffer_copy_host_array (UfoBuffer *buffer
,);
gpointer array
Copy data into the buffer.
gfloat * ufo_buffer_get_host_array (UfoBuffer *buffer
,);
gpointer cmd_queue
Returns a flat C-array containing the raw float data.
void ufo_buffer_set_device_array (UfoBuffer *buffer
,,
gpointer array);
gboolean free_data
Set the current cl_mem object.
buffer |
A UfoBuffer. |
|
array |
A cl_mem object. |
|
free_data |
|
gpointer ufo_buffer_get_device_array (UfoBuffer *buffer
,);
gpointer cmd_queue
Return the current cl_mem object of buffer
. If the data is not yet in device
memory, it is transfered via cmd_queue
to the object. If cmd_queue
is NULL
cmd_queue
, the last used command queue is used.
gpointer ufo_buffer_get_device_array_view (UfoBuffer *buffer
,,
gpointer cmd_queueUfoRegion *region
);
This method creates a new memory buffer that must be freed by the user.
Moreover, the original buffer
is kept intact.
gpointer ufo_buffer_get_device_image (UfoBuffer *buffer
,);
gpointer cmd_queue
Return the current cl_mem image object of buffer
. If the data is not yet in
device memory, it is transfered via cmd_queue
to the object. If cmd_queue
is NULL
cmd_queue
, the last used command queue is used.
gpointer ufo_buffer_get_device_array_with_offset (UfoBuffer *buffer
,,
gpointer cmd_queue);
gsize offset
Creates a new cl_mem object with the given offset and a size that is the original size minus the offset.
UfoBufferLocation
ufo_buffer_get_location (UfoBuffer *buffer
);
Return current location of data backed by buffer
.
void ufo_buffer_discard_location (UfoBuffer *buffer
);
Discard the current and use the last location without copying to it first.
void ufo_buffer_set_layout (UfoBuffer *buffer
,UfoBufferLayout layout
);
Set layout of the buffer.
UfoBufferLayout
ufo_buffer_get_layout (UfoBuffer *buffer
);
Return current layout of buffer
.
void ufo_buffer_convert (UfoBuffer *buffer
,UfoBufferDepth depth
);
Convert host data according to its depth
to the internal 32-bit floating
point representation.
void ufo_buffer_convert_from_data (UfoBuffer *buffer
,,
gconstpointer dataUfoBufferDepth depth
);
Convert data
according from depth
to the internal 32-bit floating
point representation.
Note: data
must provide as many bytes as the buffer was initialized with.
GValue * ufo_buffer_get_metadata (UfoBuffer *buffer
,const
);gchar *name
Retrieve meta data.
void ufo_buffer_set_metadata (UfoBuffer *buffer
,const
,gchar *name);
GValue *value
Associates a key-value pair with buffer
.
void ufo_buffer_copy_metadata (UfoBuffer *src
,UfoBuffer *dst
);
Copies meta data content from src
to dst
.
GList * ufo_buffer_get_metadata_keys (UfoBuffer *buffer
);
Get all meta data keys associated with buffer
.
gfloat ufo_buffer_max (UfoBuffer *buffer
,);
gpointer cmd_queue
Return the maximum value of buffer
.
gfloat ufo_buffer_min (UfoBuffer *buffer
,);
gpointer cmd_queue
Return the minimum value of buffer
.
GParamSpec * ufo_buffer_param_spec (const
,gchar *nameconst
,gchar *nickconst
,gchar *blurbUfoBuffer *default_value
,);
GParamFlags flags
Creates a new UfoBufferParamSpec instance specifying a
struct UfoBuffer;
Represents n-dimensional data. The contents of the UfoBuffer structure are private and should only be accessed via the provided API.
#define UFO_BUFFER_MAX_NDIMS 3
Maximum number of allowed dimensions. This is a pre-processor macro instead of const variable because of C constraints.
struct UfoRequisition { guint n_dims; gsize dims[UFO_BUFFER_MAX_NDIMS]; };
Used to specify buffer size requirements.
struct UfoRegion { gsize origin[UFO_BUFFER_MAX_NDIMS]; gsize size[UFO_BUFFER_MAX_NDIMS]; };
Defines a region with at most UFO_BUFFER_MAX_NDIMS dimensions for use with
ufo_buffer_get_device_array_view()
.
Source depth of data as used in ufo_buffer_convert()
.