-/* $Id: api_arrayelt.c,v 1.8 2002/04/19 00:23:08 brianp Exp $ */
-
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
*/
/* Author:
- * Keith Whitwell <keith_whitwell@yahoo.com>
+ * Keith Whitwell <keith@tungstengraphics.com>
*/
#include "glheader.h"
#include "api_arrayelt.h"
#include "context.h"
#include "glapi.h"
-#include "mem.h"
+#include "imports.h"
#include "macros.h"
#include "mtypes.h"
} AEarray;
typedef struct {
- AEtexarray texarrays[MAX_TEXTURE_UNITS+1];
+ AEtexarray texarrays[MAX_TEXTURE_COORD_UNITS + 1];
AEarray arrays[32];
GLuint NewState;
} AEcontext;
GLboolean _ae_create_context( GLcontext *ctx )
{
+ if (ctx->aelt_context)
+ return GL_TRUE;
+
ctx->aelt_context = MALLOC( sizeof(AEcontext) );
if (!ctx->aelt_context)
return GL_FALSE;
AEarray *aa = actx->arrays;
GLuint i;
- for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
+ for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
if (ctx->Array.TexCoord[i].Enabled) {
ta->unit = i;
ta->array = &ctx->Array.TexCoord[i];
}
-void _ae_loopback_array_elt( GLint elt )
+void GLAPIENTRY _ae_loopback_array_elt( GLint elt )
{
GET_CURRENT_CONTEXT(ctx);
AEcontext *actx = AE_CONTEXT(ctx);
_ae_update_state( ctx );
for (ta = actx->texarrays ; ta->func ; ta++) {
- ta->func( ta->unit, (char *)ta->array->Ptr + elt * ta->array->StrideB );
+ GLubyte *src = ta->array->BufferObj->Data
+ + (GLuint) ta->array->Ptr
+ + elt * ta->array->StrideB;
+ ta->func( ta->unit + GL_TEXTURE0_ARB, src);
}
/* Must be last
*/
for (aa = actx->arrays ; aa->func ; aa++) {
- aa->func( (char *)aa->array->Ptr + elt * aa->array->StrideB );
+ GLubyte *src = aa->array->BufferObj->Data
+ + (GLuint) aa->array->Ptr
+ + elt * aa->array->StrideB;
+ aa->func( src );
}
}