gallium/u_upload_mgr: add a helper that creates the default uploader
authorMarek Olšák <marek.olsak@amd.com>
Thu, 26 Jan 2017 22:27:36 +0000 (23:27 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 14 Feb 2017 20:46:16 +0000 (21:46 +0100)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Tested-by: Charmaine Lee <charmainel@vmware.com>
src/gallium/auxiliary/util/u_upload_mgr.c
src/gallium/auxiliary/util/u_upload_mgr.h

index cfef1f0693b8a99160b078a1006d27daa99580ad..11662e7e9b38abef3b6748d2d6e72a1666e83235 100644 (file)
@@ -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)
 {
index b36e9e5d9dbfaa21e642bbc760600b36f2e6ce39..fcd6235847feb60f5644467da07bd94a5143d950 100644 (file)
@@ -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.
  */