1 /**************************************************************************
3 * Copyright 2009 VMware, Inc.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
28 /* Helper utility for uploading user buffers & other data, and
29 * coalescing small buffers into larger ones.
32 #ifndef U_UPLOAD_MGR_H
33 #define U_UPLOAD_MGR_H
40 struct u_upload_mgr
*u_upload_create( struct pipe_screen
*screen
,
41 unsigned default_size
,
45 void u_upload_destroy( struct u_upload_mgr
*upload
);
47 /* Unmap and release old buffer.
49 * This must usually be called prior to firing the command stream
50 * which references the upload buffer, as many memory managers either
51 * don't like firing a mapped buffer or cause subsequent maps of a
52 * fired buffer to wait. For now, it's easiest just to grab a new
55 void u_upload_flush( struct u_upload_mgr
*upload
);
58 enum pipe_error
u_upload_data( struct u_upload_mgr
*upload
,
62 struct pipe_buffer
**outbuf
);
65 enum pipe_error
u_upload_buffer( struct u_upload_mgr
*upload
,
68 struct pipe_buffer
*inbuf
,
70 struct pipe_buffer
**outbuf
);