diff options
author | Tom Stellard <[email protected]> | 2014-07-18 15:10:52 -0400 |
---|---|---|
committer | Tom Stellard <[email protected]> | 2014-07-28 10:14:28 -0400 |
commit | 6f0c1f2b5f8f1895878fcbf0b8d1b1ebcb719d70 (patch) | |
tree | fd5d2e6950831a7b9360e6669d1e2960dc6ec99a /src | |
parent | f0e0737922061f0eb38d5016c40d86226ee40e61 (diff) |
radeonsi: Use util_memcpy_cpu_to_le32()
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_descriptors.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.c | 23 |
2 files changed, 8 insertions, 19 deletions
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c index 4751b8b8f4f..171de45845a 100644 --- a/src/gallium/drivers/radeonsi/si_descriptors.c +++ b/src/gallium/drivers/radeonsi/si_descriptors.c @@ -662,9 +662,7 @@ void si_upload_const_buffer(struct si_context *sctx, struct r600_resource **rbuf return; } - for (i = 0; i < size / 4; ++i) { - tmpPtr[i] = util_cpu_to_le32(((uint32_t *)ptr)[i]); - } + util_memcpy_cpu_to_le32(tmpPtr, ptr, size); u_upload_data(sctx->b.uploader, 0, size, tmpPtr, const_offset, (struct pipe_resource**)rbuffer); diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 2a7577f334a..3fcd314b5c8 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -2553,7 +2553,7 @@ int si_compile_llvm(struct si_context *sctx, struct si_pipe_shader *shader, { unsigned r; /* llvm_compile result */ unsigned i; - uint32_t *ptr; + unsigned char *ptr; struct radeon_shader_binary binary; bool dump = r600_can_dump_shader(&sctx->screen->b, shader->selector ? shader->selector->tokens : NULL); @@ -2619,22 +2619,13 @@ int si_compile_llvm(struct si_context *sctx, struct si_pipe_shader *shader, return -ENOMEM; } - ptr = (uint32_t*)sctx->b.ws->buffer_map(shader->bo->cs_buf, sctx->b.rings.gfx.cs, PIPE_TRANSFER_WRITE); - if (SI_BIG_ENDIAN) { - for (i = 0; i < binary.code_size / 4; ++i) { - ptr[i] = util_cpu_to_le32((*(uint32_t*)(binary.code + i*4))); - } - ptr += (binary.code_size / 4); - for (i = 0; i < binary.rodata_size / 4; ++i) { - ptr[i] = util_cpu_to_le32((*(uint32_t*)(binary.rodata + i * 4))); - } - } else { - memcpy(ptr, binary.code, binary.code_size); - if (binary.rodata_size > 0) { - ptr += (binary.code_size / 4); - memcpy(ptr, binary.rodata, binary.rodata_size); - } + ptr = sctx->b.ws->buffer_map(shader->bo->cs_buf, sctx->b.rings.gfx.cs, PIPE_TRANSFER_WRITE); + util_memcpy_cpu_to_le32(ptr, binary.code, binary.code_size); + if (binary.rodata_size > 0) { + ptr += binary.code_size; + util_memcpy_cpu_to_le32(ptr, binary.rodata, binary.rodata_size); } + sctx->b.ws->buffer_unmap(shader->bo->cs_buf); free(binary.code); |