gallium/u_upload: add u_upload_clone
authorMarek Olšák <marek.olsak@amd.com>
Sat, 18 Feb 2017 22:01:14 +0000 (23:01 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 15 May 2017 11:01:33 +0000 (13:01 +0200)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
src/gallium/auxiliary/util/u_upload_mgr.c
src/gallium/auxiliary/util/u_upload_mgr.h

index 32697b8eda3e935c60a1c69032cbdbfe123ccc24..9528495038c1e9d9832055df47742d8bd3d8afb3 100644 (file)
@@ -97,6 +97,13 @@ u_upload_create_default(struct pipe_context *pipe)
                           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)
index 45382917021bf9565271def87fe20f34a50baa28..536467eb35c696535aa9ea6154c8ea96cf88f53d 100644 (file)
@@ -61,6 +61,13 @@ u_upload_create(struct pipe_context *pipe, unsigned default_size,
 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.
  */