summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2003-05-01 22:44:02 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2003-05-01 22:44:02 +0000
commit92f9785c727ea10ff5f8dc9770f0e8f388fcea70 (patch)
tree10335899a8205128723f6b459d827e918bbc2d86 /src
parent09b00c5ded8e6211c9c79be600bb8c8ecad0d8fc (diff)
downloadexternal_mesa3d-92f9785c727ea10ff5f8dc9770f0e8f388fcea70.zip
external_mesa3d-92f9785c727ea10ff5f8dc9770f0e8f388fcea70.tar.gz
external_mesa3d-92f9785c727ea10ff5f8dc9770f0e8f388fcea70.tar.bz2
Use ctx->Const.MaxTextureImageUnits and MaxTextureCoordUnits in more places.
Misc vertex array / vertex program changes.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/array_cache/ac_import.c4
-rw-r--r--src/mesa/main/api_arrayelt.c6
-rw-r--r--src/mesa/main/arbprogram.c10
-rw-r--r--src/mesa/main/arbprogram.h6
-rw-r--r--src/mesa/main/context.c1
-rw-r--r--src/mesa/main/get.c12
-rw-r--r--src/mesa/main/mtypes.h2
-rw-r--r--src/mesa/main/rastpos.c188
-rw-r--r--src/mesa/main/state.c4
-rw-r--r--src/mesa/main/varray.c78
-rw-r--r--src/mesa/main/varray.h8
-rw-r--r--src/mesa/swrast/s_context.c4
-rw-r--r--src/mesa/swrast/s_context.h4
-rw-r--r--src/mesa/tnl/t_imm_dlist.c2
-rw-r--r--src/mesa/tnl/t_imm_elt.c2
-rw-r--r--src/mesa/tnl/t_imm_exec.c8
-rw-r--r--src/mesa/tnl/t_vb_texgen.c10
-rw-r--r--src/mesa/tnl/t_vb_texmat.c10
18 files changed, 216 insertions, 143 deletions
diff --git a/src/mesa/array_cache/ac_import.c b/src/mesa/array_cache/ac_import.c
index 3a2434f..5d5c24f 100644
--- a/src/mesa/array_cache/ac_import.c
+++ b/src/mesa/array_cache/ac_import.c
@@ -268,7 +268,7 @@ static void import_texcoord( GLcontext *ctx, GLuint unit,
struct gl_client_array *from = &ac->Raw.TexCoord[unit];
struct gl_client_array *to = &ac->Cache.TexCoord[unit];
- ASSERT(unit < ctx->Const.MaxTextureUnits);
+ ASSERT(unit < ctx->Const.MaxTextureCoordUnits);
/* Limited choices at this stage:
*/
@@ -482,7 +482,7 @@ struct gl_client_array *_ac_import_texcoord( GLcontext *ctx,
{
ACcontext *ac = AC_CONTEXT(ctx);
- ASSERT(unit < ctx->Const.MaxTextureUnits);
+ ASSERT(unit < ctx->Const.MaxTextureCoordUnits);
/* Can we keep the existing version?
*/
diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c
index 8d64b1e..f8269fe 100644
--- a/src/mesa/main/api_arrayelt.c
+++ b/src/mesa/main/api_arrayelt.c
@@ -1,10 +1,8 @@
-/* $Id: api_arrayelt.c,v 1.12 2003/01/14 04:55:45 brianp Exp $ */
-
/*
* Mesa 3-D graphics library
* 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"),
@@ -277,7 +275,7 @@ static void _ae_update_state( GLcontext *ctx )
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];
diff --git a/src/mesa/main/arbprogram.c b/src/mesa/main/arbprogram.c
index 99118cf..384504e 100644
--- a/src/mesa/main/arbprogram.c
+++ b/src/mesa/main/arbprogram.c
@@ -241,14 +241,6 @@ _mesa_VertexAttrib4NuivARB(GLuint index, const GLuint *v)
void
-_mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type,
- GLboolean normalized, GLsizei stride,
- const GLvoid *pointer)
-{
-}
-
-
-void
_mesa_EnableVertexAttribArrayARB(GLuint index)
{
GET_CURRENT_CONTEXT(ctx);
@@ -280,7 +272,7 @@ _mesa_DisableVertexAttribArrayARB(GLuint index)
ctx->Array.VertexAttrib[index].Enabled = GL_FALSE;
ctx->Array._Enabled &= ~_NEW_ARRAY_ATTRIB(index);
- ctx->Array.NewState &= ~_NEW_ARRAY_ATTRIB(index);
+ ctx->Array.NewState |= _NEW_ARRAY_ATTRIB(index);
}
diff --git a/src/mesa/main/arbprogram.h b/src/mesa/main/arbprogram.h
index 5a4436a..a403090 100644
--- a/src/mesa/main/arbprogram.h
+++ b/src/mesa/main/arbprogram.h
@@ -136,12 +136,6 @@ _mesa_VertexAttrib4NuivARB(GLuint index, const GLuint *v);
extern void
-_mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type,
- GLboolean normalized, GLsizei stride,
- const GLvoid *pointer);
-
-
-extern void
_mesa_EnableVertexAttribArrayARB(GLuint index);
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index c5fb814..aaba851 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1008,6 +1008,7 @@ init_attrib_groups( GLcontext *ctx )
ctx->Const.MaxProgramMatrices = MAX_PROGRAM_MATRICES;
ctx->Const.MaxProgramMatrixStackDepth = MAX_PROGRAM_MATRIX_STACK_DEPTH;
+ ASSERT(ctx->Const.MaxTextureUnits == MAX2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits));
/* Initialize matrix stacks */
init_matrix_stack(&ctx->ModelviewMatrixStack, MAX_MODELVIEW_STACK_DEPTH,
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index dd1c001..7d61d49 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1002,7 +1002,8 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
/* GL_ARB_multitexture */
case GL_MAX_TEXTURE_UNITS_ARB:
CHECK_EXTENSION_B(ARB_multitexture, pname);
- *params = INT_TO_BOOL(ctx->Const.MaxTextureUnits);
+ *params = INT_TO_BOOL(MIN2(ctx->Const.MaxTextureImageUnits,
+ ctx->Const.MaxTextureCoordUnits));
break;
case GL_ACTIVE_TEXTURE_ARB:
CHECK_EXTENSION_B(ARB_multitexture, pname);
@@ -2501,7 +2502,8 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
/* GL_ARB_multitexture */
case GL_MAX_TEXTURE_UNITS_ARB:
CHECK_EXTENSION_D(ARB_multitexture, pname);
- *params = (GLdouble) ctx->Const.MaxTextureUnits;
+ *params = (GLdouble) MIN2(ctx->Const.MaxTextureImageUnits,
+ ctx->Const.MaxTextureCoordUnits);
break;
case GL_ACTIVE_TEXTURE_ARB:
CHECK_EXTENSION_D(ARB_multitexture, pname);
@@ -4000,7 +4002,8 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
/* GL_ARB_multitexture */
case GL_MAX_TEXTURE_UNITS_ARB:
CHECK_EXTENSION_F(ARB_multitexture, pname);
- *params = (GLfloat) ctx->Const.MaxTextureUnits;
+ *params = (GLfloat) MIN2(ctx->Const.MaxTextureImageUnits,
+ ctx->Const.MaxTextureCoordUnits);
break;
case GL_ACTIVE_TEXTURE_ARB:
CHECK_EXTENSION_F(ARB_multitexture, pname);
@@ -5472,7 +5475,8 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
/* GL_ARB_multitexture */
case GL_MAX_TEXTURE_UNITS_ARB:
CHECK_EXTENSION_I(ARB_multitexture, pname);
- *params = ctx->Const.MaxTextureUnits;
+ *params = MIN2(ctx->Const.MaxTextureImageUnits,
+ ctx->Const.MaxTextureCoordUnits);
break;
case GL_ACTIVE_TEXTURE_ARB:
CHECK_EXTENSION_I(ARB_multitexture, pname);
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index b906ef4..2b7fe01 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1390,9 +1390,9 @@ struct gl_constants {
GLint Max3DTextureLevels;
GLint MaxCubeTextureLevels; /* GL_ARB_texture_cube_map */
GLint MaxTextureRectSize; /* GL_NV_texture_rectangle */
- GLuint MaxTextureUnits;
GLuint MaxTextureCoordUnits;
GLuint MaxTextureImageUnits;
+ GLuint MaxTextureUnits; /* = MAX(CoordUnits, ImageUnits) */
GLfloat MaxTextureMaxAnisotropy; /* GL_EXT_texture_filter_anisotropic */
GLfloat MaxTextureLodBias; /* GL_EXT_texture_lod_bias */
GLuint MaxArrayLockSize;
diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c
index 5c019bd..3c48a3a 100644
--- a/src/mesa/main/rastpos.c
+++ b/src/mesa/main/rastpos.c
@@ -39,11 +39,10 @@
#include "math/m_xform.h"
-/*
+/**
* Clip a point against the view volume.
- * Input: v - vertex-vector describing the point to clip
- * Return: 0 = outside view volume
- * 1 = inside view volume
+ * \param v vertex-vector describing the point to clip
+ * \return 0 = outside view volume, 1 = inside view volume
*/
static GLuint
viewclip_point( const GLfloat v[] )
@@ -73,14 +72,13 @@ viewclip_point_z( const GLfloat v[] )
-/*
+/**
* Clip a point against the user clipping planes.
- * Input: v - vertex-vector describing the point to clip.
- * Return: 0 = point was clipped
- * 1 = point not clipped
+ * \param v vertex-vector describing the point to clip.
+ * \return 0 = point was clipped, 1 = point not clipped
*/
static GLuint
-userclip_point( GLcontext* ctx, const GLfloat v[] )
+userclip_point( GLcontext *ctx, const GLfloat v[] )
{
GLuint p;
@@ -100,7 +98,8 @@ userclip_point( GLcontext* ctx, const GLfloat v[] )
}
-/* This has been split off to allow the normal shade routines to
+/**
+ * This has been split off to allow the normal shade routines to
* get a little closer to the vertex buffer, and to use the
* GLvector objects directly.
* Input: ctx - the context
@@ -262,11 +261,12 @@ shade_rastpos(GLcontext *ctx,
}
*Rindex = (GLuint) (GLint) ind;
}
-
}
-/*
- * Caller: context->API.RasterPos4f
+
+/**
+ * All glRasterPos command call this function to update the current
+ * raster position.
*/
static void
raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
@@ -278,100 +278,107 @@ raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
if (ctx->NewState)
_mesa_update_state( ctx );
- ASSIGN_4V( v, x, y, z, w );
- TRANSFORM_POINT( eye, ctx->ModelviewMatrixStack.Top->m, v );
+ if (ctx->VertexProgram.Enabled) {
+ /* XXX implement this */
+ _mesa_problem(ctx, "Vertex programs not implemented for glRasterPos");
+ return;
+ }
+ else {
+ ASSIGN_4V( v, x, y, z, w );
+ TRANSFORM_POINT( eye, ctx->ModelviewMatrixStack.Top->m, v );
+
+ /* raster color */
+ if (ctx->Light.Enabled) {
+ GLfloat *norm, eyenorm[3];
+ GLfloat *objnorm = ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
+
+ if (ctx->_NeedEyeCoords) {
+ GLfloat *inv = ctx->ModelviewMatrixStack.Top->inv;
+ TRANSFORM_NORMAL( eyenorm, objnorm, inv );
+ norm = eyenorm;
+ }
+ else {
+ norm = objnorm;
+ }
- /* raster color */
- if (ctx->Light.Enabled) {
- GLfloat *norm, eyenorm[3];
- GLfloat *objnorm = ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
+ shade_rastpos( ctx, v, norm,
+ ctx->Current.RasterColor,
+ ctx->Current.RasterSecondaryColor,
+ &ctx->Current.RasterIndex );
- if (ctx->_NeedEyeCoords) {
- GLfloat *inv = ctx->ModelviewMatrixStack.Top->inv;
- TRANSFORM_NORMAL( eyenorm, objnorm, inv );
- norm = eyenorm;
}
else {
- norm = objnorm;
+ /* use current color or index */
+ if (ctx->Visual.rgbMode) {
+ COPY_4FV(ctx->Current.RasterColor,
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR0]);
+ COPY_4FV(ctx->Current.RasterSecondaryColor,
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR1]);
+ }
+ else {
+ ctx->Current.RasterIndex = ctx->Current.Index;
+ }
}
- shade_rastpos( ctx, v, norm,
- ctx->Current.RasterColor,
- ctx->Current.RasterSecondaryColor,
- &ctx->Current.RasterIndex );
-
- }
- else {
- /* use current color or index */
- if (ctx->Visual.rgbMode) {
- COPY_4FV(ctx->Current.RasterColor,
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0]);
- COPY_4FV(ctx->Current.RasterSecondaryColor,
- ctx->Current.Attrib[VERT_ATTRIB_COLOR1]);
+ /* compute raster distance */
+ if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT)
+ ctx->Current.RasterDistance = ctx->Current.Attrib[VERT_ATTRIB_FOG][0];
+ else
+ ctx->Current.RasterDistance =
+ SQRTF( eye[0]*eye[0] + eye[1]*eye[1] + eye[2]*eye[2] );
+
+ /* apply projection matrix: clip = Proj * eye */
+ TRANSFORM_POINT( clip, ctx->ProjectionMatrixStack.Top->m, eye );
+
+ /* clip to view volume */
+ if (ctx->Transform.RasterPositionUnclipped) {
+ /* GL_IBM_rasterpos_clip: only clip against Z */
+ if (viewclip_point_z(clip) == 0) {
+ ctx->Current.RasterPosValid = GL_FALSE;
+ return;
+ }
}
- else {
- ctx->Current.RasterIndex = ctx->Current.Index;
+ else if (viewclip_point(clip) == 0) {
+ /* Normal OpenGL behaviour */
+ ctx->Current.RasterPosValid = GL_FALSE;
+ return;
}
- }
- /* compute raster distance */
- if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT)
- ctx->Current.RasterDistance = ctx->Current.Attrib[VERT_ATTRIB_FOG][0];
- else
- ctx->Current.RasterDistance =
- SQRTF( eye[0]*eye[0] + eye[1]*eye[1] + eye[2]*eye[2] );
-
- /* apply projection matrix: clip = Proj * eye */
- TRANSFORM_POINT( clip, ctx->ProjectionMatrixStack.Top->m, eye );
-
- /* clip to view volume */
- if (ctx->Transform.RasterPositionUnclipped) {
- /* GL_IBM_rasterpos_clip: only clip against Z */
- if (viewclip_point_z(clip) == 0) {
+ /* clip to user clipping planes */
+ if (ctx->Transform.ClipPlanesEnabled && !userclip_point(ctx, clip)) {
ctx->Current.RasterPosValid = GL_FALSE;
return;
}
- }
- else if (viewclip_point(clip) == 0) {
- /* Normal OpenGL behaviour */
- ctx->Current.RasterPosValid = GL_FALSE;
- return;
- }
-
- /* clip to user clipping planes */
- if (ctx->Transform.ClipPlanesEnabled && !userclip_point(ctx, clip)) {
- ctx->Current.RasterPosValid = GL_FALSE;
- return;
- }
- /* ndc = clip / W */
- ASSERT( clip[3]!=0.0 );
- d = 1.0F / clip[3];
- ndc[0] = clip[0] * d;
- ndc[1] = clip[1] * d;
- ndc[2] = clip[2] * d;
-
- ctx->Current.RasterPos[0] = (ndc[0] * ctx->Viewport._WindowMap.m[MAT_SX] +
- ctx->Viewport._WindowMap.m[MAT_TX]);
- ctx->Current.RasterPos[1] = (ndc[1] * ctx->Viewport._WindowMap.m[MAT_SY] +
- ctx->Viewport._WindowMap.m[MAT_TY]);
- ctx->Current.RasterPos[2] = (ndc[2] * ctx->Viewport._WindowMap.m[MAT_SZ] +
- ctx->Viewport._WindowMap.m[MAT_TZ]) / ctx->DepthMaxF;
- ctx->Current.RasterPos[3] = clip[3];
- ctx->Current.RasterPosValid = GL_TRUE;
+ /* ndc = clip / W */
+ ASSERT( clip[3]!=0.0 );
+ d = 1.0F / clip[3];
+ ndc[0] = clip[0] * d;
+ ndc[1] = clip[1] * d;
+ ndc[2] = clip[2] * d;
+
+ ctx->Current.RasterPos[0] = (ndc[0] * ctx->Viewport._WindowMap.m[MAT_SX] +
+ ctx->Viewport._WindowMap.m[MAT_TX]);
+ ctx->Current.RasterPos[1] = (ndc[1] * ctx->Viewport._WindowMap.m[MAT_SY] +
+ ctx->Viewport._WindowMap.m[MAT_TY]);
+ ctx->Current.RasterPos[2] = (ndc[2] * ctx->Viewport._WindowMap.m[MAT_SZ] +
+ ctx->Viewport._WindowMap.m[MAT_TZ]) / ctx->DepthMaxF;
+ ctx->Current.RasterPos[3] = clip[3];
+ ctx->Current.RasterPosValid = GL_TRUE;
- {
- GLuint texSet;
- for (texSet = 0; texSet < ctx->Const.MaxTextureUnits; texSet++) {
- COPY_4FV( ctx->Current.RasterTexCoords[texSet],
- ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texSet] );
+ {
+ GLuint texSet;
+ for (texSet = 0; texSet < ctx->Const.MaxTextureCoordUnits; texSet++) {
+ COPY_4FV( ctx->Current.RasterTexCoords[texSet],
+ ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texSet] );
+ }
}
+
}
if (ctx->RenderMode==GL_SELECT) {
_mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] );
}
-
}
@@ -527,6 +534,11 @@ _mesa_RasterPos4sv(const GLshort *v)
/*** GL_ARB_window_pos / GL_MESA_window_pos ***/
/**********************************************************************/
+
+/**
+ * All glWindowPosMESA and glWindowPosARB commands call this function to
+ * update the current raster position.
+ */
static void
window_pos3f(GLfloat x, GLfloat y, GLfloat z)
{
@@ -578,7 +590,7 @@ window_pos3f(GLfloat x, GLfloat y, GLfloat z)
/* raster texcoord = current texcoord */
{
GLuint texSet;
- for (texSet = 0; texSet < ctx->Const.MaxTextureUnits; texSet++) {
+ for (texSet = 0; texSet < ctx->Const.MaxTextureCoordUnits; texSet++) {
COPY_4FV( ctx->Current.RasterTexCoords[texSet],
ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texSet] );
}
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index f14c3f9..8030c9e 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -867,7 +867,7 @@ update_texture_matrices( GLcontext *ctx )
ctx->Texture._TexMatEnabled = 0;
- for (i=0; i < ctx->Const.MaxTextureUnits; i++) {
+ for (i=0; i < ctx->Const.MaxTextureCoordUnits; i++) {
if (ctx->TextureMatrixStack[i].Top->flags & MAT_DIRTY) {
_math_matrix_analyse( ctx->TextureMatrixStack[i].Top );
@@ -903,6 +903,8 @@ update_texture_state( GLcontext *ctx )
ctx->Texture._TexGenEnabled = 0;
/* Update texture unit state.
+ * XXX this loop should probably be broken into separate loops for
+ * texture coord units and texture image units.
*/
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 8895847..5752a42 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -1,5 +1,3 @@
-/* $Id: varray.c,v 1.48 2003/03/01 01:50:22 brianp Exp $ */
-
/*
* Mesa 3-D graphics library
* Version: 5.1
@@ -438,8 +436,9 @@ _mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *vptr)
}
-void _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type,
- GLsizei stride, const GLvoid *ptr)
+void
+_mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type,
+ GLsizei stride, const GLvoid *ptr)
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -500,6 +499,73 @@ void _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type,
void
+_mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type,
+ GLboolean normalized,
+ GLsizei stride, const GLvoid *ptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (index >= ctx->Const.MaxVertexProgramAttribs) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerARB(index)");
+ return;
+ }
+
+ if (size < 1 || size > 4) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerARB(size)");
+ return;
+ }
+
+ if (stride < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerARB(stride)");
+ return;
+ }
+
+ if (type == GL_UNSIGNED_BYTE && size != 4) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerARB(size!=4)");
+ return;
+ }
+
+ /* check for valid 'type' and compute StrideB right away */
+ switch (type) {
+ case GL_UNSIGNED_BYTE:
+ ctx->Array.VertexAttrib[index].StrideB = size * sizeof(GLubyte);
+ break;
+ case GL_SHORT:
+ ctx->Array.VertexAttrib[index].StrideB = size * sizeof(GLshort);
+ break;
+ case GL_FLOAT:
+ ctx->Array.VertexAttrib[index].StrideB = size * sizeof(GLfloat);
+ break;
+ case GL_DOUBLE:
+ ctx->Array.VertexAttrib[index].StrideB = size * sizeof(GLdouble);
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttribPointerARB(type)" );
+ return;
+ }
+
+ if (stride)
+ ctx->Array.VertexAttrib[index].StrideB = stride;
+
+ ctx->Array.VertexAttrib[index].Stride = stride;
+ ctx->Array.VertexAttrib[index].Size = size;
+ ctx->Array.VertexAttrib[index].Type = type;
+ ctx->Array.VertexAttrib[index].Normalized = normalized;
+ ctx->Array.VertexAttrib[index].Ptr = (void *) ptr;
+
+ ctx->NewState |= _NEW_ARRAY;
+ ctx->Array.NewState |= _NEW_ARRAY_ATTRIB(index);
+
+ /* XXX fix
+ if (ctx->Driver.VertexAttribPointer)
+ ctx->Driver.VertexAttribPointer( ctx, index, size, type, stride, ptr );
+ */
+}
+
+
+
+void
_mesa_VertexPointerEXT(GLint size, GLenum type, GLsizei stride,
GLsizei count, const GLvoid *ptr)
{
@@ -706,14 +772,14 @@ _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
_mesa_TexCoordPointer( tcomps, GL_FLOAT, stride,
(GLubyte *) pointer + i * coffset );
}
- for (i = factor; i < (GLint) ctx->Const.MaxTextureUnits; i++) {
+ for (i = factor; i < (GLint) ctx->Const.MaxTextureCoordUnits; i++) {
_mesa_ClientActiveTextureARB( (GLenum) (GL_TEXTURE0_ARB + i) );
_mesa_DisableClientState( GL_TEXTURE_COORD_ARRAY );
}
}
else {
GLint i;
- for (i = 0; i < (GLint) ctx->Const.MaxTextureUnits; i++) {
+ for (i = 0; i < (GLint) ctx->Const.MaxTextureCoordUnits; i++) {
_mesa_ClientActiveTextureARB( (GLenum) (GL_TEXTURE0_ARB + i) );
_mesa_DisableClientState( GL_TEXTURE_COORD_ARRAY );
}
diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
index cf114cd..7515fc2 100644
--- a/src/mesa/main/varray.h
+++ b/src/mesa/main/varray.h
@@ -1,4 +1,4 @@
-/* $Id: varray.h,v 1.14 2002/06/30 15:47:01 brianp Exp $ */
+/* $Id: varray.h,v 1.15 2003/05/01 22:44:03 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -108,6 +108,12 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type,
extern void
+_mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type,
+ GLboolean normalized, GLsizei stride,
+ const GLvoid *pointer);
+
+
+extern void
_mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer);
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index 79ee5b4..5160e81 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -101,6 +101,10 @@ _swrast_update_rasterflags( GLcontext *ctx )
RasterMask |= MULTI_DRAW_BIT; /* all color index bits disabled */
}
+ if (ctx->FragmentProgram.Enabled) {
+ RasterMask |= FRAGPROG_BIT;
+ }
+
SWRAST_CONTEXT(ctx)->_RasterMask = RasterMask;
}
diff --git a/src/mesa/swrast/s_context.h b/src/mesa/swrast/s_context.h
index 219e002..947d48e 100644
--- a/src/mesa/swrast/s_context.h
+++ b/src/mesa/swrast/s_context.h
@@ -1,5 +1,3 @@
-/* $Id: s_context.h,v 1.26 2003/03/16 22:02:36 brianp Exp $ */
-
/*
* Mesa 3-D graphics library
* Version: 5.1
@@ -242,6 +240,7 @@ typedef void (*swrast_tri_func)( GLcontext *ctx, const SWvertex *,
/**< buffer or no buffers. */
#define OCCLUSION_BIT 0x800 /**< GL_HP_occlusion_test enabled */
#define TEXTURE_BIT 0x1000 /**< Texturing really enabled */
+#define FRAGPROG_BIT 0x2000 /**< Fragment program enabled */
/*@}*/
#define _SWRAST_NEW_RASTERMASK (_NEW_BUFFERS| \
@@ -249,6 +248,7 @@ typedef void (*swrast_tri_func)( GLcontext *ctx, const SWvertex *,
_NEW_COLOR| \
_NEW_DEPTH| \
_NEW_FOG| \
+ _NEW_PROGRAM| \
_NEW_STENCIL| \
_NEW_TEXTURE| \
_NEW_VIEWPORT| \
diff --git a/src/mesa/tnl/t_imm_dlist.c b/src/mesa/tnl/t_imm_dlist.c
index 5d7cd47..3efe615 100644
--- a/src/mesa/tnl/t_imm_dlist.c
+++ b/src/mesa/tnl/t_imm_dlist.c
@@ -597,7 +597,7 @@ loopback_compiled_cassette( GLcontext *ctx, struct immediate *IM )
vertex = (void (GLAPIENTRY *)(const GLfloat *)) glVertex3fv;
if (orflag & VERT_BITS_TEX_ANY) {
- for (j = 0 ; j < ctx->Const.MaxTextureUnits ; j++) {
+ for (j = 0 ; j < ctx->Const.MaxTextureCoordUnits ; j++) {
if (orflag & VERT_BIT_TEX(j)) {
maxtex = j+1;
if ((IM->TexSize & TEX_SIZE_4(j)) == TEX_SIZE_4(j))
diff --git a/src/mesa/tnl/t_imm_elt.c b/src/mesa/tnl/t_imm_elt.c
index 7495864..08b74a1 100644
--- a/src/mesa/tnl/t_imm_elt.c
+++ b/src/mesa/tnl/t_imm_elt.c
@@ -855,7 +855,7 @@ void _tnl_translate_array_elts( GLcontext *ctx, struct immediate *IM,
if (translateConventional & VERT_BITS_TEX_ANY) {
GLuint i;
- for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
+ for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
if (translateConventional & VERT_BIT_TEX(i)) {
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_TEX0 + i],
&ctx->Array.TexCoord[i],
diff --git a/src/mesa/tnl/t_imm_exec.c b/src/mesa/tnl/t_imm_exec.c
index a509223..4cf95bb 100644
--- a/src/mesa/tnl/t_imm_exec.c
+++ b/src/mesa/tnl/t_imm_exec.c
@@ -1,5 +1,3 @@
-/* $Id: t_imm_exec.c,v 1.46 2003/04/08 02:27:20 brianp Exp $ */
-
/*
* Mesa 3-D graphics library
* Version: 5.1
@@ -166,7 +164,7 @@ void _tnl_copy_to_current( GLcontext *ctx, struct immediate *IM,
if (flag & VERT_BITS_TEX_ANY) {
GLuint i;
- for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) {
+ for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) {
if (flag & VERT_BIT_TEX(i)) {
COPY_4FV( ctx->Current.Attrib[VERT_ATTRIB_TEX0 + i],
IM->Attrib[VERT_ATTRIB_TEX0 + i][count]);
@@ -344,7 +342,7 @@ static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM )
if (inputs & VERT_BITS_TEX_ANY) {
GLuint i;
- for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
+ for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
VB->TexCoordPtr[i] = NULL;
if (inputs & VERT_BIT_TEX(i)) {
tmp->TexCoord[i].count = count;
@@ -569,7 +567,7 @@ void _tnl_imm_init( GLcontext *ctx )
_mesa_vector1ui_init( &tmp->Index, 0, 0 );
_mesa_vector1ub_init( &tmp->EdgeFlag, 0, 0 );
- for (i = 0; i < ctx->Const.MaxTextureUnits; i++)
+ for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++)
_mesa_vector4f_init( &tmp->TexCoord[i], 0, 0);
/* Install the first immediate. Intially outside begin/end.
diff --git a/src/mesa/tnl/t_vb_texgen.c b/src/mesa/tnl/t_vb_texgen.c
index 9a954bf..22cb07e 100644
--- a/src/mesa/tnl/t_vb_texgen.c
+++ b/src/mesa/tnl/t_vb_texgen.c
@@ -1,5 +1,3 @@
-/* $Id: t_vb_texgen.c,v 1.19 2003/03/31 16:48:35 brianp Exp $ */
-
/*
* Mesa 3-D graphics library
* Version: 5.1
@@ -527,7 +525,7 @@ static GLboolean run_texgen_stage( GLcontext *ctx,
struct texgen_stage_data *store = TEXGEN_STAGE_DATA( stage );
GLuint i;
- for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
+ for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
if (ctx->Texture._TexGenEnabled & ENABLE_TEXGEN(i)) {
if (stage->changed_inputs & (VERT_BIT_EYE | VERT_BIT_NORMAL | VERT_BIT_TEX(i)))
store->TexgenFunc[i]( ctx, store, i );
@@ -547,7 +545,7 @@ static GLboolean run_validate_texgen_stage( GLcontext *ctx,
struct texgen_stage_data *store = TEXGEN_STAGE_DATA(stage);
GLuint i;
- for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) {
+ for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) {
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
if (texUnit->TexGenEnabled) {
@@ -604,7 +602,7 @@ static void check_texgen( GLcontext *ctx, struct gl_pipeline_stage *stage )
if (ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS)
inputs |= VERT_BIT_NORMAL;
- for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
+ for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
if (ctx->Texture._TexGenEnabled & ENABLE_TEXGEN(i))
{
outputs |= VERT_BIT_TEX(i);
@@ -642,7 +640,7 @@ static GLboolean alloc_texgen_data( GLcontext *ctx,
if (!store)
return GL_FALSE;
- for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
+ for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
_mesa_vector4f_alloc( &store->texcoord[i], 0, VB->Size, 32 );
store->tmp_f = (GLfloat (*)[3]) MALLOC(VB->Size * sizeof(GLfloat) * 3);
diff --git a/src/mesa/tnl/t_vb_texmat.c b/src/mesa/tnl/t_vb_texmat.c
index b92eaae..3d5c43d 100644
--- a/src/mesa/tnl/t_vb_texmat.c
+++ b/src/mesa/tnl/t_vb_texmat.c
@@ -1,10 +1,8 @@
-/* $Id: t_vb_texmat.c,v 1.12 2003/03/01 01:50:28 brianp Exp $ */
-
/*
* Mesa 3-D graphics library
* 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"),
@@ -62,7 +60,7 @@ static void check_texmat( GLcontext *ctx, struct gl_pipeline_stage *stage )
if (ctx->Texture._TexMatEnabled && !ctx->VertexProgram.Enabled) {
GLuint flags = 0;
- for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
+ for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i))
flags |= VERT_BIT_TEX(i);
@@ -82,7 +80,7 @@ static GLboolean run_texmat_stage( GLcontext *ctx,
/* ENABLE_TEXMAT implies that the texture matrix is not the
* identity, so we don't have to check that here.
*/
- for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
+ for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i)) {
if (stage->changed_inputs & VERT_BIT_TEX(i))
(void) TransformRaw( &store->texcoord[i],
@@ -109,7 +107,7 @@ static GLboolean alloc_texmat_data( GLcontext *ctx,
if (!store)
return GL_FALSE;
- for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
+ for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
_mesa_vector4f_alloc( &store->texcoord[i], 0, VB->Size, 32 );
/* Now run the stage.