summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorMaciej Cencora <[email protected]>2009-06-05 17:58:04 +0200
committerDave Airlie <[email protected]>2009-06-07 16:40:04 +1000
commit58982f8af1496c4860fb7bf3e815977ed4a753ff (patch)
treefb7d14d11069ae1046326b6670292ebe2d375a43 /src/mesa
parentca13937ef97c7779f639dcfc95b3798a11de01bd (diff)
r300: vertex array stride = 0 means that data are tightly packed in the array
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/r300/r300_draw.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_draw.c b/src/mesa/drivers/dri/r300/r300_draw.c
index c9588fbb21c..684b1d0ef84 100644
--- a/src/mesa/drivers/dri/r300/r300_draw.c
+++ b/src/mesa/drivers/dri/r300/r300_draw.c
@@ -123,7 +123,7 @@ static int getTypeSize(GLenum type)
*dst_ptr++ = MACRO(*in); \
in++; \
} \
- src_ptr += input->StrideB; \
+ src_ptr += stride; \
} \
} else { \
for (i = 0; i < count; i++) { \
@@ -132,7 +132,7 @@ static int getTypeSize(GLenum type)
*dst_ptr++ = (GLfloat)(*in); \
in++; \
} \
- src_ptr += input->StrideB; \
+ src_ptr += stride; \
} \
} \
} while (0)
@@ -144,6 +144,7 @@ static void r300TranslateAttrib(GLcontext *ctx, GLuint attr, int count, const st
struct vertex_attribute r300_attr;
const void *src_ptr;
GLenum type;
+ GLuint stride;
if (input->BufferObj->Name) {
if (!input->BufferObj->Pointer) {
@@ -157,10 +158,12 @@ static void r300TranslateAttrib(GLcontext *ctx, GLuint attr, int count, const st
} else
src_ptr = input->Ptr;
- if (input->Type == GL_DOUBLE || input->Type == GL_UNSIGNED_INT || input->Type == GL_INT || input->StrideB < 4){
+ stride = (input->StrideB == 0) ? getTypeSize(input->Type) * input->Size : input->StrideB;
+
+ if (input->Type == GL_DOUBLE || input->Type == GL_UNSIGNED_INT || input->Type == GL_INT || stride < 4){
if (RADEON_DEBUG & DEBUG_FALLBACKS) {
fprintf(stderr, "%s: Converting vertex attributes, attribute data format %x,", __FUNCTION__, input->Type);
- fprintf(stderr, "stride %d, components %d\n", input->StrideB, input->Size);
+ fprintf(stderr, "stride %d, components %d\n", stride, input->Size);
}
GLfloat *dst_ptr, *tmp;
@@ -203,7 +206,7 @@ static void r300TranslateAttrib(GLcontext *ctx, GLuint attr, int count, const st
type = input->Type;
r300_attr.free_needed = GL_FALSE;
r300_attr.data = (GLvoid *)src_ptr;
- r300_attr.stride = input->StrideB;
+ r300_attr.stride = stride;
r300_attr.dwords = (getTypeSize(type) * input->Size + 3)/ 4;
}