From 998396c32e4e95fef5a1efef6cb1a9efb0868aa6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Thu, 26 Jan 2017 23:27:36 +0100 Subject: [PATCH] gallium/u_upload_mgr: add a helper that creates the default uploader MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Nicolai Hähnle Tested-by: Edmondo Tommasina Tested-by: Charmaine Lee --- src/gallium/auxiliary/util/u_upload_mgr.c | 9 +++++++++ src/gallium/auxiliary/util/u_upload_mgr.h | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c index cfef1f0693b..11662e7e9b3 100644 --- a/src/gallium/auxiliary/util/u_upload_mgr.c +++ b/src/gallium/auxiliary/util/u_upload_mgr.c @@ -86,6 +86,15 @@ u_upload_create(struct pipe_context *pipe, unsigned default_size, return upload; } +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); +} static void upload_unmap_internal(struct u_upload_mgr *upload, boolean destroying) { diff --git a/src/gallium/auxiliary/util/u_upload_mgr.h b/src/gallium/auxiliary/util/u_upload_mgr.h index b36e9e5d9db..fcd6235847f 100644 --- a/src/gallium/auxiliary/util/u_upload_mgr.h +++ b/src/gallium/auxiliary/util/u_upload_mgr.h @@ -51,6 +51,13 @@ struct u_upload_mgr * 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); + /** * Destroy the upload manager. */ -- 2.30.2