summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600/r600_shader.c
diff options
context:
space:
mode:
authorHenri Verbeet <[email protected]>2011-04-25 13:28:55 +0200
committerHenri Verbeet <[email protected]>2011-04-25 14:06:21 +0200
commitd7577ae3a6d6e174ab36d244f6bd4dedd63c3d1d (patch)
treec38b0da2a6f0e3d8cdeb736f0a454aec08a38e34 /src/gallium/drivers/r600/r600_shader.c
parent32001c2244521a606ab210cd3a3fea3481131879 (diff)
r600g: Cleanup the big endian support a bit.
In particular, make sure the code is at least compiled on little endian systems. Signed-off-by: Henri Verbeet <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600/r600_shader.c')
-rw-r--r--src/gallium/drivers/r600/r600_shader.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index 2f901be28fa..96ac59b2e93 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -35,12 +35,6 @@
#include <errno.h>
#include <byteswap.h>
-#ifdef PIPE_ARCH_BIG_ENDIAN
-#define CPU_TO_LE32(x) bswap_32(x)
-#else
-#define CPU_TO_LE32(x) (x)
-#endif
-
int r600_find_vs_semantic_index(struct r600_shader *vs,
struct r600_shader *ps, int id)
{
@@ -69,8 +63,12 @@ static int r600_pipe_shader(struct pipe_context *ctx, struct r600_pipe_shader *s
return -ENOMEM;
}
ptr = (uint32_t*)r600_bo_map(rctx->radeon, shader->bo, 0, NULL);
- for(i = 0; i < rshader->bc.ndw; i++) {
- *(ptr + i) = CPU_TO_LE32(*(rshader->bc.bytecode + i));
+ if (R600_BIG_ENDIAN) {
+ for (i = 0; i < rshader->bc.ndw; ++i) {
+ ptr[i] = bswap_32(rshader->bc.bytecode[i]);
+ }
+ } else {
+ memcpy(ptr, rshader->bc.bytecode, rshader->bc.ndw * sizeof(*ptr));
}
r600_bo_unmap(rctx->radeon, shader->bo);
}
@@ -477,11 +475,7 @@ static int tgsi_fetch_rel_const(struct r600_shader_ctx *ctx, unsigned int offset
vtx.num_format_all = 2; /* NUM_FORMAT_SCALED */
vtx.format_comp_all = 1; /* FORMAT_COMP_SIGNED */
vtx.srf_mode_all = 1; /* SRF_MODE_NO_ZERO */
-#ifdef PIPE_ARCH_BIG_ENDIAN
- vtx.endian = ENDIAN_8IN32;
-#else
- vtx.endian = ENDIAN_NONE;
-#endif
+ vtx.endian = r600_endian_swap(32);
if ((r = r600_bc_add_vtx(ctx->bc, &vtx)))
return r;