diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2006-04-23 05:54:06 +0000 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2006-04-23 05:54:06 +0000 |
commit | aa93b4ced05708c20d095fdd905ebd6cd9f634cd (patch) | |
tree | ab87d1deca9c9b23baacb4fc1c9b454981629b01 /src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c | |
parent | 2f92adb9e03c84dc6a6e0f90ba1a5c1ada4d6964 (diff) |
Enable USER_BUFFERS, RADEON_VTXFMT_A and HW_VBOS on big endian by forcing all elts
to 32 bits (it would be possible to do a half word swap for 16 bits if somebody is interested) and by using the input route mecanism to swap ubyte's properly in r300EmitArrays. Tested with cva, varray and quake3
Diffstat (limited to 'src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c')
-rw-r--r-- | src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c | 53 |
1 files changed, 46 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c b/src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c index 8f7620482f..941ff0078e 100644 --- a/src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c +++ b/src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c @@ -216,14 +216,22 @@ static void radeonDrawElements( GLenum mode, GLsizei count, GLenum type, const G max = ((unsigned char *)indices)[i]; } +#ifdef FORCE_32BITS_ELTS + elt_size = 4; +#else elt_size = 2; - +#endif r300AllocDmaRegion(rmesa, &rvb, count * elt_size, elt_size); rvb.aos_offset = GET_START(&rvb); ptr = rvb.address + rvb.start; +#ifdef FORCE_32BITS_ELTS + for (i=0; i < count; i++) + ((unsigned int *)ptr)[i] = ((unsigned char *)indices)[i] - min; +#else for (i=0; i < count; i++) ((unsigned short int *)ptr)[i] = ((unsigned char *)indices)[i] - min; +#endif break; case GL_UNSIGNED_SHORT: @@ -234,14 +242,23 @@ static void radeonDrawElements( GLenum mode, GLsizei count, GLenum type, const G max = ((unsigned short int *)indices)[i]; } +#ifdef FORCE_32BITS_ELTS + elt_size = 4; +#else elt_size = 2; +#endif r300AllocDmaRegion(rmesa, &rvb, count * elt_size, elt_size); rvb.aos_offset = GET_START(&rvb); ptr = rvb.address + rvb.start; +#ifdef FORCE_32BITS_ELTS + for (i=0; i < count; i++) + ((unsigned int *)ptr)[i] = ((unsigned short int *)indices)[i] - min; +#else for (i=0; i < count; i++) ((unsigned short int *)ptr)[i] = ((unsigned short int *)indices)[i] - min; +#endif break; case GL_UNSIGNED_INT: @@ -252,17 +269,20 @@ static void radeonDrawElements( GLenum mode, GLsizei count, GLenum type, const G max = ((unsigned int *)indices)[i]; } +#ifdef FORCE_32BITS_ELTS + elt_size = 4; +#else if (max - min <= 65535) elt_size = 2; else elt_size = 4; - +#endif r300AllocDmaRegion(rmesa, &rvb, count * elt_size, elt_size); rvb.aos_offset = GET_START(&rvb); ptr = rvb.address + rvb.start; - if (max - min <= 65535) + if (elt_size == 2) for (i=0; i < count; i++) ((unsigned short int *)ptr)[i] = ((unsigned int *)indices)[i] - min; else @@ -388,19 +408,30 @@ static void radeonDrawRangeElements(GLenum mode, GLuint min, GLuint max, GLsizei memset(&rvb, 0, sizeof(rvb)); switch (type){ case GL_UNSIGNED_BYTE: +#ifdef FORCE_32BITS_ELTS + elt_size = 4; +#else elt_size = 2; - +#endif r300AllocDmaRegion(rmesa, &rvb, count * elt_size, elt_size); rvb.aos_offset = GET_START(&rvb); ptr = rvb.address + rvb.start; +#ifdef FORCE_32BITS_ELTS + for(i=0; i < count; i++) + ((unsigned int *)ptr)[i] = ((unsigned char *)indices)[i] - min; +#else for(i=0; i < count; i++) ((unsigned short int *)ptr)[i] = ((unsigned char *)indices)[i] - min; +#endif break; case GL_UNSIGNED_SHORT: +#ifdef FORCE_32BITS_ELTS + elt_size = 4; +#else elt_size = 2; - +#endif #ifdef OPTIMIZE_ELTS if (min == 0 && ctx->Array.ElementArrayBufferObj->Name){ ptr = indices; @@ -411,21 +442,29 @@ static void radeonDrawRangeElements(GLenum mode, GLuint min, GLuint max, GLsizei rvb.aos_offset = GET_START(&rvb); ptr = rvb.address + rvb.start; +#ifdef FORCE_32BITS_ELTS + for(i=0; i < count; i++) + ((unsigned int *)ptr)[i] = ((unsigned short int *)indices)[i] - min; +#else for(i=0; i < count; i++) ((unsigned short int *)ptr)[i] = ((unsigned short int *)indices)[i] - min; +#endif break; case GL_UNSIGNED_INT: +#ifdef FORCE_32BITS_ELTS + elt_size = 4; +#else if (max - min <= 65535) elt_size = 2; else elt_size = 4; - +#endif r300AllocDmaRegion(rmesa, &rvb, count * elt_size, elt_size); rvb.aos_offset = GET_START(&rvb); ptr = rvb.address + rvb.start; - if (max - min <= 65535) + if (elt_size == 2) for (i=0; i < count; i++) ((unsigned short int *)ptr)[i] = ((unsigned int *)indices)[i] - min; else |