This reverts commit f0c8863dbb71b2c3605bb8eb9526c7d8d13793cf.

This caused lookups on powerpc. Looks like there's an endianess issue. Spotted by Michel Dänzer.
---
 src/mesa/drivers/dri/r300/r300_emit.c |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/src/mesa/drivers/dri/r300/r300_emit.c b/src/mesa/drivers/dri/r300/r300_emit.c
index deb62b2..5b473b6 100644
--- a/src/mesa/drivers/dri/r300/r300_emit.c
+++ b/src/mesa/drivers/dri/r300/r300_emit.c
@@ -210,18 +210,22 @@ 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++) {
-		/* 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);
-		if (i + 1 == nr) {
-			w |= R300_VAP_INPUT_ROUTE_END;
+	for (i = 0; i + 1 < nr; i += 2) {
+		dw = R300_INPUT_ROUTE_FLOAT | (inputs[tab[i]] << 8) | (attribptr[tab[i]]->size - 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;
+	}
+
+	if (nr & 1) {
+		dw = R300_INPUT_ROUTE_FLOAT | (inputs[tab[nr - 1]] << 8) | (attribptr[tab[nr - 1]]->size - 1);
+		dw |= R300_VAP_INPUT_ROUTE_END;
+		dst[nr >> 1] = dw;
 	}
 
 	return (nr + 1) >> 1;

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to