From dca19b1d427f0ecbc0bbd530d1fc3f6c0ce2b5c1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 18 Feb 2017 23:01:14 +0100 Subject: [PATCH] gallium/u_upload: add u_upload_clone MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Nicolai Hähnle Tested-by: Dieter Nützel --- 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 32697b8eda3..9528495038c 100644 --- a/src/gallium/auxiliary/util/u_upload_mgr.c +++ b/src/gallium/auxiliary/util/u_upload_mgr.c @@ -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) diff --git a/src/gallium/auxiliary/util/u_upload_mgr.h b/src/gallium/auxiliary/util/u_upload_mgr.h index 45382917021..536467eb35c 100644 --- a/src/gallium/auxiliary/util/u_upload_mgr.h +++ b/src/gallium/auxiliary/util/u_upload_mgr.h @@ -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. */ -- 2.30.2