summaryrefslogtreecommitdiff
path: root/src/mesa/array_cache/ac_import.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2003-09-17 16:06:49 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2003-09-17 16:06:49 +0000
commit57d882b6847128fe5f72575f61a2b2dace7ac46c (patch)
tree0b8d61a758d856e9521c03e4c38ed72c29cdd3d1 /src/mesa/array_cache/ac_import.c
parent397d1e4d5750bda09e52451cfeb0a69126602a56 (diff)
GL_ARB_vertex_buffer_object working now, at least for non-indexed
vertex arrays.
Diffstat (limited to 'src/mesa/array_cache/ac_import.c')
-rw-r--r--src/mesa/array_cache/ac_import.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/mesa/array_cache/ac_import.c b/src/mesa/array_cache/ac_import.c
index b2b7eeb219..78f5435635 100644
--- a/src/mesa/array_cache/ac_import.c
+++ b/src/mesa/array_cache/ac_import.c
@@ -34,17 +34,17 @@
#include "array_cache/ac_context.h"
#include "math/m_translate.h"
-#define STRIDE_ARRAY( array, offset ) \
-do { \
- GLubyte *tmp = (array).Ptr; \
- tmp += (offset) * (array).StrideB; \
- (array).Ptr = tmp; \
+#define STRIDE_ARRAY( array, offset ) \
+do { \
+ GLubyte *tmp = ADD_POINTERS( (array).BufferObj->Data, (array).Ptr ) \
+ + (offset) * (array).StrideB; \
+ (array).Ptr = tmp; \
} while (0)
+
/* Set the array pointer back to its source when the cached data is
* invalidated:
*/
-
static void reset_texcoord( GLcontext *ctx, GLuint unit )
{
ACcontext *ac = AC_CONTEXT(ctx);
@@ -202,15 +202,23 @@ static void import( GLcontext *ctx,
struct gl_client_array *to,
struct gl_client_array *from )
{
+ GLubyte *dest;
+ const GLubyte *src;
ACcontext *ac = AC_CONTEXT(ctx);
if (type == 0)
type = from->Type;
+ /* The dest and source data addresses are the sum of the buffer
+ * object's start plus the vertex array pointer/offset.
+ */
+ dest = ADD_POINTERS(to->BufferObj->Data, to->Ptr);
+ src = ADD_POINTERS(from->BufferObj->Data, from->Ptr);
+
switch (type) {
case GL_FLOAT:
- _math_trans_4fc( (GLfloat (*)[4]) to->Ptr,
- from->Ptr,
+ _math_trans_4fc( (GLfloat (*)[4]) dest,
+ src,
from->StrideB,
from->Type,
from->Size,
@@ -222,8 +230,8 @@ static void import( GLcontext *ctx,
break;
case GL_UNSIGNED_BYTE:
- _math_trans_4ub( (GLubyte (*)[4]) to->Ptr,
- from->Ptr,
+ _math_trans_4ub( (GLubyte (*)[4]) dest,
+ src,
from->StrideB,
from->Type,
from->Size,
@@ -235,8 +243,8 @@ static void import( GLcontext *ctx,
break;
case GL_UNSIGNED_SHORT:
- _math_trans_4us( (GLushort (*)[4]) to->Ptr,
- from->Ptr,
+ _math_trans_4us( (GLushort (*)[4]) dest,
+ src,
from->StrideB,
from->Type,
from->Size,