summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi/r600_buffer.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-04-26 13:39:19 +0200
committerMarek Olšák <[email protected]>2012-04-30 01:18:48 +0200
commit65d451d9fa1192c386301ca0b84b6c5cd369f92d (patch)
tree43b4111d1dd22f2e074c0bf4e87f969b949b2d03 /src/gallium/drivers/radeonsi/r600_buffer.c
parent0b7d48cbad86eaac21fce3793da41b46db8be3b4 (diff)
radeonsi: don't create temporary user buffer for r600_upload_const_buffer
Diffstat (limited to 'src/gallium/drivers/radeonsi/r600_buffer.c')
-rw-r--r--src/gallium/drivers/radeonsi/r600_buffer.c42
1 files changed, 18 insertions, 24 deletions
diff --git a/src/gallium/drivers/radeonsi/r600_buffer.c b/src/gallium/drivers/radeonsi/r600_buffer.c
index 7e8e2ca6887..d21b5b61147 100644
--- a/src/gallium/drivers/radeonsi/r600_buffer.c
+++ b/src/gallium/drivers/radeonsi/r600_buffer.c
@@ -216,36 +216,30 @@ void r600_upload_index_buffer(struct r600_context *rctx,
}
void r600_upload_const_buffer(struct r600_context *rctx, struct r600_resource **rbuffer,
- uint32_t *const_offset)
+ const uint8_t *ptr, unsigned size,
+ uint32_t *const_offset)
{
- if ((*rbuffer)->b.b.user_ptr) {
- uint8_t *ptr = (*rbuffer)->b.b.user_ptr;
- unsigned size = (*rbuffer)->b.b.width0;
+ *rbuffer = NULL;
- *rbuffer = NULL;
+ if (R600_BIG_ENDIAN) {
+ uint32_t *tmpPtr;
+ unsigned i;
- if (R600_BIG_ENDIAN) {
- uint32_t *tmpPtr;
- unsigned i;
-
- if (!(tmpPtr = malloc(size))) {
- R600_ERR("Failed to allocate BE swap buffer.\n");
- return;
- }
+ if (!(tmpPtr = malloc(size))) {
+ R600_ERR("Failed to allocate BE swap buffer.\n");
+ return;
+ }
- for (i = 0; i < size / 4; ++i) {
- tmpPtr[i] = bswap_32(((uint32_t *)ptr)[i]);
- }
+ for (i = 0; i < size / 4; ++i) {
+ tmpPtr[i] = bswap_32(((uint32_t *)ptr)[i]);
+ }
- u_upload_data(rctx->uploader, 0, size, tmpPtr, const_offset,
- (struct pipe_resource**)rbuffer);
+ u_upload_data(rctx->uploader, 0, size, tmpPtr, const_offset,
+ (struct pipe_resource**)rbuffer);
- free(tmpPtr);
- } else {
- u_upload_data(rctx->uploader, 0, size, ptr, const_offset,
- (struct pipe_resource**)rbuffer);
- }
+ free(tmpPtr);
} else {
- *const_offset = 0;
+ u_upload_data(rctx->uploader, 0, size, ptr, const_offset,
+ (struct pipe_resource**)rbuffer);
}
}