summaryrefslogtreecommitdiffstats
path: root/src/gallium/include/pipe
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-10-08 04:06:42 +0200
committerMarek Olšák <[email protected]>2012-10-11 21:12:16 +0200
commit369e46888904c6d379b8b477d9242cff1608e30e (patch)
tree528b10f900f23af3acd22a0edcf50fde0eeee86e /src/gallium/include/pipe
parentec4c74a9dc10039d97ad24c4f16bd2400517991d (diff)
gallium: unify transfer functions
"get_transfer + transfer_map" becomes "transfer_map". "transfer_unmap + transfer_destroy" becomes "transfer_unmap". transfer_map must create and return the transfer object and transfer_unmap must destroy it. transfer_map is successful if the returned buffer pointer is not NULL. If transfer_map fails, the pointer to the transfer object remains unchanged (i.e. doesn't have to be NULL). Acked-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/include/pipe')
-rw-r--r--src/gallium/include/pipe/p_context.h31
-rw-r--r--src/gallium/include/pipe/p_defines.h6
2 files changed, 18 insertions, 19 deletions
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index 09760ddbe0f..761761da773 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -60,6 +60,7 @@ struct pipe_shader_state;
struct pipe_stencil_ref;
struct pipe_stream_output_target;
struct pipe_surface;
+struct pipe_transfer;
struct pipe_vertex_buffer;
struct pipe_vertex_element;
struct pipe_video_buffer;
@@ -374,22 +375,21 @@ struct pipe_context {
struct pipe_surface *);
/**
- * Get a transfer object for transferring data to/from a texture.
+ * Map a resource.
*
* Transfers are (by default) context-private and allow uploads to be
- * interleaved with
+ * interleaved with rendering.
+ *
+ * out_transfer will contain the transfer object that must be passed
+ * to all the other transfer functions. It also contains useful
+ * information (like texture strides).
*/
- struct pipe_transfer *(*get_transfer)(struct pipe_context *,
- struct pipe_resource *resource,
- unsigned level,
- unsigned usage, /* a combination of PIPE_TRANSFER_x */
- const struct pipe_box *);
-
- void (*transfer_destroy)(struct pipe_context *,
- struct pipe_transfer *);
-
- void *(*transfer_map)( struct pipe_context *,
- struct pipe_transfer *transfer );
+ void *(*transfer_map)(struct pipe_context *,
+ struct pipe_resource *resource,
+ unsigned level,
+ unsigned usage, /* a combination of PIPE_TRANSFER_x */
+ const struct pipe_box *,
+ struct pipe_transfer **out_transfer);
/* If transfer was created with WRITE|FLUSH_EXPLICIT, only the
* regions specified with this call are guaranteed to be written to
@@ -399,9 +399,8 @@ struct pipe_context {
struct pipe_transfer *transfer,
const struct pipe_box *);
- void (*transfer_unmap)( struct pipe_context *,
- struct pipe_transfer *transfer );
-
+ void (*transfer_unmap)(struct pipe_context *,
+ struct pipe_transfer *transfer);
/* One-shot transfer operation with data supplied in a user
* pointer. XXX: strides??
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index aed1ea60207..b145bc0e8ee 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -205,7 +205,7 @@ enum pipe_transfer_usage {
PIPE_TRANSFER_READ = (1 << 0),
/**
- * Resource contents will be written back at transfer_destroy
+ * Resource contents will be written back at transfer_unmap
* time (or modified as a result of being accessed directly).
*/
PIPE_TRANSFER_WRITE = (1 << 1),
@@ -300,8 +300,8 @@ enum pipe_transfer_usage {
#define PIPE_BIND_INDEX_BUFFER (1 << 5) /* draw_elements */
#define PIPE_BIND_CONSTANT_BUFFER (1 << 6) /* set_constant_buffer */
#define PIPE_BIND_DISPLAY_TARGET (1 << 8) /* flush_front_buffer */
-#define PIPE_BIND_TRANSFER_WRITE (1 << 9) /* get_transfer */
-#define PIPE_BIND_TRANSFER_READ (1 << 10) /* get_transfer */
+#define PIPE_BIND_TRANSFER_WRITE (1 << 9) /* transfer_map */
+#define PIPE_BIND_TRANSFER_READ (1 << 10) /* transfer_map */
#define PIPE_BIND_STREAM_OUTPUT (1 << 11) /* set_stream_output_buffers */
#define PIPE_BIND_CURSOR (1 << 16) /* mouse cursor */
#define PIPE_BIND_CUSTOM (1 << 17) /* state-tracker/winsys usages */