[Mesa-dev] [PATCH 5/8] r600g: Use util_cpu_to_le32() instead of bswap32() on big-endian systems

Tom Stellard thomas.stellard at amd.com
Thu Feb 20 10:21:44 PST 2014


---
 src/gallium/drivers/r600/r600_asm.c          | 2 +-
 src/gallium/drivers/r600/r600_shader.c       | 2 +-
 src/gallium/drivers/r600/r600_state_common.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c
index 3afe7b2..67df2f2 100644
--- a/src/gallium/drivers/r600/r600_asm.c
+++ b/src/gallium/drivers/r600/r600_asm.c
@@ -2431,7 +2431,7 @@ void *r600_create_vertex_fetch_shader(struct pipe_context *ctx,
 
 	if (R600_BIG_ENDIAN) {
 		for (i = 0; i < fs_size / 4; ++i) {
-			bytecode[i] = util_bswap32(bc.bytecode[i]);
+			bytecode[i] = util_cpu_to_le32(bc.bytecode[i]);
 		}
 	} else {
 		memcpy(bytecode, bc.bytecode, fs_size);
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index baeef57..38c68e4 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -119,7 +119,7 @@ static int store_shader(struct pipe_context *ctx,
 		ptr = r600_buffer_map_sync_with_rings(&rctx->b, shader->bo, PIPE_TRANSFER_WRITE);
 		if (R600_BIG_ENDIAN) {
 			for (i = 0; i < shader->shader.bc.ndw; ++i) {
-				ptr[i] = util_bswap32(shader->shader.bc.bytecode[i]);
+				ptr[i] = util_cpu_to_le32(shader->shader.bc.bytecode[i]);
 			}
 		} else {
 			memcpy(ptr, shader->shader.bc.bytecode, shader->shader.bc.ndw * sizeof(*ptr));
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index da4578a..5f9e8b7 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -936,7 +936,7 @@ static void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint
 			}
 
 			for (i = 0; i < size / 4; ++i) {
-				tmpPtr[i] = util_bswap32(((uint32_t *)ptr)[i]);
+				tmpPtr[i] = util_cpu_to_le32(((uint32_t *)ptr)[i]);
 			}
 
 			u_upload_data(rctx->b.uploader, 0, size, tmpPtr, &cb->buffer_offset, &cb->buffer);
-- 
1.8.1.4




More information about the mesa-dev mailing list