summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2014-08-09 22:26:46 +0200
committerMarek Olšák <[email protected]>2014-08-10 12:52:13 +0200
commita65611f70abc91f86e41aeaf5fa1941e3440feb6 (patch)
tree73788d12334cb055749f2f729087eced0d52c0aa /src/gallium/drivers
parentb1843a2d2a7a332511629aa8b9dab8168cde9031 (diff)
radeonsi: simplify constant buffer upload for big endian
Point util_memcpy_cpu_to_le32 to a buffer storage directly. v2: simplify more Reviewed-by: Michel Dänzer <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/radeonsi/si_descriptors.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
index 81ad14b0335..c877797b83c 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -648,25 +648,11 @@ void si_update_vertex_buffers(struct si_context *sctx)
void si_upload_const_buffer(struct si_context *sctx, struct r600_resource **rbuffer,
const uint8_t *ptr, unsigned size, uint32_t *const_offset)
{
- if (SI_BIG_ENDIAN) {
- uint32_t *tmpPtr;
- unsigned i;
+ void *tmp;
- if (!(tmpPtr = malloc(size))) {
- R600_ERR("Failed to allocate BE swap buffer.\n");
- return;
- }
-
- util_memcpy_cpu_to_le32(tmpPtr, ptr, size);
-
- u_upload_data(sctx->b.uploader, 0, size, tmpPtr, const_offset,
- (struct pipe_resource**)rbuffer);
-
- free(tmpPtr);
- } else {
- u_upload_data(sctx->b.uploader, 0, size, ptr, const_offset,
- (struct pipe_resource**)rbuffer);
- }
+ u_upload_alloc(sctx->b.uploader, 0, size, const_offset,
+ (struct pipe_resource**)rbuffer, &tmp);
+ util_memcpy_cpu_to_le32(tmp, ptr, size);
}
static void si_set_constant_buffer(struct pipe_context *ctx, uint shader, uint slot,