Use ctx->Const.MaxTextureImageUnits and MaxTextureCoordUnits in more places.
Misc vertex array / vertex program changes.
This commit is contained in:
@@ -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?
|
||||
*/
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -240,14 +240,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)
|
||||
{
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -135,12 +135,6 @@ extern void
|
||||
_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);
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
+8
-4
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
+102
-90
@@ -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 );
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
shade_rastpos( ctx, v, norm,
|
||||
ctx->Current.RasterColor,
|
||||
ctx->Current.RasterSecondaryColor,
|
||||
&ctx->Current.RasterIndex );
|
||||
|
||||
if (ctx->VertexProgram.Enabled) {
|
||||
/* XXX implement this */
|
||||
_mesa_problem(ctx, "Vertex programs not implemented for glRasterPos");
|
||||
return;
|
||||
}
|
||||
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]);
|
||||
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;
|
||||
}
|
||||
|
||||
shade_rastpos( ctx, v, norm,
|
||||
ctx->Current.RasterColor,
|
||||
ctx->Current.RasterSecondaryColor,
|
||||
&ctx->Current.RasterIndex );
|
||||
|
||||
}
|
||||
else {
|
||||
ctx->Current.RasterIndex = ctx->Current.Index;
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 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] );
|
||||
/* 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 );
|
||||
/* 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 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 if (viewclip_point(clip) == 0) {
|
||||
/* Normal OpenGL behaviour */
|
||||
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;
|
||||
|
||||
{
|
||||
GLuint texSet;
|
||||
for (texSet = 0; texSet < ctx->Const.MaxTextureUnits; texSet++) {
|
||||
COPY_4FV( ctx->Current.RasterTexCoords[texSet],
|
||||
ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texSet] );
|
||||
/* 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;
|
||||
|
||||
{
|
||||
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] );
|
||||
}
|
||||
|
||||
@@ -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];
|
||||
|
||||
+72
-6
@@ -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);
|
||||
@@ -499,6 +498,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 );
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -107,6 +107,12 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type,
|
||||
GLsizei stride, const GLvoid *pointer);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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| \
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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],
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user