diff options
author | Christian König <[email protected]> | 2011-05-07 14:11:40 +0200 |
---|---|---|
committer | Christian König <[email protected]> | 2011-05-07 14:11:40 +0200 |
commit | 213b9004a6ee033a16af3dcd187aa68b56c39858 (patch) | |
tree | f577f4dc276f70dad63f102f69f87f4d566186ef /src/gallium/drivers/r600/r600_buffer.c | |
parent | 6ad846ee78d9d8ba93dcecdefbf89f2b981333ef (diff) | |
parent | 03615c02d81437cf546609fc6a39c6c73be39360 (diff) |
Merge remote-tracking branch 'origin/master' into pipe-video
Conflicts:
src/gallium/drivers/r600/r600_state.c
Diffstat (limited to 'src/gallium/drivers/r600/r600_buffer.c')
-rw-r--r-- | src/gallium/drivers/r600/r600_buffer.c | 44 |
1 files changed, 18 insertions, 26 deletions
diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c index 71b47e1b056..72f352df3c3 100644 --- a/src/gallium/drivers/r600/r600_buffer.c +++ b/src/gallium/drivers/r600/r600_buffer.c @@ -81,18 +81,11 @@ static void *r600_buffer_transfer_map(struct pipe_context *pipe, struct pipe_transfer *transfer) { struct r600_resource_buffer *rbuffer = r600_buffer(transfer->resource); - int write = 0; uint8_t *data; if (rbuffer->r.b.user_ptr) return (uint8_t*)rbuffer->r.b.user_ptr + transfer->box.x; - if (transfer->usage & PIPE_TRANSFER_DONTBLOCK) { - /* FIXME */ - } - if (transfer->usage & PIPE_TRANSFER_WRITE) { - write = 1; - } data = r600_bo_map((struct radeon*)pipe->winsys, rbuffer->r.bo, transfer->usage, pipe); if (!data) return NULL; @@ -268,31 +261,30 @@ void r600_upload_const_buffer(struct r600_pipe_context *rctx, struct r600_resour uint8_t *ptr = (*rbuffer)->r.b.user_ptr; unsigned size = (*rbuffer)->r.b.b.b.width0; boolean flushed; -#ifdef PIPE_ARCH_BIG_ENDIAN - int i; - uint32_t *tmpPtr; *rbuffer = NULL; - tmpPtr = (uint32_t *)malloc(size); - /* big endian swap */ - if(tmpPtr == NULL) { - return; - } - for(i = 0; i < size / 4; i++) { - tmpPtr[i] = bswap_32(*((uint32_t *)ptr + i)); - } + if (R600_BIG_ENDIAN) { + uint32_t *tmpPtr; + unsigned i; - u_upload_data(rctx->vbuf_mgr->uploader, 0, size, tmpPtr, const_offset, - (struct pipe_resource**)rbuffer, &flushed); + if (!(tmpPtr = malloc(size))) { + R600_ERR("Failed to allocate BE swap buffer.\n"); + return; + } - free(tmpPtr); -#else - *rbuffer = NULL; + for (i = 0; i < size / 4; ++i) { + tmpPtr[i] = bswap_32(((uint32_t *)ptr)[i]); + } + + u_upload_data(rctx->vbuf_mgr->uploader, 0, size, tmpPtr, const_offset, + (struct pipe_resource**)rbuffer, &flushed); - u_upload_data(rctx->vbuf_mgr->uploader, 0, size, ptr, const_offset, - (struct pipe_resource**)rbuffer, &flushed); -#endif + free(tmpPtr); + } else { + u_upload_data(rctx->vbuf_mgr->uploader, 0, size, ptr, const_offset, + (struct pipe_resource**)rbuffer, &flushed); + } } else { *const_offset = 0; } |