[Mesa-dev] [PATCH 02/13] gallium/u_upload: add u_upload_clone
Marek Olšák
maraeo at gmail.com
Wed May 10 22:45:35 UTC 2017
From: Marek Olšák <marek.olsak at amd.com>
---
src/gallium/auxiliary/util/u_upload_mgr.c | 7 +++++++
src/gallium/auxiliary/util/u_upload_mgr.h | 7 +++++++
2 files changed, 14 insertions(+)
diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c
index 32697b8..9528495 100644
--- a/src/gallium/auxiliary/util/u_upload_mgr.c
+++ b/src/gallium/auxiliary/util/u_upload_mgr.c
@@ -90,20 +90,27 @@ u_upload_create(struct pipe_context *pipe, unsigned default_size,
struct u_upload_mgr *
u_upload_create_default(struct pipe_context *pipe)
{
return u_upload_create(pipe, 1024 * 1024,
PIPE_BIND_VERTEX_BUFFER |
PIPE_BIND_INDEX_BUFFER |
PIPE_BIND_CONSTANT_BUFFER,
PIPE_USAGE_STREAM);
}
+struct u_upload_mgr *
+u_upload_clone(struct pipe_context *pipe, struct u_upload_mgr *upload)
+{
+ return u_upload_create(pipe, upload->default_size, upload->bind,
+ upload->usage);
+}
+
static void upload_unmap_internal(struct u_upload_mgr *upload, boolean destroying)
{
if (!destroying && upload->map_persistent)
return;
if (upload->transfer) {
struct pipe_box *box = &upload->transfer->box;
if (!upload->map_persistent && (int) upload->offset > box->x) {
pipe_buffer_flush_mapped_range(upload->pipe, upload->transfer,
diff --git a/src/gallium/auxiliary/util/u_upload_mgr.h b/src/gallium/auxiliary/util/u_upload_mgr.h
index 4538291..536467e 100644
--- a/src/gallium/auxiliary/util/u_upload_mgr.h
+++ b/src/gallium/auxiliary/util/u_upload_mgr.h
@@ -55,20 +55,27 @@ u_upload_create(struct pipe_context *pipe, unsigned default_size,
unsigned bind, enum pipe_resource_usage usage);
/**
* Create the default uploader for pipe_context. Only pipe_context::screen
* needs to be set for this to succeed.
*/
struct u_upload_mgr *
u_upload_create_default(struct pipe_context *pipe);
/**
+ * Create an uploader with identical parameters as another one, but using
+ * the given pipe_context instead.
+ */
+struct u_upload_mgr *
+u_upload_clone(struct pipe_context *pipe, struct u_upload_mgr *upload);
+
+/**
* Destroy the upload manager.
*/
void u_upload_destroy( struct u_upload_mgr *upload );
/**
* Unmap upload buffer
*
* \param upload Upload manager
*
* This must usually be called prior to firing the command stream
--
2.7.4
More information about the mesa-dev
mailing list