diff options
author | Marek Olšák <[email protected]> | 2014-01-28 00:53:28 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2014-02-25 16:07:33 +0100 |
commit | 04fb4bf61bc2ca93a661a261b8323358b0d515a1 (patch) | |
tree | d11d54b2634e87c540308babf50005d11c6eaa03 /src/gallium | |
parent | 7ea3f6bce5fad2cebf88ab0a44687039b4a23ee8 (diff) |
gallium/upload_mgr: remove useless variable "size"
Reviewed-by: Fredrik Höglund <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/auxiliary/util/u_upload_mgr.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c index 786ecaf6f4b..744ea2e5e0c 100644 --- a/src/gallium/auxiliary/util/u_upload_mgr.c +++ b/src/gallium/auxiliary/util/u_upload_mgr.c @@ -50,7 +50,6 @@ struct u_upload_mgr { struct pipe_resource *buffer; /* Upload buffer. */ struct pipe_transfer *transfer; /* Transfer object for the upload buffer. */ uint8_t *map; /* Pointer to the mapped upload buffer. */ - unsigned size; /* Actual size of the upload buffer. */ unsigned offset; /* Aligned offset to the upload buffer, pointing * at the first unused byte. */ }; @@ -120,7 +119,6 @@ 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 ); - upload->size = 0; } @@ -173,12 +171,10 @@ u_upload_alloc_buffer( struct u_upload_mgr *upload, &upload->transfer); if (upload->map == NULL) { upload->transfer = NULL; - upload->size = 0; pipe_resource_reference(&upload->buffer, NULL); return PIPE_ERROR_OUT_OF_MEMORY; } - upload->size = size; upload->offset = 0; return PIPE_OK; } @@ -203,7 +199,8 @@ enum pipe_error u_upload_alloc( struct u_upload_mgr *upload, /* Make sure we have enough space in the upload buffer * for the sub-allocation. */ - if (MAX2(upload->offset, alloc_offset) + alloc_size > upload->size) { + if (!upload->buffer || + MAX2(upload->offset, alloc_offset) + alloc_size > upload->buffer->width0) { enum pipe_error ret = u_upload_alloc_buffer(upload, alloc_offset + alloc_size); if (ret != PIPE_OK) @@ -214,7 +211,8 @@ enum pipe_error u_upload_alloc( struct u_upload_mgr *upload, if (!upload->map) { upload->map = pipe_buffer_map_range(upload->pipe, upload->buffer, - offset, upload->size - offset, + offset, + upload->buffer->width0 - offset, upload->map_flags, &upload->transfer); if (!upload->map) { |