/**************************************************************************
- *
+ *
* Copyright 2009 VMware, Inc.
* All Rights Reserved.
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
- *
+ *
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
+ *
**************************************************************************/
/* Helper utility for uploading user buffers & other data, and
u_upload_create(struct pipe_context *pipe, unsigned default_size,
unsigned bind, enum pipe_resource_usage usage)
{
- struct u_upload_mgr *upload = CALLOC_STRUCT( u_upload_mgr );
+ struct u_upload_mgr *upload = CALLOC_STRUCT(u_upload_mgr);
if (!upload)
return NULL;
upload->usage);
}
-static void upload_unmap_internal(struct u_upload_mgr *upload, boolean destroying)
+static void
+upload_unmap_internal(struct u_upload_mgr *upload, boolean destroying)
{
if (!destroying && upload->map_persistent)
return;
}
-void u_upload_unmap( struct u_upload_mgr *upload )
+void
+u_upload_unmap(struct u_upload_mgr *upload)
{
upload_unmap_internal(upload, FALSE);
}
-static void u_upload_release_buffer(struct u_upload_mgr *upload)
+static void
+u_upload_release_buffer(struct u_upload_mgr *upload)
{
/* Unmap and unreference the upload buffer. */
upload_unmap_internal(upload, TRUE);
- pipe_resource_reference( &upload->buffer, NULL );
+ pipe_resource_reference(&upload->buffer, NULL);
}
-void u_upload_destroy( struct u_upload_mgr *upload )
+void
+u_upload_destroy(struct u_upload_mgr *upload)
{
- u_upload_release_buffer( upload );
- FREE( upload );
+ u_upload_release_buffer(upload);
+ FREE(upload);
}
static void
-u_upload_alloc_buffer(struct u_upload_mgr *upload,
- unsigned min_size)
+u_upload_alloc_buffer(struct u_upload_mgr *upload, unsigned min_size)
{
struct pipe_screen *screen = upload->pipe->screen;
struct pipe_resource buffer;
/* Release the old buffer, if present:
*/
- u_upload_release_buffer( upload );
+ u_upload_release_buffer(upload);
- /* Allocate a new one:
+ /* Allocate a new one:
*/
size = align(MAX2(upload->default_size, min_size), 4096);
offset,
buffer_size - offset,
upload->map_flags,
- &upload->transfer);
+ &upload->transfer);
if (unlikely(!upload->map)) {
upload->transfer = NULL;
*out_offset = ~0;
upload->offset = offset + size;
}
-void u_upload_data(struct u_upload_mgr *upload,
- unsigned min_out_offset,
- unsigned size,
- unsigned alignment,
- const void *data,
- unsigned *out_offset,
- struct pipe_resource **outbuf)
+void
+u_upload_data(struct u_upload_mgr *upload,
+ unsigned min_out_offset,
+ unsigned size,
+ unsigned alignment,
+ const void *data,
+ unsigned *out_offset,
+ struct pipe_resource **outbuf)
{
uint8_t *ptr;