summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2015-09-02 15:08:23 +0200
committerMarek Olšák <marek.olsak@amd.com>2015-09-03 18:14:09 +0200
commit8c6ff05517137ab9d96015783fcf1bf9d8d1fa12 (patch)
tree67cd2a9eec656895b803ac74f17054cfe9382369 /src/gallium/auxiliary
parent6c1e368cf38e02174a8c88218ae711ab0b27954f (diff)
downloadexternal_mesa3d-8c6ff05517137ab9d96015783fcf1bf9d8d1fa12.zip
external_mesa3d-8c6ff05517137ab9d96015783fcf1bf9d8d1fa12.tar.gz
external_mesa3d-8c6ff05517137ab9d96015783fcf1bf9d8d1fa12.tar.bz2
u_upload_mgr: remove the return value from u_upload_alloc
The return buffer or the returned pointer can be used instead. Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/util/u_upload_mgr.c29
-rw-r--r--src/gallium/auxiliary/util/u_upload_mgr.h12
-rw-r--r--src/gallium/auxiliary/util/u_vbuf.c27
3 files changed, 34 insertions, 34 deletions
diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c
index 4c56084..7826b61 100644
--- a/src/gallium/auxiliary/util/u_upload_mgr.c
+++ b/src/gallium/auxiliary/util/u_upload_mgr.c
@@ -179,12 +179,13 @@ u_upload_alloc_buffer( struct u_upload_mgr *upload,
return PIPE_OK;
}
-enum pipe_error u_upload_alloc( struct u_upload_mgr *upload,
- unsigned min_out_offset,
- unsigned size,
- unsigned *out_offset,
- struct pipe_resource **outbuf,
- void **ptr )
+void
+u_upload_alloc(struct u_upload_mgr *upload,
+ unsigned min_out_offset,
+ unsigned size,
+ unsigned *out_offset,
+ struct pipe_resource **outbuf,
+ void **ptr)
{
unsigned alloc_size = align(size, upload->alignment);
unsigned alloc_offset = align(min_out_offset, upload->alignment);
@@ -200,7 +201,7 @@ enum pipe_error u_upload_alloc( struct u_upload_mgr *upload,
*out_offset = ~0;
pipe_resource_reference(outbuf, NULL);
*ptr = NULL;
- return ret;
+ return;
}
buffer_size = upload->buffer->width0;
@@ -219,7 +220,7 @@ enum pipe_error u_upload_alloc( struct u_upload_mgr *upload,
*out_offset = ~0;
pipe_resource_reference(outbuf, NULL);
*ptr = NULL;
- return PIPE_ERROR_OUT_OF_MEMORY;
+ return;
}
upload->map -= offset;
@@ -235,7 +236,6 @@ enum pipe_error u_upload_alloc( struct u_upload_mgr *upload,
*out_offset = offset;
upload->offset = offset + alloc_size;
- return PIPE_OK;
}
enum pipe_error u_upload_data( struct u_upload_mgr *upload,
@@ -246,11 +246,12 @@ enum pipe_error u_upload_data( struct u_upload_mgr *upload,
struct pipe_resource **outbuf)
{
uint8_t *ptr;
- enum pipe_error ret = u_upload_alloc(upload, min_out_offset, size,
- out_offset, outbuf,
- (void**)&ptr);
- if (ret != PIPE_OK)
- return ret;
+
+ u_upload_alloc(upload, min_out_offset, size,
+ out_offset, outbuf,
+ (void**)&ptr);
+ if (!outbuf)
+ return PIPE_ERROR_OUT_OF_MEMORY;
memcpy(ptr, data, size);
return PIPE_OK;
diff --git a/src/gallium/auxiliary/util/u_upload_mgr.h b/src/gallium/auxiliary/util/u_upload_mgr.h
index 63bf30e..2c31977 100644
--- a/src/gallium/auxiliary/util/u_upload_mgr.h
+++ b/src/gallium/auxiliary/util/u_upload_mgr.h
@@ -78,12 +78,12 @@ void u_upload_unmap( struct u_upload_mgr *upload );
* \param outbuf Pointer to where the upload buffer will be returned.
* \param ptr Pointer to the allocated memory that is returned.
*/
-enum pipe_error u_upload_alloc( struct u_upload_mgr *upload,
- unsigned min_out_offset,
- unsigned size,
- unsigned *out_offset,
- struct pipe_resource **outbuf,
- void **ptr );
+void u_upload_alloc(struct u_upload_mgr *upload,
+ unsigned min_out_offset,
+ unsigned size,
+ unsigned *out_offset,
+ struct pipe_resource **outbuf,
+ void **ptr);
/**
diff --git a/src/gallium/auxiliary/util/u_vbuf.c b/src/gallium/auxiliary/util/u_vbuf.c
index 02ae0b8..791d82b 100644
--- a/src/gallium/auxiliary/util/u_vbuf.c
+++ b/src/gallium/auxiliary/util/u_vbuf.c
@@ -406,7 +406,6 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key,
struct pipe_resource *out_buffer = NULL;
uint8_t *out_map;
unsigned out_offset, mask;
- enum pipe_error err;
/* Get a translate object. */
tr = translate_cache_find(mgr->translate_cache, key);
@@ -454,12 +453,12 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key,
assert((ib->buffer || ib->user_buffer) && ib->index_size);
/* Create and map the output buffer. */
- err = u_upload_alloc(mgr->uploader, 0,
- key->output_stride * num_indices,
- &out_offset, &out_buffer,
- (void**)&out_map);
- if (err != PIPE_OK)
- return err;
+ u_upload_alloc(mgr->uploader, 0,
+ key->output_stride * num_indices,
+ &out_offset, &out_buffer,
+ (void**)&out_map);
+ if (!out_buffer)
+ return PIPE_ERROR_OUT_OF_MEMORY;
if (ib->user_buffer) {
map = (uint8_t*)ib->user_buffer + offset;
@@ -486,13 +485,13 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key,
}
} else {
/* Create and map the output buffer. */
- err = u_upload_alloc(mgr->uploader,
- key->output_stride * start_vertex,
- key->output_stride * num_vertices,
- &out_offset, &out_buffer,
- (void**)&out_map);
- if (err != PIPE_OK)
- return err;
+ u_upload_alloc(mgr->uploader,
+ key->output_stride * start_vertex,
+ key->output_stride * num_vertices,
+ &out_offset, &out_buffer,
+ (void**)&out_map);
+ if (!out_buffer)
+ return PIPE_ERROR_OUT_OF_MEMORY;
out_offset -= key->output_stride * start_vertex;