diff options
author | Michel Dänzer <[email protected]> | 2008-04-07 10:28:42 +0200 |
---|---|---|
committer | Michel Dänzer <[email protected]> | 2008-04-07 10:28:42 +0200 |
commit | da3e48186dc25f40925ca89b08baa5cd34143647 (patch) | |
tree | 35c66b4e67e232c2e9091ae3bea46d5b8613d790 | |
parent | 5d73502625d03f428e3d95f5d042c6ba7eab0ff5 (diff) |
r300: Fix r300VAPInputRoute{0,1} for big endian platforms.
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_emit.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_emit.c b/src/mesa/drivers/dri/r300/r300_emit.c index deb62b27621..e7371133d34 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.c +++ b/src/mesa/drivers/dri/r300/r300_emit.c @@ -210,18 +210,23 @@ static void r300EmitVec(GLcontext * ctx, struct r300_dma_region *rvb, static GLuint r300VAPInputRoute0(uint32_t * dst, GLvector4f ** attribptr, int *inputs, GLint * tab, GLuint nr) { - GLushort i, w; - uint16_t * dst16 = (uint16_t *) dst; - + GLuint i, dw; + /* type, inputs, stop bit, size */ - for (i = 0; i < nr; i++) { + for (i = 0; i < nr; i += 2) { /* make sure input is valid, would lockup the gpu */ assert(inputs[tab[i]] != -1); - w = R300_INPUT_ROUTE_FLOAT | (inputs[tab[i]] << 8) | (attribptr[tab[i]]->size - 1); + dw = R300_INPUT_ROUTE_FLOAT | (inputs[tab[i]] << 8) | (attribptr[tab[i]]->size - 1); if (i + 1 == nr) { - w |= R300_VAP_INPUT_ROUTE_END; + dw |= R300_VAP_INPUT_ROUTE_END; + } else { + assert(inputs[tab[i + 1]] != -1); + dw |= (R300_INPUT_ROUTE_FLOAT | (inputs[tab[i + 1]] << 8) | (attribptr[tab[i + 1]]->size - 1)) << 16; + if (i + 2 == nr) { + dw |= (R300_VAP_INPUT_ROUTE_END << 16); + } } - dst16[i] = w; + dst[i >> 1] = dw; } return (nr + 1) >> 1; @@ -237,11 +242,14 @@ static GLuint r300VAPInputRoute1Swizzle(int swizzle[4]) GLuint r300VAPInputRoute1(uint32_t * dst, int swizzle[][4], GLuint nr) { - GLuint i; - uint16_t * dst16 = (uint16_t *) dst; + GLuint i, dw; - for (i = 0; i < nr; i++) { - dst16[i] = r300VAPInputRoute1Swizzle(swizzle[i]) | R300_INPUT_ROUTE_ENABLE; + for (i = 0; i < nr; i += 2) { + dw = r300VAPInputRoute1Swizzle(swizzle[i]) | R300_INPUT_ROUTE_ENABLE; + if (i + 1 < nr) { + dw |= (r300VAPInputRoute1Swizzle(swizzle[i + 1]) | R300_INPUT_ROUTE_ENABLE) << 16; + } + dst[i >> 1] = dw; } return (nr + 1) >> 1; |