head 3.41; access; symbols merge-1:3.29.2.5 autoconf:3.29.0.4 experimental-1:3.29.0.2 mesa-3-1-with-kw3:3.16 mesa-3-1-prior-to-kw3:3.15; locks; strict; comment @ * @; 3.41 date 99.08.03.14.42.03; author keithw; state Exp; branches; next 3.40; 3.40 date 99.08.02.23.28.20; author keithw; state Exp; branches; next 3.39; 3.39 date 99.08.02.19.23.58; author keithw; state Exp; branches; next 3.38; 3.38 date 99.08.01.11.36.54; author brianp; state Exp; branches; next 3.37; 3.37 date 99.08.01.09.46.26; author miklos; state Exp; branches; next 3.36; 3.36 date 99.07.29.17.45.48; author miklos; state Exp; branches; next 3.35; 3.35 date 99.07.20.19.36.13; author keithw; state Exp; branches; next 3.34; 3.34 date 99.07.13.15.43.40; author brianp; state Exp; branches; next 3.33; 3.33 date 99.07.13.10.40.57; author brianp; state Exp; branches; next 3.32; 3.32 date 99.07.12.12.05.25; author keithw; state Exp; branches; next 3.31; 3.31 date 99.07.08.21.20.06; author brianp; state Exp; branches; next 3.30; 3.30 date 99.06.01.10.42.29; author keithw; state Exp; branches; next 3.29; 3.29 date 99.05.16.17.09.59; author keithw; state Exp; branches 3.29.2.1; next 3.28; 3.28 date 99.05.11.17.43.00; author keithw; state Exp; branches; next 3.27; 3.27 date 99.05.06.17.29.19; author brianp; state Exp; branches; next 3.26; 3.26 date 99.05.06.15.45.22; author keithw; state Exp; branches; next 3.25; 3.25 date 99.05.02.00.59.24; author keithw; state Exp; branches; next 3.24; 3.24 date 99.04.24.13.21.43; author keithw; state Exp; branches; next 3.23; 3.23 date 99.04.23.16.14.22; author keithw; state Exp; branches; next 3.22; 3.22 date 99.04.21.12.59.37; author brianp; state Exp; branches; next 3.21; 3.21 date 99.04.06.10.03.01; author keithw; state Exp; branches; next 3.20; 3.20 date 99.04.05.16.32.36; author keithw; state Exp; branches; next 3.19; 3.19 date 99.04.04.21.09.26; author keithw; state Exp; branches; next 3.18; 3.18 date 99.03.31.20.18.41; author keithw; state Exp; branches; next 3.17; 3.17 date 99.03.17.16.51.17; author keithw; state Exp; branches; next 3.16; 3.16 date 99.02.25.14.12.32; author keithw; state Exp; branches; next 3.15; 3.15 date 99.02.24.22.48.08; author jens; state Exp; branches; next 3.14; 3.14 date 99.02.14.03.46.34; author brianp; state Exp; branches; next 3.13; 3.13 date 98.11.25.04.18.19; author brianp; state Exp; branches; next 3.12; 3.12 date 98.11.08.22.34.07; author brianp; state Exp; branches; next 3.11; 3.11 date 98.11.07.02.14.17; author brianp; state Exp; branches; next 3.10; 3.10 date 98.10.31.17.06.15; author brianp; state Exp; branches; next 3.9; 3.9 date 98.10.29.03.57.11; author brianp; state Exp; branches; next 3.8; 3.8 date 98.10.29.02.28.13; author brianp; state Exp; branches; next 3.7; 3.7 date 98.09.01.03.05.22; author brianp; state Exp; branches; next 3.6; 3.6 date 98.08.21.01.50.53; author brianp; state Exp; branches; next 3.5; 3.5 date 98.06.07.22.18.52; author brianp; state Exp; branches; next 3.4; 3.4 date 98.03.27.04.26.44; author brianp; state Exp; branches; next 3.3; 3.3 date 98.02.20.04.53.07; author brianp; state Exp; branches; next 3.2; 3.2 date 98.02.01.20.05.10; author brianp; state Exp; branches; next 3.1; 3.1 date 98.02.01.16.37.19; author brianp; state Exp; branches; next 3.0; 3.0 date 98.01.31.21.06.45; author brianp; state Exp; branches; next ; 3.29.2.1 date 99.05.21.21.29.27; author keithw; state Exp; branches; next 3.29.2.2; 3.29.2.2 date 99.06.01.00.45.21; author keithw; state Exp; branches; next 3.29.2.3; 3.29.2.3 date 99.06.06.22.35.55; author keithw; state Exp; branches; next 3.29.2.4; 3.29.2.4 date 99.06.08.00.21.49; author keithw; state Exp; branches; next 3.29.2.5; 3.29.2.5 date 99.06.19.15.04.15; author keithw; state Exp; branches; next ; desc @vertex array functions @ 3.41 log @fixes for bugs from eero and miklos @ text @/* $Id: varray.c,v 3.40 1999/08/02 23:28:20 keithw Exp $ */ /* * Mesa 3-D graphics library * Version: 3.1 * * Copyright (C) 1999 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"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifdef PC_HEADER #include "all.h" #else #include #include #include #include "context.h" #include "api.h" #include "cva.h" #include "enable.h" #include "enums.h" #include "dlist.h" #include "light.h" #include "macros.h" #include "mmath.h" #include "pipeline.h" #include "texstate.h" #include "translate.h" #include "types.h" #include "varray.h" #include "vb.h" #include "vbfill.h" #include "vbrender.h" #include "vbindirect.h" #include "vbxform.h" #include "xform.h" #ifdef XFree86Server #include "GL/xf86glx.h" #endif #endif void GLAPIENTRY glVertexPointer(CTX_ARG GLint size, GLenum type, GLsizei stride, const GLvoid *ptr ) { GLcontext *ctx; GET_CONTEXT; CHECK_CONTEXT; ctx = CC; if (size<2 || size>4) { gl_error( ctx, GL_INVALID_VALUE, "glVertexPointer(size)" ); return; } if (stride<0) { gl_error( ctx, GL_INVALID_VALUE, "glVertexPointer(stride)" ); return; } if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) fprintf(stderr, "glVertexPointer( sz %d type %s stride %d )\n", size, gl_lookup_enum_by_nr( type ), stride); ctx->Array.Vertex.StrideB = stride; if (!stride) { switch (type) { case GL_SHORT: ctx->Array.Vertex.StrideB = size*sizeof(GLshort); break; case GL_INT: ctx->Array.Vertex.StrideB = size*sizeof(GLint); break; case GL_FLOAT: ctx->Array.Vertex.StrideB = size*sizeof(GLfloat); break; case GL_DOUBLE: ctx->Array.Vertex.StrideB = size*sizeof(GLdouble); break; default: gl_error( ctx, GL_INVALID_ENUM, "glVertexPointer(type)" ); return; } } ctx->Array.Vertex.Size = size; ctx->Array.Vertex.Type = type; ctx->Array.Vertex.Stride = stride; ctx->Array.Vertex.Ptr = (void *) ptr; ctx->Array.VertexFunc = gl_trans_4f_tab[size][TYPE_IDX(type)]; ctx->Array.VertexEltFunc = gl_trans_elt_4f_tab[size][TYPE_IDX(type)]; ctx->Array.NewArrayState |= VERT_OBJ_ANY; ctx->NewState |= NEW_CLIENT_STATE; } void GLAPIENTRY glNormalPointer(CTX_ARG GLenum type, GLsizei stride, const GLvoid *ptr ) { GLcontext *ctx; GET_CONTEXT; CHECK_CONTEXT; ctx = CC; if (stride<0) { gl_error( ctx, GL_INVALID_VALUE, "glNormalPointer(stride)" ); return; } if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) fprintf(stderr, "glNormalPointer( type %s stride %d )\n", gl_lookup_enum_by_nr( type ), stride); ctx->Array.Normal.StrideB = stride; if (!stride) { switch (type) { case GL_BYTE: ctx->Array.Normal.StrideB = 3*sizeof(GLbyte); break; case GL_SHORT: ctx->Array.Normal.StrideB = 3*sizeof(GLshort); break; case GL_INT: ctx->Array.Normal.StrideB = 3*sizeof(GLint); break; case GL_FLOAT: ctx->Array.Normal.StrideB = 3*sizeof(GLfloat); break; case GL_DOUBLE: ctx->Array.Normal.StrideB = 3*sizeof(GLdouble); break; default: gl_error( ctx, GL_INVALID_ENUM, "glNormalPointer(type)" ); return; } } ctx->Array.Normal.Type = type; ctx->Array.Normal.Stride = stride; ctx->Array.Normal.Ptr = (void *) ptr; ctx->Array.NormalFunc = gl_trans_3f_tab[TYPE_IDX(type)]; ctx->Array.NormalEltFunc = gl_trans_elt_3f_tab[TYPE_IDX(type)]; ctx->Array.NewArrayState |= VERT_NORM; ctx->NewState |= NEW_CLIENT_STATE; } void GLAPIENTRY glColorPointer(CTX_ARG GLint size, GLenum type, GLsizei stride, const GLvoid *ptr ) { GLcontext *ctx; GET_CONTEXT; CHECK_CONTEXT; ctx = CC; if (size<3 || size>4) { gl_error( ctx, GL_INVALID_VALUE, "glColorPointer(size)" ); return; } if (stride<0) { gl_error( ctx, GL_INVALID_VALUE, "glColorPointer(stride)" ); return; } if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) fprintf(stderr, "glColorPointer( sz %d type %s stride %d )\n", size, gl_lookup_enum_by_nr( type ), stride); ctx->Array.Color.StrideB = stride; if (!stride) { switch (type) { case GL_BYTE: ctx->Array.Color.StrideB = size*sizeof(GLbyte); break; case GL_UNSIGNED_BYTE: ctx->Array.Color.StrideB = size*sizeof(GLubyte); break; case GL_SHORT: ctx->Array.Color.StrideB = size*sizeof(GLshort); break; case GL_UNSIGNED_SHORT: ctx->Array.Color.StrideB = size*sizeof(GLushort); break; case GL_INT: ctx->Array.Color.StrideB = size*sizeof(GLint); break; case GL_UNSIGNED_INT: ctx->Array.Color.StrideB = size*sizeof(GLuint); break; case GL_FLOAT: ctx->Array.Color.StrideB = size*sizeof(GLfloat); break; case GL_DOUBLE: ctx->Array.Color.StrideB = size*sizeof(GLdouble); break; default: gl_error( ctx, GL_INVALID_ENUM, "glColorPointer(type)" ); return; } } ctx->Array.Color.Size = size; ctx->Array.Color.Type = type; ctx->Array.Color.Stride = stride; ctx->Array.Color.Ptr = (void *) ptr; ctx->Array.ColorFunc = gl_trans_4ub_tab[size][TYPE_IDX(type)]; ctx->Array.ColorEltFunc = gl_trans_elt_4ub_tab[size][TYPE_IDX(type)]; ctx->Array.NewArrayState |= VERT_RGBA; ctx->NewState |= NEW_CLIENT_STATE; } void GLAPIENTRY glIndexPointer(CTX_ARG GLenum type, GLsizei stride, const GLvoid *ptr ) { GLcontext *ctx; GET_CONTEXT; CHECK_CONTEXT; ctx = CC; if (stride<0) { gl_error( ctx, GL_INVALID_VALUE, "glIndexPointer(stride)" ); return; } ctx->Array.Index.StrideB = stride; if (!stride) { switch (type) { case GL_UNSIGNED_BYTE: ctx->Array.Index.StrideB = sizeof(GLubyte); break; case GL_SHORT: ctx->Array.Index.StrideB = sizeof(GLshort); break; case GL_INT: ctx->Array.Index.StrideB = sizeof(GLint); break; case GL_FLOAT: ctx->Array.Index.StrideB = sizeof(GLfloat); break; case GL_DOUBLE: ctx->Array.Index.StrideB = sizeof(GLdouble); break; default: gl_error( ctx, GL_INVALID_ENUM, "glIndexPointer(type)" ); return; } } ctx->Array.Index.Type = type; ctx->Array.Index.Stride = stride; ctx->Array.Index.Ptr = (void *) ptr; ctx->Array.IndexFunc = gl_trans_1ui_tab[TYPE_IDX(type)]; ctx->Array.IndexEltFunc = gl_trans_elt_1ui_tab[TYPE_IDX(type)]; ctx->Array.NewArrayState |= VERT_INDEX; ctx->NewState |= NEW_CLIENT_STATE; } void GLAPIENTRY glTexCoordPointer(CTX_ARG GLint size, GLenum type, GLsizei stride, const GLvoid *ptr ) { GLuint texUnit; GLcontext *ctx; GET_CONTEXT; CHECK_CONTEXT; ctx = CC; texUnit = ctx->TexCoordUnit; if (size<1 || size>4) { gl_error( ctx, GL_INVALID_VALUE, "glTexCoordPointer(size)" ); return; } if (stride<0) { gl_error( ctx, GL_INVALID_VALUE, "glTexCoordPointer(stride)" ); return; } if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) fprintf(stderr, "glTexCoordPointer( unit %u sz %d type %s stride %d )\n", texUnit, size, gl_lookup_enum_by_nr( type ), stride); ctx->Array.TexCoord[texUnit].StrideB = stride; if (!stride) { switch (type) { case GL_SHORT: ctx->Array.TexCoord[texUnit].StrideB = size*sizeof(GLshort); break; case GL_INT: ctx->Array.TexCoord[texUnit].StrideB = size*sizeof(GLint); break; case GL_FLOAT: ctx->Array.TexCoord[texUnit].StrideB = size*sizeof(GLfloat); break; case GL_DOUBLE: ctx->Array.TexCoord[texUnit].StrideB = size*sizeof(GLdouble); break; default: gl_error( ctx, GL_INVALID_ENUM, "glTexCoordPointer(type)" ); return; } } ctx->Array.TexCoord[texUnit].Size = size; ctx->Array.TexCoord[texUnit].Type = type; ctx->Array.TexCoord[texUnit].Stride = stride; ctx->Array.TexCoord[texUnit].Ptr = (void *) ptr; ctx->Array.TexCoordFunc[texUnit] = gl_trans_4f_tab[size][TYPE_IDX(type)]; ctx->Array.TexCoordEltFunc[texUnit] = gl_trans_elt_4f_tab[size][TYPE_IDX(type)]; ctx->Array.NewArrayState |= PIPE_TEX(texUnit); ctx->NewState |= NEW_CLIENT_STATE; } void GLAPIENTRY glEdgeFlagPointer(CTX_ARG GLsizei stride, const void *vptr ) { const GLboolean *ptr = (GLboolean *)vptr; GLcontext *ctx; GET_CONTEXT; CHECK_CONTEXT; ctx = CC; if (stride<0) { gl_error( ctx, GL_INVALID_VALUE, "glEdgeFlagPointer(stride)" ); return; } ctx->Array.EdgeFlag.Stride = stride; ctx->Array.EdgeFlag.StrideB = stride ? stride : sizeof(GLboolean); ctx->Array.EdgeFlag.Ptr = (GLboolean *) ptr; if (stride != sizeof(GLboolean)) { ctx->Array.EdgeFlagFunc = gl_trans_1ub_tab[TYPE_IDX(GL_UNSIGNED_BYTE)]; } else { ctx->Array.EdgeFlagFunc = 0; } ctx->Array.EdgeFlagEltFunc = gl_trans_elt_1ub_tab[TYPE_IDX(GL_UNSIGNED_BYTE)]; ctx->Array.NewArrayState |= VERT_EDGE; ctx->NewState |= NEW_CLIENT_STATE; } /* Called only from gl_DrawElements */ void gl_CVAEltPointer( GLcontext *ctx, GLenum type, const GLvoid *ptr ) { switch (type) { case GL_UNSIGNED_BYTE: ctx->CVA.Elt.StrideB = sizeof(GLubyte); break; case GL_UNSIGNED_SHORT: ctx->CVA.Elt.StrideB = sizeof(GLushort); break; case GL_UNSIGNED_INT: ctx->CVA.Elt.StrideB = sizeof(GLuint); break; default: gl_error( ctx, GL_INVALID_ENUM, "glEltPointer(type)" ); return; } ctx->CVA.Elt.Type = type; ctx->CVA.Elt.Stride = 0; ctx->CVA.Elt.Ptr = (void *) ptr; ctx->CVA.EltFunc = gl_trans_1ui_tab[TYPE_IDX(type)]; ctx->Array.NewArrayState |= VERT_ELT; /* ??? */ } /* KW: Batch function to exec all the array elements in the input * buffer prior to transform. Done only the first time a vertex * buffer is executed or compiled. */ void gl_exec_array_elements( GLcontext *ctx, struct immediate *IM ) { GLuint *flags = IM->Flag; GLuint *elts = IM->Elt; GLuint count = IM->Count; GLuint start = IM->Start; GLuint translate = ctx->Array.Flags; GLuint i; if (translate & VERT_OBJ_ANY) (ctx->Array.VertexEltFunc)( IM->Obj, &ctx->Array.Vertex, flags, elts, VERT_ELT, start, count); if (translate & VERT_NORM) (ctx->Array.NormalEltFunc)( IM->Normal, &ctx->Array.Normal, flags, elts, (VERT_ELT|VERT_NORM), start, count); if (translate & VERT_EDGE) (ctx->Array.EdgeFlagEltFunc)( IM->EdgeFlag, &ctx->Array.EdgeFlag, flags, elts, (VERT_ELT|VERT_EDGE), start, count); if (translate & VERT_RGBA) (ctx->Array.ColorEltFunc)( IM->Color, &ctx->Array.Color, flags, elts, (VERT_ELT|VERT_RGBA), start, count); if (translate & VERT_INDEX) (ctx->Array.IndexEltFunc)( IM->Index, &ctx->Array.Index, flags, elts, (VERT_ELT|VERT_INDEX), start, count); if (translate & VERT_TEX0_ANY) (ctx->Array.TexCoordEltFunc[0])( IM->TexCoord[0], &ctx->Array.TexCoord[0], flags, elts, (VERT_ELT|VERT_TEX0_ANY), start, count); if (translate & VERT_TEX1_ANY) (ctx->Array.TexCoordEltFunc[1])( IM->TexCoord[1], &ctx->Array.TexCoord[1], flags, elts, (VERT_ELT|VERT_TEX1_ANY), start, count); IM->OrFlag |= translate; /* Lighting ignores the and-flag, so still need to do this. */ if (IM->AndFlag & VERT_ELT) { for (i = 0 ; i < count ; i++) flags[i] |= translate; IM->AndFlag |= translate; } else { GLuint andflag = ~0; for (i = 0 ; i < count ; i++) { if (flags[i] & VERT_ELT) flags[i] |= translate; andflag &= flags[i]; } IM->AndFlag = andflag; } } /* KW: I think this is moving in the right direction, but it still feels * like we are doing way too much work. */ void gl_DrawArrays( GLcontext *ctx, GLenum mode, GLint start, GLsizei count ) { struct vertex_buffer *VB = ctx->VB; GLint i; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDrawArrays"); if (count<0) { gl_error( ctx, GL_INVALID_VALUE, "glDrawArrays(count)" ); return; } if (!ctx->CompileFlag && ctx->Array.Vertex.Enabled) { GLint remaining = count; GLint i; GLvector4f obj; GLvector3f norm; GLvector4f tc[MAX_TEXTURE_UNITS]; GLvector4ub col; GLvector1ub edge; GLvector1ui index; GLuint update = 0, translate = 0; struct vertex_array_pointers VSrc; struct immediate *IM = VB->IM; struct gl_client_array *client_data; struct gl_pipeline *elt = &ctx->CVA.elt; GLuint relock; GLuint fallback, required; if (ctx->NewState) gl_update_state( ctx ); /* This will die miserably with CVA... Need more work to support this. */ relock = ctx->CompileCVAFlag; ctx->CompileCVAFlag = 0; if (!elt->pipeline_valid || relock) gl_build_immediate_pipeline( ctx ); required = elt->inputs; fallback = (elt->inputs & ~ctx->Array.Summary); VSrc.Color = &IM->v.Color; VSrc.Index = &IM->v.Index; VSrc.EdgeFlag = &IM->v.EdgeFlag; VSrc.TexCoord[0] = &IM->v.TexCoord[0]; VSrc.TexCoord[1] = &IM->v.TexCoord[1]; VSrc.Obj = &IM->v.Obj; VSrc.Normal = &IM->v.Normal; if (required & VERT_RGBA) { client_data = &ctx->Array.Color; if (fallback & VERT_RGBA) client_data = &ctx->Fallback.Color; if (client_data->Type == GL_UNSIGNED_BYTE && client_data->Size == 4) { VSrc.Color = &col; col.data = (GLubyte (*)[4]) client_data->Ptr; col.stride = client_data->StrideB; col.flags = VEC_NOT_WRITABLE|VEC_GOOD_STRIDE; if (client_data->StrideB != 4 * sizeof(GLubyte)) col.flags ^= VEC_STRIDE_FLAGS; update |= VERT_RGBA; } else { translate |= VERT_RGBA; } } if (required & VERT_INDEX) { client_data = &ctx->Array.Index; if (fallback & VERT_INDEX) client_data = &ctx->Fallback.Index; if (client_data->Type == GL_UNSIGNED_INT) { VSrc.Index = &index; index.data = (GLuint *) client_data->Ptr; index.stride = client_data->StrideB; index.flags = VEC_NOT_WRITABLE|VEC_GOOD_STRIDE; if (client_data->StrideB != sizeof(GLuint)) index.flags ^= VEC_STRIDE_FLAGS; update |= VERT_INDEX; } else { translate |= VERT_INDEX; } } for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++) { GLuint flag = VERT_TEX_ANY(i); if (required & flag) { client_data = &ctx->Array.TexCoord[i]; if (fallback & flag) { client_data = &ctx->Fallback.TexCoord[i]; client_data->Size = gl_texcoord_size( ctx->Current.Flag, i ); } if (client_data->Type == GL_FLOAT) { VSrc.TexCoord[i] = &tc[i]; tc[i].data = (GLfloat (*)[4]) client_data->Ptr; tc[i].stride = client_data->StrideB; tc[i].size = client_data->Size; tc[i].flags = VEC_NOT_WRITABLE|VEC_GOOD_STRIDE; if (tc[i].stride |= 4 * sizeof(GLfloat)) tc[i].flags ^= VEC_STRIDE_FLAGS; update |= flag; } else { translate |= flag; } } } if (ctx->Array.Flags != ctx->Array.Flag[0]) for (i = 0 ; i < VB_MAX ; i++) ctx->Array.Flag[i] = ctx->Array.Flags; if (ctx->Array.Vertex.Type == GL_FLOAT) { VSrc.Obj = &obj; obj.data = (GLfloat (*)[4]) ctx->Array.Vertex.Ptr; obj.stride = ctx->Array.Vertex.StrideB; obj.size = ctx->Array.Vertex.Size; obj.flags = VEC_NOT_WRITABLE|VEC_GOOD_STRIDE; if (obj.stride != 4 * sizeof(GLfloat)) obj.flags ^= VEC_STRIDE_FLAGS; update |= VERT_OBJ_ANY; } else { translate |= VERT_OBJ_ANY; } if (required & VERT_NORM) { client_data = &ctx->Array.Normal; if (fallback & VERT_NORM) client_data = &ctx->Fallback.Normal; if (client_data->Type == GL_FLOAT) { VSrc.Normal = &norm; norm.flags = 0; norm.data = (GLfloat (*)[3]) client_data->Ptr; norm.stride = client_data->StrideB; update |= VERT_NORM; } else { translate |= VERT_NORM; } } if ( (required & VERT_EDGE) && (mode == GL_TRIANGLES || mode == GL_QUADS || mode == GL_POLYGON)) { client_data = &ctx->Array.EdgeFlag; if (fallback & VERT_EDGE) client_data = &ctx->Fallback.EdgeFlag; VSrc.EdgeFlag = &edge; edge.data = (GLboolean *) client_data->Ptr; edge.stride = client_data->StrideB; edge.flags = VEC_NOT_WRITABLE|VEC_GOOD_STRIDE; if (edge.stride != sizeof(GLubyte)) edge.flags ^= VEC_STRIDE_FLAGS; update |= VERT_EDGE; } VB->Primitive = IM->Primitive; VB->NextPrimitive = IM->NextPrimitive; VB->MaterialMask = IM->MaterialMask; VB->Material = IM->Material; VB->BoundsPtr = 0; while (remaining > 0) { GLint vbspace = VB_MAX - VB_START; GLuint count, n; if (vbspace >= remaining) { n = remaining; VB->LastPrimitive = VB_START + n; } else { n = vbspace; VB->LastPrimitive = VB_START; } VB->CullMode = 0; /* Update pointers. */ if (update) { if (update & VERT_OBJ_ANY) obj.start = VEC_ELT(&obj, GLfloat, start); if (update & VERT_NORM) norm.start = VEC_ELT(&norm, GLfloat, start); if (update & VERT_EDGE) edge.start = VEC_ELT(&edge, GLubyte, start); if (update & VERT_RGBA) col.start = VEC_ELT(&col, GLubyte, start); if (update & VERT_INDEX) index.start = VEC_ELT(&index, GLuint, start); if (update & VERT_TEX0_ANY) tc[0].start = VEC_ELT(&tc[0], GLfloat, start); if (update & VERT_TEX1_ANY) tc[1].start = VEC_ELT(&tc[1], GLfloat, start); } /* Translate data to fix up type and stride. */ if (translate) { if (translate & VERT_OBJ_ANY) { ctx->Array.VertexFunc( IM->Obj + VB_START, &ctx->Array.Vertex, start, n ); } if (translate & VERT_NORM) { ctx->Array.NormalFunc( IM->Normal + VB_START, &ctx->Array.Normal, start, n ); } if (translate & VERT_EDGE) { ctx->Array.EdgeFlagFunc( IM->EdgeFlag + VB_START, &ctx->Array.EdgeFlag, start, n ); } if (translate & VERT_RGBA) { ctx->Array.ColorFunc( IM->Color + VB_START, &ctx->Array.Color, start, n ); } if (translate & VERT_INDEX) { ctx->Array.IndexFunc( IM->Index + VB_START, &ctx->Array.Index, start, n ); } if (translate & VERT_TEX0_ANY) { IM->v.TexCoord[0].size = tc[0].size; ctx->Array.TexCoordFunc[0]( IM->TexCoord[0] + VB_START, &ctx->Array.TexCoord[0], start, n ); } if (translate & VERT_TEX1_ANY) { IM->v.TexCoord[1].size = tc[1].size; ctx->Array.TexCoordFunc[1]( IM->TexCoord[1] + VB_START, &ctx->Array.TexCoord[1], start, n ); } } VB->ObjPtr = VSrc.Obj; VB->NormalPtr = VSrc.Normal; VB->Color[0] = VB->Color[1] = VB->ColorPtr = VSrc.Color; VB->IndexPtr = VSrc.Index; VB->EdgeFlagPtr = VSrc.EdgeFlag; VB->TexCoordPtr[0] = VSrc.TexCoord[0]; VB->TexCoordPtr[1] = VSrc.TexCoord[1]; VB->Flag = ctx->Array.Flag; VB->AndFlag = ctx->Array.Flags; VB->OrFlag = ctx->Array.Flags; count = VB->Count = VB_START + n; VB->ObjPtr->count = count; VB->NormalPtr->count = count; VB->ColorPtr->count = count; VB->IndexPtr->count = count; VB->EdgeFlagPtr->count = count; VB->TexCoordPtr[0]->count = count; VB->TexCoordPtr[1]->count = count; VB->Flag[count] |= VERT_END_VB; VB->Flag[VB_START] |= VERT_NORM; /* VB->Flag[VB_START] |= (IM->Flag[vb_start] & VERT_MATERIAL); */ VB->NextPrimitive[VB->CopyStart] = VB->Count; VB->Primitive[VB->CopyStart] = mode; /* Transform and render. */ gl_run_pipeline( VB ); gl_reset_vb( VB ); ctx->Array.Flag[count] = ctx->Array.Flags; ctx->Array.Flag[VB_START] = ctx->Array.Flags; IM->Flag[VB_START] = 0; start += n; remaining -= n; } ctx->CompileCVAFlag = relock; } else if (ctx->Array.Vertex.Enabled) { /* The GL_COMPILE and GL_COMPILE_AND_EXECUTE cases. These * could be handled by the above code, but it gets a little * complex. */ /* No need to reset - never called from inside a display list */ gl_Begin( ctx, mode ); for (i=0;imaybe_transform_vb() callback. */ #define DRAW_ELT(FUNC, TYPE) \ static void FUNC( GLcontext *ctx, GLenum mode, \ TYPE *indices, GLuint count ) \ { \ GLuint i,j; \ \ if (count) gl_Begin( ctx, mode ); \ \ for (j = 0 ; j < count ; ) { \ GLuint nr = MIN2( VB_MAX, count - j + VB_START ); \ struct immediate *IM = ctx->input; \ GLuint sf = IM->Flag[VB_START]; \ GLuint flags = IM->ArrayOrFlags; \ \ for (i = VB_START ; i < nr ; i++) { \ IM->Elt[i] = (GLuint) *indices++; \ IM->Flag[i] = flags; \ } \ \ if (j == 0) IM->Flag[VB_START] |= sf; \ \ IM->Count = nr; \ j += nr - VB_START; \ \ if (j == count) gl_End( ctx ); \ \ IM->maybe_transform_vb( IM ); \ } \ } DRAW_ELT( draw_elt_ubyte, GLubyte ) DRAW_ELT( draw_elt_ushort, GLushort ) DRAW_ELT( draw_elt_uint, GLuint ) static GLuint natural_stride[0x10] = { sizeof(GLbyte), /* 0 */ sizeof(GLubyte), /* 1 */ sizeof(GLshort), /* 2 */ sizeof(GLushort), /* 3 */ sizeof(GLint), /* 4 */ sizeof(GLuint), /* 5 */ sizeof(GLfloat), /* 6 */ 2 * sizeof(GLbyte), /* 7 */ 3 * sizeof(GLbyte), /* 8 */ 4 * sizeof(GLbyte), /* 9 */ sizeof(GLdouble), /* a */ 0, /* b */ 0, /* c */ 0, /* d */ 0, /* e */ 0 /* f */ }; void GLAPIENTRY glDrawElements(CTX_ARG GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) { GLcontext *ctx; struct gl_cva *cva; GET_CONTEXT; CHECK_CONTEXT; ctx = CC; cva = &ctx->CVA; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDrawElements"); if (count<0) { gl_error( ctx, GL_INVALID_VALUE, "glDrawElements(count)" ); return; } if (mode < 0 || mode > GL_POLYGON) { gl_error( ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" ); return; } if (type != GL_UNSIGNED_INT && type != GL_UNSIGNED_BYTE && type != GL_UNSIGNED_SHORT) { gl_error( ctx, GL_INVALID_ENUM, "glDrawElements(type)" ); return; } if (ctx->NewState) gl_update_state(ctx); if (ctx->CompileCVAFlag) { #if defined(MESA_CVA_PROF) force_init_prof(); #endif /* Treat VERT_ELT like a special client array. */ ctx->Array.NewArrayState |= VERT_ELT; ctx->Array.Summary |= VERT_ELT; ctx->Array.Flags |= VERT_ELT; cva->elt_mode = mode; cva->elt_count = count; cva->Elt.Type = type; cva->Elt.Ptr = (void *) indices; cva->Elt.StrideB = natural_stride[TYPE_IDX(type)]; cva->EltFunc = gl_trans_1ui_tab[TYPE_IDX(type)]; if (!cva->pre.pipeline_valid) gl_build_precalc_pipeline( ctx ); else if (MESA_VERBOSE & VERBOSE_PIPELINE) fprintf(stderr, ": dont rebuild\n"); gl_cva_force_precalc( ctx ); /* Did we 'precalculate' the render op? */ if (ctx->CVA.pre.ops & PIPE_OP_RENDER) { ctx->Array.NewArrayState |= VERT_ELT; ctx->Array.Summary &= ~VERT_ELT; ctx->Array.Flags &= ~VERT_ELT; return; } if ( (MESA_VERBOSE&VERBOSE_VARRAY) ) printf("using immediate\n"); } /* Otherwise, have to use the immediate path to render. */ switch (type) { case GL_UNSIGNED_BYTE: { GLubyte *ub_indices = (GLubyte *) indices; if (ctx->Array.Summary & VERT_OBJ_ANY) { draw_elt_ubyte( ctx, mode, ub_indices, count ); } else { gl_ArrayElement( ctx, (GLuint) ub_indices[count-1] ); } } break; case GL_UNSIGNED_SHORT: { GLushort *us_indices = (GLushort *) indices; if (ctx->Array.Summary & VERT_OBJ_ANY) { draw_elt_ushort( ctx, mode, us_indices, count ); } else { gl_ArrayElement( ctx, (GLuint) us_indices[count-1] ); } } break; case GL_UNSIGNED_INT: { GLuint *ui_indices = (GLuint *) indices; if (ctx->Array.Summary & VERT_OBJ_ANY) { draw_elt_uint( ctx, mode, ui_indices, count ); } else { gl_ArrayElement( ctx, ui_indices[count-1] ); } } break; default: gl_error( ctx, GL_INVALID_ENUM, "glDrawElements(type)" ); break; } if (ctx->CompileCVAFlag) { ctx->Array.NewArrayState |= VERT_ELT; ctx->Array.Summary &= ~VERT_ELT; } } void GLAPIENTRY glInterleavedArrays(CTX_ARG GLenum format, GLsizei stride, const GLvoid *pointer ) { GLcontext *ctx; GLboolean tflag, cflag, nflag; /* enable/disable flags */ GLint tcomps, ccomps, vcomps; /* components per texcoord, color, vertex */ GLenum ctype; /* color type */ GLint coffset, noffset, voffset;/* color, normal, vertex offsets */ GLint defstride; /* default stride */ GLint c, f; GLint coordUnitSave; GET_CONTEXT; CHECK_CONTEXT; ctx = CC; f = sizeof(GLfloat); c = f * ((4*sizeof(GLubyte) + (f-1)) / f); if (stride<0) { gl_error( ctx, GL_INVALID_VALUE, "glInterleavedArrays(stride)" ); return; } switch (format) { case GL_V2F: tflag = GL_FALSE; cflag = GL_FALSE; nflag = GL_FALSE; tcomps = 0; ccomps = 0; vcomps = 2; voffset = 0; defstride = 2*f; break; case GL_V3F: tflag = GL_FALSE; cflag = GL_FALSE; nflag = GL_FALSE; tcomps = 0; ccomps = 0; vcomps = 3; voffset = 0; defstride = 3*f; break; case GL_C4UB_V2F: tflag = GL_FALSE; cflag = GL_TRUE; nflag = GL_FALSE; tcomps = 0; ccomps = 4; vcomps = 2; ctype = GL_UNSIGNED_BYTE; coffset = 0; voffset = c; defstride = c + 2*f; break; case GL_C4UB_V3F: tflag = GL_FALSE; cflag = GL_TRUE; nflag = GL_FALSE; tcomps = 0; ccomps = 4; vcomps = 3; ctype = GL_UNSIGNED_BYTE; coffset = 0; voffset = c; defstride = c + 3*f; break; case GL_C3F_V3F: tflag = GL_FALSE; cflag = GL_TRUE; nflag = GL_FALSE; tcomps = 0; ccomps = 3; vcomps = 3; ctype = GL_FLOAT; coffset = 0; voffset = 3*f; defstride = 6*f; break; case GL_N3F_V3F: tflag = GL_FALSE; cflag = GL_FALSE; nflag = GL_TRUE; tcomps = 0; ccomps = 0; vcomps = 3; noffset = 0; voffset = 3*f; defstride = 6*f; break; case GL_C4F_N3F_V3F: tflag = GL_FALSE; cflag = GL_TRUE; nflag = GL_TRUE; tcomps = 0; ccomps = 4; vcomps = 3; ctype = GL_FLOAT; coffset = 0; noffset = 4*f; voffset = 7*f; defstride = 10*f; break; case GL_T2F_V3F: tflag = GL_TRUE; cflag = GL_FALSE; nflag = GL_FALSE; tcomps = 2; ccomps = 0; vcomps = 3; voffset = 2*f; defstride = 5*f; break; case GL_T4F_V4F: tflag = GL_TRUE; cflag = GL_FALSE; nflag = GL_FALSE; tcomps = 4; ccomps = 0; vcomps = 4; voffset = 4*f; defstride = 8*f; break; case GL_T2F_C4UB_V3F: tflag = GL_TRUE; cflag = GL_TRUE; nflag = GL_FALSE; tcomps = 2; ccomps = 4; vcomps = 3; ctype = GL_UNSIGNED_BYTE; coffset = 2*f; voffset = c+2*f; defstride = c+5*f; break; case GL_T2F_C3F_V3F: tflag = GL_TRUE; cflag = GL_TRUE; nflag = GL_FALSE; tcomps = 2; ccomps = 3; vcomps = 3; ctype = GL_FLOAT; coffset = 2*f; voffset = 5*f; defstride = 8*f; break; case GL_T2F_N3F_V3F: tflag = GL_TRUE; cflag = GL_FALSE; nflag = GL_TRUE; tcomps = 2; ccomps = 0; vcomps = 3; noffset = 2*f; voffset = 5*f; defstride = 8*f; break; case GL_T2F_C4F_N3F_V3F: tflag = GL_TRUE; cflag = GL_TRUE; nflag = GL_TRUE; tcomps = 2; ccomps = 4; vcomps = 3; ctype = GL_FLOAT; coffset = 2*f; noffset = 6*f; voffset = 9*f; defstride = 12*f; break; case GL_T4F_C4F_N3F_V4F: tflag = GL_TRUE; cflag = GL_TRUE; nflag = GL_TRUE; tcomps = 4; ccomps = 4; vcomps = 4; ctype = GL_FLOAT; coffset = 4*f; noffset = 8*f; voffset = 11*f; defstride = 15*f; break; default: gl_error( ctx, GL_INVALID_ENUM, "glInterleavedArrays(format)" ); return; } if (stride==0) { stride = defstride; } gl_DisableClientState( ctx, GL_EDGE_FLAG_ARRAY ); gl_DisableClientState( ctx, GL_INDEX_ARRAY ); /* Texcoords */ coordUnitSave = ctx->TexCoordUnit; if (tflag) { GLint i; GLint factor = ctx->Array.TexCoordInterleaveFactor; for (i = 0; i < factor; i++) { gl_ActiveTexture( ctx, (GLenum) (GL_TEXTURE0_ARB + i) ); gl_EnableClientState( ctx, GL_TEXTURE_COORD_ARRAY ); glTexCoordPointer(CTX_PRM tcomps, GL_FLOAT, stride, (GLubyte *) pointer + i * coffset ); } for (i = factor; i < ctx->Const.MaxTextureUnits; i++) { gl_ActiveTexture( ctx, (GLenum) (GL_TEXTURE0_ARB + i) ); gl_DisableClientState( ctx, GL_TEXTURE_COORD_ARRAY ); } } else { GLint i; for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { gl_ActiveTexture( ctx, (GLenum) (GL_TEXTURE0_ARB + i) ); gl_DisableClientState( ctx, GL_TEXTURE_COORD_ARRAY ); } } /* Restore texture coordinate unit index */ gl_ActiveTexture( ctx, (GLenum) (GL_TEXTURE0_ARB + coordUnitSave) ); /* Color */ if (cflag) { gl_EnableClientState( ctx, GL_COLOR_ARRAY ); glColorPointer(CTX_PRM ccomps, ctype, stride, (GLubyte*) pointer + coffset ); } else { gl_DisableClientState( ctx, GL_COLOR_ARRAY ); } /* Normals */ if (nflag) { gl_EnableClientState( ctx, GL_NORMAL_ARRAY ); glNormalPointer(CTX_PRM GL_FLOAT, stride, (GLubyte*) pointer + noffset ); } else { gl_DisableClientState( ctx, GL_NORMAL_ARRAY ); } gl_EnableClientState( ctx, GL_VERTEX_ARRAY ); glVertexPointer(CTX_PRM vcomps, GL_FLOAT, stride, (GLubyte *) pointer + voffset ); } void GLAPIENTRY glDrawRangeElements(CTX_ARG GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices ) { GLcontext *ctx; GET_CONTEXT; CHECK_CONTEXT; ctx = CC; if (end < start) { gl_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements( end < start )"); return; } if (!ctx->Array.LockCount && 2*count > 3*(end-start)) { glLockArraysEXT(CTX_PRM start, end ); glDrawElements(CTX_PRM mode, count, type, indices ); glUnlockArraysEXT(CTX_VPRM ); } else { glDrawElements(CTX_PRM mode, count, type, indices ); } } void gl_update_client_state( GLcontext *ctx ) { static GLuint sz_flags[5] = { 0, 0, VERT_OBJ_2, VERT_OBJ_23, VERT_OBJ_234 }; static GLuint tc_flags[5] = { 0, VERT_TEX0_1, VERT_TEX0_12, VERT_TEX0_123, VERT_TEX0_1234 }; ctx->Array.Flags = 0; ctx->Array.Summary = 0; ctx->input->ArrayIncr = 0; if (ctx->Array.Normal.Enabled) ctx->Array.Flags |= VERT_NORM; if (ctx->Array.Color.Enabled) ctx->Array.Flags |= VERT_RGBA; if (ctx->Array.Index.Enabled) ctx->Array.Flags |= VERT_INDEX; if (ctx->Array.EdgeFlag.Enabled) ctx->Array.Flags |= VERT_EDGE; if (ctx->Array.Vertex.Enabled) { ctx->Array.Flags |= sz_flags[ctx->Array.Vertex.Size]; ctx->input->ArrayIncr = 1; } if (ctx->Array.TexCoord[0].Enabled) { ctx->Array.Flags |= tc_flags[ctx->Array.TexCoord[0].Size]; } if (ctx->Array.TexCoord[1].Enabled) { ctx->Array.Flags |= (tc_flags[ctx->Array.TexCoord[1].Size] << NR_TEXSIZE_BITS); } /* Not really important any more: */ ctx->Array.Summary = ctx->Array.Flags & VERT_DATA; ctx->input->ArrayOrFlags = (ctx->Array.Flags & VERT_OBJ_234) | VERT_ELT; ctx->input->ArrayAndFlags = ~ctx->Array.Flags; ctx->input->ArrayEltFlush = !(ctx->CompileCVAFlag); } @ 3.40 log @fix for miklos' cva line bug @ text @d1 1 a1 1 /* $Id: varray.c,v 3.39 1999/08/02 19:23:58 keithw Exp $ */ a26 13 /* KW: gl_DrawArrays now has fast paths for every possible type, size * and stride and combination of input data, including cases * where the data is not in the internal format. */ /* KW: Implemented CVA support. */ a1253 3 ctx->CompileCVAFlag = (ctx->Array.LockCount && ((ctx->Array.Flags & ctx->Flags) != 0)); @ 3.39 log @fix for miklos' color clipping bug @ text @d1 1 a1 1 /* $Id: varray.c,v 3.38 1999/08/01 11:36:54 brianp Exp $ */ d1267 3 @ 3.38 log @replaced a break with return @ text @d1 1 a1 1 /* $Id: varray.c,v 3.37 1999/08/01 09:46:26 miklos Exp $ */ d762 1 a762 2 VB->ColorPtr = VSrc.Color; VB->Color[0] = VB->Color[1] = VB->ColorPtr; @ 3.37 log @added type checkingin glDrawElements in CVA mode. @ text @d1 1 a1 1 /* $Id: varray.c,v 3.36 1999/07/29 17:45:48 miklos Exp $ */ d916 1 a916 1 break; @ 3.36 log @added CTX_ARG, to api calls. @ text @d1 1 a1 1 /* $Id: varray.c,v 3.35 1999/07/20 19:36:13 keithw Exp $ */ d911 6 @ 3.35 log @correct stride for non-uint array elts @ text @d1 1 a1 1 /* $Id: varray.c,v 3.34 1999/07/13 15:43:40 brianp Exp $ */ d47 1 d72 1 a72 1 void GLAPIENTRY glVertexPointer( GLint size, GLenum type, GLsizei stride, d75 5 a79 1 GLcontext *ctx = CC; d127 1 a127 1 void GLAPIENTRY glNormalPointer( GLenum type, GLsizei stride, d130 5 a134 1 GLcontext *ctx = CC; d179 1 a179 1 void GLAPIENTRY glColorPointer( GLint size, GLenum type, GLsizei stride, d182 4 a185 1 GLcontext *ctx = CC; d244 1 a244 1 void GLAPIENTRY glIndexPointer( GLenum type, GLsizei stride, d247 5 a251 1 GLcontext *ctx = CC; d291 1 a291 1 void GLAPIENTRY glTexCoordPointer( GLint size, GLenum type, d294 9 a302 2 GLcontext *ctx = CC; GLuint texUnit = ctx->TexCoordUnit; d353 1 a353 1 void GLAPIENTRY glEdgeFlagPointer( GLsizei stride, const void *vptr ) a354 1 GLcontext *ctx = CC; d356 6 d890 1 a890 1 void GLAPIENTRY glDrawElements( GLenum mode, GLsizei count, d893 8 a900 2 GLcontext *ctx = CC; struct gl_cva *cva = &ctx->CVA; d1002 1 a1002 1 void GLAPIENTRY glInterleavedArrays( GLenum format, GLsizei stride, d1005 1 a1005 1 GLcontext *ctx = CC; d1014 5 d1154 1 a1154 1 glTexCoordPointer( tcomps, GL_FLOAT, stride, d1176 1 a1176 1 glColorPointer( ccomps, ctype, stride, d1187 1 a1187 1 glNormalPointer( GL_FLOAT, stride, d1195 1 a1195 1 glVertexPointer( vcomps, GL_FLOAT, stride, d1201 1 a1201 1 void GLAPIENTRY glDrawRangeElements( GLenum mode, GLuint start, d1205 4 a1208 1 GLcontext *ctx = CC; d1216 3 a1218 3 glLockArraysEXT( start, end ); glDrawElements( mode, count, type, indices ); glUnlockArraysEXT( ); d1220 1 a1220 1 glDrawElements( mode, count, type, indices ); @ 3.34 log @removed GLAPI keywords @ text @d1 1 a1 1 /* $Id: varray.c,v 3.33 1999/07/13 10:40:57 brianp Exp $ */ d842 20 d898 1 @ 3.33 log @added GLAPI, GLAPIENTRY keywords @ text @d1 1 a1 1 /* $Id: varray.c,v 3.32 1999/07/12 12:05:25 keithw Exp $ */ d71 2 a72 2 GLAPI void GLAPIENTRY glVertexPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *ptr ) d122 2 a123 2 GLAPI void GLAPIENTRY glNormalPointer( GLenum type, GLsizei stride, const GLvoid *ptr ) d170 2 a171 2 GLAPI void GLAPIENTRY glColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *ptr ) d232 2 a233 2 GLAPI void GLAPIENTRY glIndexPointer( GLenum type, GLsizei stride, const GLvoid *ptr ) d275 2 a276 2 GLAPI void GLAPIENTRY glTexCoordPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *ptr ) d330 1 a330 1 GLAPI void GLAPIENTRY glEdgeFlagPointer( GLsizei stride, const void *vptr ) d842 2 a843 2 GLAPI void GLAPIENTRY glDrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) d947 2 a948 2 GLAPI void GLAPIENTRY glInterleavedArrays( GLenum format, GLsizei stride, const GLvoid *pointer ) d1141 3 a1143 4 GLAPI void GLAPIENTRY glDrawRangeElements( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices ) @ 3.32 log @merge from experimental branch upto merge-1 tag @ text @d1 1 a1 1 /* $Id: varray.c,v 3.31 1999/07/08 21:20:06 brianp Exp $ */ d71 2 a72 3 void glVertexPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *ptr ) d122 2 a123 2 void glNormalPointer( GLenum type, GLsizei stride, const GLvoid *ptr ) d170 2 a171 3 void glColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *ptr ) d232 2 a233 2 void glIndexPointer( GLenum type, GLsizei stride, const GLvoid *ptr ) d275 2 a276 3 void glTexCoordPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *ptr ) d330 1 a330 1 GLAPI void GLAPIENTRY glEdgeFlagPointer(GLsizei stride, const void *vptr ) a453 2 d842 2 a843 3 void glDrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) d947 2 a948 4 void glInterleavedArrays( GLenum format, GLsizei stride, const GLvoid *pointer ) d1141 4 a1144 5 void glDrawRangeElements( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices ) a1160 2 @ 3.31 log @texture coord size wasn't being set in gl_DrawArrays (andy@@guildsoftware.com) @ text @d1 1 a1 1 /* $Id: varray.c,v 3.30 1999/06/01 10:42:29 keithw Exp $ */ d71 1 a71 1 void gl_VertexPointer( GLcontext *ctx, d75 1 d85 1 a85 1 if (MESA_VERBOSE&VERBOSE_VARRAY) d90 3 a92 1 switch (type) { d94 1 a94 1 ctx->Array.Vertex.StrideB = stride ? stride : size*sizeof(GLshort); d97 1 a97 1 ctx->Array.Vertex.StrideB = stride ? stride : size*sizeof(GLint); d100 1 a100 1 ctx->Array.Vertex.StrideB = stride ? stride : size*sizeof(GLfloat); d103 1 a103 1 ctx->Array.Vertex.StrideB = stride ? stride : size*sizeof(GLdouble); d108 1 d123 1 a123 1 void gl_NormalPointer( GLcontext *ctx, d126 1 d132 1 a132 1 if (MESA_VERBOSE&VERBOSE_VARRAY) d137 3 a139 1 switch (type) { d141 1 a141 1 ctx->Array.Normal.StrideB = stride ? stride : 3*sizeof(GLbyte); d144 1 a144 1 ctx->Array.Normal.StrideB = stride ? stride : 3*sizeof(GLshort); d147 1 a147 1 ctx->Array.Normal.StrideB = stride ? stride : 3*sizeof(GLint); d150 1 a150 1 ctx->Array.Normal.StrideB = stride ? stride : 3*sizeof(GLfloat); d153 1 a153 1 ctx->Array.Normal.StrideB = stride ? stride : 3*sizeof(GLdouble); d158 1 d171 1 a171 1 void gl_ColorPointer( GLcontext *ctx, d175 1 d185 1 a185 1 if (MESA_VERBOSE&VERBOSE_VARRAY) d190 3 a192 1 switch (type) { d194 1 a194 1 ctx->Array.Color.StrideB = stride ? stride : size*sizeof(GLbyte); d197 1 a197 1 ctx->Array.Color.StrideB = stride ? stride : size*sizeof(GLubyte); d200 1 a200 1 ctx->Array.Color.StrideB = stride ? stride : size*sizeof(GLshort); d203 1 a203 1 ctx->Array.Color.StrideB = stride ? stride : size*sizeof(GLushort); d206 1 a206 1 ctx->Array.Color.StrideB = stride ? stride : size*sizeof(GLint); d209 1 a209 1 ctx->Array.Color.StrideB = stride ? stride : size*sizeof(GLuint); d212 1 a212 1 ctx->Array.Color.StrideB = stride ? stride : size*sizeof(GLfloat); d215 1 a215 1 ctx->Array.Color.StrideB = stride ? stride : size*sizeof(GLdouble); d220 1 d234 1 a234 1 void gl_IndexPointer( GLcontext *ctx, d237 1 d242 4 a245 1 switch (type) { d247 1 a247 1 ctx->Array.Index.StrideB = stride ? stride : sizeof(GLubyte); d250 1 a250 1 ctx->Array.Index.StrideB = stride ? stride : sizeof(GLshort); d253 1 a253 1 ctx->Array.Index.StrideB = stride ? stride : sizeof(GLint); d256 1 a256 1 ctx->Array.Index.StrideB = stride ? stride : sizeof(GLfloat); d259 1 a259 1 ctx->Array.Index.StrideB = stride ? stride : sizeof(GLdouble); d264 1 d277 1 a277 1 void gl_TexCoordPointer( GLcontext *ctx, d281 1 d292 1 a292 1 if (MESA_VERBOSE&VERBOSE_VARRAY) d299 3 a301 1 switch (type) { d303 1 a303 1 ctx->Array.TexCoord[texUnit].StrideB = stride ? stride : size*sizeof(GLshort); d306 1 a306 1 ctx->Array.TexCoord[texUnit].StrideB = stride ? stride : size*sizeof(GLint); d309 1 a309 1 ctx->Array.TexCoord[texUnit].StrideB = stride ? stride : size*sizeof(GLfloat); d312 1 a312 1 ctx->Array.TexCoord[texUnit].StrideB = stride ? stride : size*sizeof(GLdouble); d317 1 d326 1 a326 52 ctx->Array.NewArrayState |= VERT_TEX_ANY(texUnit); ctx->NewState |= NEW_CLIENT_STATE; } /* GL_SGIS_multitexture ONLY!!! */ void gl_MultiTexCoordPointer( GLcontext *ctx, GLenum texUnit, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr ) { if (stride<0) { gl_error( ctx, GL_INVALID_VALUE, "glMultiTexCoordPointer(stride)" ); return; } if (size<1 || size>4) { gl_error( ctx, GL_INVALID_VALUE, "glMultiTexCoordPointer(size)" ); return; } if (MESA_VERBOSE&VERBOSE_VARRAY) fprintf(stderr, "glMultiTexCoordPointer( unit %d sz %d type %s stride %d )\n", texUnit, size, gl_lookup_enum_by_nr( type ), stride); switch (type) { case GL_SHORT: ctx->Array.TexCoord[texUnit].StrideB = stride ? stride : size*sizeof(GLshort); break; case GL_INT: ctx->Array.TexCoord[texUnit].StrideB = stride ? stride : size*sizeof(GLint); break; case GL_FLOAT: ctx->Array.TexCoord[texUnit].StrideB = stride ? stride : size*sizeof(GLfloat); break; case GL_DOUBLE: ctx->Array.TexCoord[texUnit].StrideB = stride ? stride : size*sizeof(GLdouble); break; default: gl_error( ctx, GL_INVALID_ENUM, "glMultiTexCoordPointer(type)" ); return; } ctx->Array.TexCoord[texUnit].Size = size; ctx->Array.TexCoord[texUnit].Type = type; ctx->Array.TexCoord[texUnit].Stride = stride; ctx->Array.TexCoord[texUnit].Ptr = (void *) ptr; ctx->Array.TexCoordFunc[texUnit] = gl_trans_4f_tab[size][TYPE_IDX(type)]; ctx->Array.TexCoordEltFunc[texUnit] = gl_trans_elt_4f_tab[size][TYPE_IDX(type)]; ctx->Array.NewArrayState |= VERT_TEX_ANY(texUnit); a331 9 void gl_InterleavedTextureCoordSets( GLcontext *ctx, GLint factor ) { if (factor < 1 || factor > ctx->Const.MaxTextureUnits) { gl_error( ctx, GL_INVALID_VALUE, "glInterleavedTextureCoordSets" ); return; } ctx->Array.TexCoordInterleaveFactor = factor; } d333 1 a333 3 void gl_EdgeFlagPointer( GLcontext *ctx, GLsizei stride, const GLboolean *ptr ) d335 2 d355 26 d389 1 a389 1 GLuint *elts = IM->ArrayElt; d394 1 a394 1 d477 1 a477 1 GLint i, n = MIN2(VB_MAX, count); d484 1 a484 1 GLuint update = 0, translate = 0, copy = 0; d487 4 d495 11 d514 17 a530 14 if (ctx->Flags & VERT_RGBA) { if (ctx->Array.Color.Enabled) { if (ctx->Array.Color.Type == GL_UNSIGNED_BYTE && ctx->Array.Color.Size == 4 && ctx->Array.Color.StrideB == 4) /* fix me */ { VSrc.Color = &col; col.data = (GLubyte (*)[4]) ctx->Array.Color.Ptr; col.stride = ctx->Array.Color.StrideB; col.flags = 0; update |= VERT_RGBA; } else { translate |= VERT_RGBA; } d532 2 a533 4 for (i=0;iColor[i], ctx->Current.ByteColor ); } } d536 16 a551 13 if (ctx->Flags & VERT_INDEX) { if (ctx->Array.Index.Enabled) { if (ctx->Array.Index.Type == GL_UNSIGNED_INT && ctx->Array.Index.StrideB == sizeof(GLuint)) { VSrc.Index = &index; index.data = (GLuint *) ctx->Array.Index.Ptr; index.stride = ctx->Array.Index.StrideB; index.flags = 0; update |= VERT_INDEX; } else { translate |= VERT_INDEX; } d553 2 a554 4 for (i=0;iIndex[i] = ctx->Current.Index; } } d561 20 a580 13 if (ctx->Flags & flag) { if (ctx->Array.TexCoord[i].Enabled) { if (ctx->Array.TexCoord[i].Type == GL_FLOAT) { VSrc.TexCoord[i] = &tc[i]; tc[i].data = (GLfloat (*)[4]) ctx->Array.TexCoord[i].Ptr; tc[i].stride = ctx->Array.TexCoord[i].StrideB; tc[i].size = ctx->Array.TexCoord[i].Size; tc[i].flags = 0; update |= flag; } else { translate |= flag; } d582 1 a582 15 GLuint sz = ctx->Current.TexcoordSize[i]; if (ctx->Texture.Unit[i].TexGenEnabled || ctx->TextureMatrix[i].type != MATRIX_IDENTITY) { tc[i].size = sz; copy |= (i+1); } else { GLuint j; IM->v.TexCoord[i].size = sz; for (j=0;jTexCoord[i][j], ctx->Current.Texcoord[i] ); } a594 1 obj.flags = 0; d598 4 d609 13 a621 11 if (ctx->Flags & VERT_NORM) { if (ctx->Array.Normal.Enabled) { if (ctx->Array.Normal.Type == GL_FLOAT) { VSrc.Normal = &norm; norm.flags = 0; norm.data = (GLfloat (*)[3]) ctx->Array.Normal.Ptr; norm.stride = ctx->Array.Normal.StrideB; update |= VERT_NORM; } else { translate |= VERT_NORM; } d623 1 a623 1 copy |= VERT_NORM; d627 1 a627 1 if ( (ctx->Flags & VERT_EDGE) && d632 13 a644 15 if (ctx->Array.EdgeFlag.Enabled) { if (ctx->Array.EdgeFlag.StrideB == sizeof(GLubyte)) { VSrc.EdgeFlag = &edge; edge.flags = 0; edge.data = (GLboolean *) ctx->Array.EdgeFlag.Ptr; edge.stride = sizeof(GLboolean); update |= VERT_EDGE; } else { translate |= VERT_EDGE; } } else { for (i=0;iEdgeFlag[i] = ctx->Current.EdgeFlag; } } a653 1 GLuint vb_start = VB_START; d672 1 a672 1 if (update & VERT_OBJ_ANY) { a673 1 } d675 1 a675 1 if (update & VERT_NORM) { a676 1 } d678 1 a678 1 if (update & VERT_EDGE) { a679 1 } d681 1 a681 1 if (update & VERT_RGBA) { a682 1 } d684 1 a684 1 if (update & VERT_INDEX) { a685 1 } d687 1 a687 1 if (update & VERT_TEX0_ANY) { a688 1 } d690 1 a690 1 if (update & VERT_TEX1_ANY) { a691 1 } a735 24 /* Duplicate any required 'current' values which get * scribbled in gl_transform_vb - could allocate safe storage * to hold the defaults. */ if (copy) { if (copy & VERT_TEX0_ANY) { for (i=VB_START;iTexCoord[0][i], ctx->Current.Texcoord[0]); } IM->v.TexCoord[0].size = tc[0].size; } if (copy & VERT_TEX1_ANY) { for (i=VB_START;iTexCoord[1][i], ctx->Current.Texcoord[1]); } IM->v.TexCoord[1].size = tc[1].size; } if (copy & VERT_NORM) { COPY_3V(IM->Normal[VB_START], ctx->Current.Normal); } } d762 1 a762 1 VB->Flag[VB_START] |= (IM->Flag[vb_start] & VERT_MATERIAL); d769 1 a769 1 gl_run_pipeline( VB, PIPE_IMMEDIATE ); d779 2 d827 1 a827 1 IM->ArrayElt[i] = (GLuint) *indices++; \ d847 1 a847 1 void gl_DrawElements( GLcontext *ctx, d851 1 a851 1 GLuint use_immediate = 1; a867 2 /* Can we use a fast path for CVA? */ d870 15 a884 2 if (ctx->Array.NewState || ctx->Array.NewArrayState) cva->pre.pipeline_valid = 0; d887 3 a889 1 gl_update_cva_pipelines( ctx ); d891 1 d893 8 a900 3 use_immediate = (ctx->CVA.elt.inputs & ~ctx->CVA.pre.outputs & ~(VERT_ELT|VERT_MATERIAL)); d902 1 a902 9 if (ctx->CVA.elt.ops != PIPE_OP_RENDER || (ctx->IndirectTriangles & DD_TRI_CULL) || (type != GL_UNSIGNED_INT && (count > cva->VB->Size || (ctx->Array.Summary & VERT_INDEX)))) { use_immediate = 1; } if ((MESA_VERBOSE&VERBOSE_VARRAY) && use_immediate) d906 3 d910 34 a943 21 case GL_UNSIGNED_BYTE: if (use_immediate) { GLubyte *ub_indices = (GLubyte *) indices; if (ctx->Array.Summary & VERT_OBJ_ANY) { draw_elt_ubyte( ctx, mode, ub_indices, count ); } else { gl_ArrayElement( ctx, (GLuint) ub_indices[count-1] ); } } else { GLuint i; GLubyte *ub_indices = (GLubyte *) indices; GLuint *elt = cva->VB->store.Index->data; /* dodgy */ if (!cva->pre.data_valid) gl_cva_force_precalc( ctx ); for (i = 0 ; i < count ; i++) elt[i] = (GLuint) ub_indices[i]; d945 3 a947 58 START_FAST_MATH; if (!cva->VB->Culled) ctx->Driver.RenderElementsCVA( ctx->CVA.VB, mode, elt, count ); END_FAST_MATH; } break; case GL_UNSIGNED_SHORT: if (use_immediate) { GLushort *us_indices = (GLushort *) indices; if (ctx->Array.Summary & VERT_OBJ_ANY) { draw_elt_ushort( ctx, mode, us_indices, count ); } else { gl_ArrayElement( ctx, (GLuint) us_indices[count-1] ); } } else { GLuint i; GLushort *us_indices = (GLushort *) indices; GLuint *elt = cva->VB->store.Index->data; /* dodgy */ if (!cva->pre.data_valid) gl_cva_force_precalc( ctx ); for (i = 0 ; i < count ; i++) elt[i] = (GLuint) us_indices[i]; START_FAST_MATH; if (!cva->VB->Culled) ctx->Driver.RenderElementsCVA( ctx->CVA.VB, mode, elt, count ); END_FAST_MATH; } break; case GL_UNSIGNED_INT: if (use_immediate) { GLuint *ui_indices = (GLuint *) indices; if (ctx->Array.Summary & VERT_OBJ_ANY) { draw_elt_uint( ctx, mode, ui_indices, count ); } else { gl_ArrayElement( ctx, ui_indices[count-1] ); } } else { if (!cva->pre.data_valid) gl_cva_force_precalc( ctx ); START_FAST_MATH; if (!cva->VB->Culled) ctx->Driver.RenderElementsCVA( ctx->CVA.VB, mode, (GLuint *) indices, count ); END_FAST_MATH; } break; default: gl_error( ctx, GL_INVALID_ENUM, "glDrawElements(type)" ); return; d954 1 a954 1 void gl_InterleavedArrays( GLcontext *ctx, d958 1 d1100 1 a1100 1 gl_SelectTextureCoordSet( ctx, (GLenum) (GL_TEXTURE0_SGIS + i) ); d1102 1 a1102 1 gl_TexCoordPointer( ctx, tcomps, GL_FLOAT, stride, d1106 1 a1106 1 gl_SelectTextureCoordSet( ctx, (GLenum) (GL_TEXTURE0_SGIS + i) ); d1113 1 a1113 1 gl_SelectTextureCoordSet( ctx, (GLenum) (GL_TEXTURE0_SGIS + i) ); d1118 1 a1118 1 gl_SelectTextureCoordSet( ctx, (GLenum) (GL_TEXTURE0_SGIS + coordUnitSave) ); d1124 1 a1124 1 gl_ColorPointer( ctx, ccomps, ctype, stride, d1135 1 a1135 1 gl_NormalPointer( ctx, GL_FLOAT, stride, d1143 1 a1143 1 gl_VertexPointer( ctx, vcomps, GL_FLOAT, stride, d1151 3 a1153 3 void gl_DrawRangeElements( GLcontext *ctx, GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices ) d1155 2 d1163 3 a1165 3 gl_LockArrays( ctx, start, end ); gl_DrawElements( ctx, mode, count, type, indices ); gl_UnlockArrays( ctx ); d1167 1 a1167 1 gl_DrawElements( ctx, mode, count, type, indices ); a1206 3 /* gl_print_vert_flags("ctx->Array.Flags", ctx->Array.Flags); */ d1214 1 a1214 3 if (ctx->Array.LockCount) gl_LockArrays( ctx, ctx->Array.LockFirst, ctx->Array.LockCount ); @ 3.30 log @small bug in drawRangeElements @ text @d1 1 a1 1 /* $Id: varray.c,v 3.29 1999/05/16 17:09:59 keithw Exp $ */ d564 1 @ 3.29 log @misc. bug fixes @ text @d1 1 a1 1 /* $Id: varray.c,v 3.28 1999/05/11 17:43:00 keithw Exp $ */ d1216 1 a1216 1 if (!ctx->Array.LockCount && 2*count > 3*(start-end)) { @ 3.29.2.1 log @Quake3 inspired optimizations @ text @d1 1 a1 1 /* $Id: varray.c,v 3.29 1999/05/16 17:09:59 keithw Exp $ */ d84 1 a84 1 if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) d127 1 a127 1 if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) d176 1 a176 1 if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) d274 1 a274 1 if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) d305 1 a305 1 ctx->Array.NewArrayState |= PIPE_TEX(texUnit); d325 1 a325 1 if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) d356 1 a356 1 ctx->Array.NewArrayState |= PIPE_TEX(texUnit); a393 26 /* Called only from gl_DrawElements */ void gl_CVAEltPointer( GLcontext *ctx, GLenum type, const GLvoid *ptr ) { switch (type) { case GL_UNSIGNED_BYTE: ctx->CVA.Elt.StrideB = sizeof(GLubyte); break; case GL_UNSIGNED_SHORT: ctx->CVA.Elt.StrideB = sizeof(GLushort); break; case GL_UNSIGNED_INT: ctx->CVA.Elt.StrideB = sizeof(GLuint); break; default: gl_error( ctx, GL_INVALID_ENUM, "glEltPointer(type)" ); return; } ctx->CVA.Elt.Type = type; ctx->CVA.Elt.Stride = 0; ctx->CVA.Elt.Ptr = (void *) ptr; ctx->CVA.EltFunc = gl_trans_1ui_tab[TYPE_IDX(type)]; ctx->Array.NewArrayState |= VERT_ELT; /* ??? */ } d402 1 a402 1 GLuint *elts = IM->Elt; d407 1 a407 1 d490 1 a490 1 GLint i; d497 1 a497 1 GLuint update = 0, translate = 0; a499 4 struct gl_client_array *client_data; struct gl_pipeline *elt = &ctx->CVA.elt; GLuint relock; GLuint fallback, required; a503 11 /* This will die miserably with CVA... Need more work to support this. */ relock = ctx->CompileCVAFlag; ctx->CompileCVAFlag = 0; if (!elt->pipeline_valid || relock) gl_build_immediate_pipeline( ctx ); required = elt->inputs; fallback = (elt->inputs & ~ctx->Array.Summary); d512 14 a525 17 if (required & VERT_RGBA) { client_data = &ctx->Array.Color; if (fallback & VERT_RGBA) client_data = &ctx->Fallback.Color; if (client_data->Type == GL_UNSIGNED_BYTE && client_data->Size == 4) { VSrc.Color = &col; col.data = (GLubyte (*)[4]) client_data->Ptr; col.stride = client_data->StrideB; col.flags = VEC_NOT_WRITABLE|VEC_GOOD_STRIDE; if (client_data->StrideB != 4 * sizeof(GLubyte)) col.flags ^= VEC_STRIDE_FLAGS; update |= VERT_RGBA; d527 4 a530 2 translate |= VERT_RGBA; } d533 13 a545 16 if (required & VERT_INDEX) { client_data = &ctx->Array.Index; if (fallback & VERT_INDEX) client_data = &ctx->Fallback.Index; if (client_data->Type == GL_UNSIGNED_INT) { VSrc.Index = &index; index.data = (GLuint *) client_data->Ptr; index.stride = client_data->StrideB; index.flags = VEC_NOT_WRITABLE|VEC_GOOD_STRIDE; if (client_data->StrideB != sizeof(GLuint)) index.flags ^= VEC_STRIDE_FLAGS; update |= VERT_INDEX; d547 4 a550 2 translate |= VERT_INDEX; } d557 12 a568 19 if (required & flag) { client_data = &ctx->Array.TexCoord[i]; if (fallback & flag) { client_data = &ctx->Fallback.TexCoord[i]; client_data->Size = gl_texcoord_size( ctx->Current.Flag, i ); } if (client_data->Type == GL_FLOAT) { VSrc.TexCoord[i] = &tc[i]; tc[i].data = (GLfloat (*)[4]) client_data->Ptr; tc[i].stride = client_data->StrideB; tc[i].flags = VEC_NOT_WRITABLE|VEC_GOOD_STRIDE; if (tc[i].stride |= 4 * sizeof(GLfloat)) tc[i].flags ^= VEC_STRIDE_FLAGS; update |= flag; d570 15 a584 1 translate |= flag; d597 1 a600 4 obj.flags = VEC_NOT_WRITABLE|VEC_GOOD_STRIDE; if (obj.stride != 4 * sizeof(GLfloat)) obj.flags ^= VEC_STRIDE_FLAGS; d608 11 a618 13 if (required & VERT_NORM) { client_data = &ctx->Array.Normal; if (fallback & VERT_NORM) client_data = &ctx->Fallback.Normal; if (client_data->Type == GL_FLOAT) { VSrc.Normal = &norm; norm.flags = 0; norm.data = (GLfloat (*)[3]) client_data->Ptr; norm.stride = client_data->StrideB; update |= VERT_NORM; d620 1 a620 1 translate |= VERT_NORM; d624 1 a624 1 if ( (required & VERT_EDGE) && d629 15 a643 13 client_data = &ctx->Array.EdgeFlag; if (fallback & VERT_EDGE) client_data = &ctx->Fallback.EdgeFlag; VSrc.EdgeFlag = &edge; edge.data = (GLboolean *) client_data->Ptr; edge.stride = client_data->StrideB; edge.flags = VEC_NOT_WRITABLE|VEC_GOOD_STRIDE; if (edge.stride != sizeof(GLubyte)) edge.flags ^= VEC_STRIDE_FLAGS; update |= VERT_EDGE; d653 1 d672 1 a672 1 if (update & VERT_OBJ_ANY) d674 1 d676 1 a676 1 if (update & VERT_NORM) d678 1 d680 1 a680 1 if (update & VERT_EDGE) d682 1 d684 1 a684 1 if (update & VERT_RGBA) d686 1 d688 1 a688 1 if (update & VERT_INDEX) d690 1 d692 1 a692 1 if (update & VERT_TEX0_ANY) d694 1 d696 1 a696 1 if (update & VERT_TEX1_ANY) d698 1 d743 24 d793 1 a793 1 /* VB->Flag[VB_START] |= (IM->Flag[vb_start] & VERT_MATERIAL); */ d800 1 a800 1 gl_run_pipeline( VB ); a809 2 ctx->CompileCVAFlag = relock; d856 1 a856 1 IM->Elt[i] = (GLuint) *indices++; \ d880 1 d897 2 d901 2 a902 11 /* Treat VERT_ELT like a special client array. */ ctx->Array.NewArrayState |= VERT_ELT; ctx->Array.Summary |= VERT_ELT; ctx->Array.Flags |= VERT_ELT; cva->elt_mode = mode; cva->elt_count = count; cva->Elt.Type = type; cva->Elt.Ptr = (void *) indices; cva->EltFunc = gl_trans_1ui_tab[TYPE_IDX(type)]; d905 2 a906 3 gl_build_precalc_pipeline( ctx ); else if (MESA_VERBOSE & VERBOSE_PIPELINE) fprintf(stderr, ": dont rebuild\n"); d908 3 a910 1 gl_cva_force_precalc( ctx ); d912 7 a918 8 /* Did we 'precalculate' the render op? */ if (ctx->CVA.pre.ops & PIPE_OP_RENDER) { ctx->Array.NewArrayState |= VERT_ELT; ctx->Array.Summary &= ~VERT_ELT; ctx->Array.Flags &= ~VERT_ELT; return; } d920 1 a920 1 if ( (MESA_VERBOSE&VERBOSE_VARRAY) ) d924 22 d947 58 a1004 41 /* Otherwise, have to use the immediate path to render. */ switch (type) { case GL_UNSIGNED_BYTE: { GLubyte *ub_indices = (GLubyte *) indices; if (ctx->Array.Summary & VERT_OBJ_ANY) { draw_elt_ubyte( ctx, mode, ub_indices, count ); } else { gl_ArrayElement( ctx, (GLuint) ub_indices[count-1] ); } } break; case GL_UNSIGNED_SHORT: { GLushort *us_indices = (GLushort *) indices; if (ctx->Array.Summary & VERT_OBJ_ANY) { draw_elt_ushort( ctx, mode, us_indices, count ); } else { gl_ArrayElement( ctx, (GLuint) us_indices[count-1] ); } } break; case GL_UNSIGNED_INT: { GLuint *ui_indices = (GLuint *) indices; if (ctx->Array.Summary & VERT_OBJ_ANY) { draw_elt_uint( ctx, mode, ui_indices, count ); } else { gl_ArrayElement( ctx, ui_indices[count-1] ); } } break; default: gl_error( ctx, GL_INVALID_ENUM, "glDrawElements(type)" ); break; } if (ctx->CompileCVAFlag) { ctx->Array.NewArrayState |= VERT_ELT; ctx->Array.Summary &= ~VERT_ELT; @ 3.29.2.2 log @When texture.unit[0].envmode is GL_REPLACE, don't need VERT_RGBA as an input to rendering stages. Rearranged fxfastpath.c without improving its performance. @ text @d1 1 a1 1 /* $Id: varray.c,v 3.29.2.1 1999/05/21 21:29:27 keithw Exp $ */ a906 2 /* force_init_prof(); */ @ 3.29.2.3 log @some trial assembly, made newer code active by default @ text @d1 1 a1 1 /* $Id: varray.c,v 3.29.2.2 1999/06/01 00:45:21 keithw Exp $ */ d71 1 a71 1 void glVertexPointer( a74 1 GLcontext *ctx = CC; d89 1 a89 3 ctx->Array.Vertex.StrideB = stride; if (!stride) { switch (type) { d91 1 a91 1 ctx->Array.Vertex.StrideB = size*sizeof(GLshort); d94 1 a94 1 ctx->Array.Vertex.StrideB = size*sizeof(GLint); d97 1 a97 1 ctx->Array.Vertex.StrideB = size*sizeof(GLfloat); d100 1 a100 1 ctx->Array.Vertex.StrideB = size*sizeof(GLdouble); a104 1 } d132 1 a132 3 ctx->Array.Normal.StrideB = stride; if (!stride) { switch (type) { d134 1 a134 1 ctx->Array.Normal.StrideB = 3*sizeof(GLbyte); d137 1 a137 1 ctx->Array.Normal.StrideB = 3*sizeof(GLshort); d140 1 a140 1 ctx->Array.Normal.StrideB = 3*sizeof(GLint); d143 1 a143 1 ctx->Array.Normal.StrideB = 3*sizeof(GLfloat); d146 1 a146 1 ctx->Array.Normal.StrideB = 3*sizeof(GLdouble); a150 1 } d163 1 a163 1 void glColorPointer( a166 1 GLcontext *ctx = CC; d181 1 a181 3 ctx->Array.Color.StrideB = stride; if (!stride) { switch (type) { d183 1 a183 1 ctx->Array.Color.StrideB = size*sizeof(GLbyte); d186 1 a186 1 ctx->Array.Color.StrideB = size*sizeof(GLubyte); d189 1 a189 1 ctx->Array.Color.StrideB = size*sizeof(GLshort); d192 1 a192 1 ctx->Array.Color.StrideB = size*sizeof(GLushort); d195 1 a195 1 ctx->Array.Color.StrideB = size*sizeof(GLint); d198 1 a198 1 ctx->Array.Color.StrideB = size*sizeof(GLuint); d201 1 a201 1 ctx->Array.Color.StrideB = size*sizeof(GLfloat); d204 1 a204 1 ctx->Array.Color.StrideB = size*sizeof(GLdouble); a208 1 } d229 1 a229 4 ctx->Array.Index.StrideB = stride; if (!stride) { switch (type) { d231 1 a231 1 ctx->Array.Index.StrideB = sizeof(GLubyte); d234 1 a234 1 ctx->Array.Index.StrideB = sizeof(GLshort); d237 1 a237 1 ctx->Array.Index.StrideB = sizeof(GLint); d240 1 a240 1 ctx->Array.Index.StrideB = sizeof(GLfloat); d243 1 a243 1 ctx->Array.Index.StrideB = sizeof(GLdouble); a247 1 } d260 1 a260 1 void glTexCoordPointer( a263 1 GLcontext *ctx = CC; d281 1 a281 3 ctx->Array.TexCoord[texUnit].StrideB = stride; if (!stride) { switch (type) { d283 1 a283 1 ctx->Array.TexCoord[texUnit].StrideB = size*sizeof(GLshort); d286 1 a286 1 ctx->Array.TexCoord[texUnit].StrideB = size*sizeof(GLint); d289 1 a289 1 ctx->Array.TexCoord[texUnit].StrideB = size*sizeof(GLfloat); d292 1 a292 1 ctx->Array.TexCoord[texUnit].StrideB = size*sizeof(GLdouble); a296 1 } d333 1 a333 3 ctx->Array.TexCoord[texUnit].StrideB = stride; if (!stride) { switch (type) { d335 1 a335 1 ctx->Array.TexCoord[texUnit].StrideB = size*sizeof(GLshort); d338 1 a338 1 ctx->Array.TexCoord[texUnit].StrideB = size*sizeof(GLint); d341 1 a341 1 ctx->Array.TexCoord[texUnit].StrideB = size*sizeof(GLfloat); d344 1 a344 1 ctx->Array.TexCoord[texUnit].StrideB = size*sizeof(GLdouble); a348 1 } d885 1 a885 1 void glDrawElements( a888 1 GLcontext *ctx = CC; d907 1 a907 1 force_init_prof(); d989 1 a989 1 void glInterleavedArrays( a992 1 GLcontext *ctx = CC; d1136 1 a1136 1 glTexCoordPointer( tcomps, GL_FLOAT, stride, d1158 1 a1158 1 glColorPointer( ccomps, ctype, stride, d1177 1 a1177 1 glVertexPointer( vcomps, GL_FLOAT, stride, d1185 3 a1187 3 void glDrawRangeElements( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices ) a1188 2 GLcontext *ctx = CC; d1194 4 a1197 4 if (!ctx->Array.LockCount && 2*count > 3*(end-start)) { glLockArraysEXT( start, end ); glDrawElements( mode, count, type, indices ); glUnlockArraysEXT( ); d1199 1 a1199 1 glDrawElements( mode, count, type, indices ); d1250 2 a1251 2 /* if (ctx->Array.LockCount) */ /* gl_ReLockArrays( ctx, ctx->Array.LockFirst, ctx->Array.LockCount ); */ @ 3.29.2.4 log @removed profile hook @ text @d1 1 a1 1 /* $Id: varray.c,v 3.29.2.3 1999/06/06 22:35:55 keithw Exp $ */ d930 1 a930 3 #if defined(MESA_CVA_PROF) force_init_prof(); #endif @ 3.29.2.5 log @Removed SGIS multitexture, added FX/X86 assm directory @ text @d1 1 a1 1 /* $Id: varray.c,v 3.29.2.4 1999/06/08 00:21:49 keithw Exp $ */ d123 1 a123 1 void glNormalPointer( a125 1 GLcontext *ctx = CC; d233 1 a233 1 void glIndexPointer( a235 1 GLcontext *ctx = CC; d330 21 d352 45 a396 1 GLAPI void GLAPIENTRY glEdgeFlagPointer(GLsizei stride, const void *vptr ) a397 2 GLcontext *ctx = CC; const GLboolean *ptr = (GLboolean *)vptr; d1160 1 a1160 1 gl_ActiveTexture( ctx, (GLenum) (GL_TEXTURE0_ARB + i) ); d1166 1 a1166 1 gl_ActiveTexture( ctx, (GLenum) (GL_TEXTURE0_ARB + i) ); d1173 1 a1173 1 gl_ActiveTexture( ctx, (GLenum) (GL_TEXTURE0_ARB + i) ); d1178 1 a1178 1 gl_ActiveTexture( ctx, (GLenum) (GL_TEXTURE0_ARB + coordUnitSave) ); d1195 1 a1195 1 glNormalPointer( GL_FLOAT, stride, d1267 3 d1277 3 @ 3.28 log @miscellaneous bug fixes @ text @d1 1 a1 1 /* $Id: varray.c,v 3.27 1999/05/06 17:29:19 brianp Exp $ */ d847 1 a847 1 gl_Begin( ctx, mode ); \ @ 3.27 log @added GL_UNSIGNED_BYTE case to gl_IndexPointer @ text @d1 1 a1 1 /* $Id: varray.c,v 3.26 1999/05/06 15:45:22 keithw Exp $ */ d706 1 a706 1 ctx->Array.VertexFunc( IM->Obj, d711 1 a711 1 ctx->Array.NormalFunc( IM->Normal, d716 1 a716 1 ctx->Array.EdgeFlagFunc( IM->EdgeFlag, d721 1 a721 1 ctx->Array.ColorFunc( IM->Color, d726 1 a726 1 ctx->Array.IndexFunc( IM->Index, d732 1 a732 1 ctx->Array.TexCoordFunc[0]( IM->TexCoord[0], d738 1 a738 1 ctx->Array.TexCoordFunc[1]( IM->TexCoord[1], d750 1 a750 1 for (i=0;iNormal[start], ctx->Current.Normal); d792 2 a793 2 VB->Flag[vb_start] |= VERT_NORM; VB->Flag[vb_start] |= (IM->Flag[vb_start] & VERT_MATERIAL); d804 2 a805 2 ctx->Array.Flag[vb_start] = ctx->Array.Flags; IM->Flag[vb_start] = 0; @ 3.26 log @bug fix for arrays+lists+lighting @ text @d1 1 a1 1 /* $Id: varray.c,v 3.25 1999/05/02 00:59:24 keithw Exp $ */ d230 3 d234 1 a234 1 ctx->Array.Index.StrideB = stride ? stride : sizeof(GLbyte); d275 1 a275 1 fprintf(stderr, "glTexCoordPointer( unit %d sz %d type %s stride %d )\n", @ 3.25 log @FX polygon offset and debugging changes @ text @d1 1 a1 1 /* $Id: varray.c,v 3.24 1999/04/24 13:21:43 keithw Exp $ */ d449 7 a455 3 if (IM->AndFlag & VERT_ELT) IM->AndFlag |= translate; else { @ 3.24 log @more material/cva fixes @ text @d1 1 a1 1 /* $Id: varray.c,v 3.23 1999/04/23 16:14:22 keithw Exp $ */ d44 1 d83 5 a87 4 /* printf("glVertexPointer( sz %d type %s stride %d )\n", size, */ /* gl_lookup_enum_by_nr( type ), */ /* stride); */ d127 4 a130 3 /* printf("glNormalPointer( type %s stride %d )\n", */ /* gl_lookup_enum_by_nr( type ), */ /* stride); */ d176 4 a179 3 /* printf("glColorPointer( sz %d type %s stride %d )\n", size, */ /* gl_lookup_enum_by_nr( type ), */ /* stride); */ d271 6 a276 5 /* printf("glTexCoordPointer( unit %d sz %d type %s stride %d )\n", */ /* texUnit, */ /* size, */ /* gl_lookup_enum_by_nr( type ), */ /* stride); */ d322 7 a328 5 /* printf("glMultiTexCoordPointer( unit %d sz %d type %s stride %d )\n", */ /* texUnit, */ /* size, */ /* gl_lookup_enum_by_nr( type ), */ /* stride); */ d913 2 a914 2 /* if (use_immediate) */ /* printf("using immediate\n"); */ @ 3.23 log @fix for Eero's cva problem @ text @d1 1 a1 1 /* $Id: varray.c,v 3.22 1999/04/21 12:59:37 brianp Exp $ */ d905 3 @ 3.22 log @changed a GLuint to GLenum in FUNC macro @ text @d1 1 a1 1 /* $Id: varray.c,v 3.21 1999/04/06 10:03:01 keithw Exp $ */ d898 7 a904 8 /* Need to do software culling. */ if ( ctx->IndirectTriangles & DD_TRI_CULL ) use_immediate = 1; if (type != GL_UNSIGNED_INT && (count > cva->VB->Size || (ctx->Array.Summary & VERT_INDEX))) use_immediate = 1; @ 3.21 log @fixed problem with new snapping code @ text @d1 1 a1 1 /* $Id: varray.c,v 3.20 1999/04/05 16:32:36 keithw Exp $ */ d828 1 a828 1 static void FUNC( GLcontext *ctx, GLuint mode, \ @ 3.20 log @quake3 bug fix @ text @d1 1 a1 1 /* $Id: varray.c,v 3.19 1999/04/04 21:09:26 keithw Exp $ */ d931 1 d934 1 d957 1 d960 1 d978 1 d983 1 @ 3.19 log @quake3 bug @ text @d1 1 a1 1 /* $Id: varray.c,v 3.18 1999/03/31 20:18:41 keithw Exp $ */ d48 1 d82 5 d111 1 d124 5 d155 1 d172 5 d213 1 d248 1 d266 7 d298 1 d317 6 d347 1 d380 1 @ 3.18 log @Compiled vertex arrays @ text @d1 1 a1 1 /* $Id: varray.c,v 3.17 1999/03/17 16:51:17 keithw Exp $ */ d844 2 @ 3.17 log @Fix for culling shared normals. @ text @d1 1 a1 1 /* $Id: varray.c,v 3.16 1999/02/25 14:12:32 keithw Exp $ */ d37 2 d46 1 d52 1 d60 1 d104 1 d142 1 d194 1 d228 1 d270 1 d276 1 a276 1 void gl_MultiTexCoordPointer( GLcontext *ctx, GLenum target, a279 5 GLuint texUnit; if (target < GL_TEXTURE0_SGIS || target > GL_TEXTURE1_SGIS) { gl_error(ctx, GL_INVALID_ENUM, "glMultiTexCoord(target)"); return; } d288 1 a288 1 texUnit = target - GL_TEXTURE0_SGIS; d312 1 d344 1 a351 3 * * TODO: calc the min & max elt in the buffer and use stride tables * for array lookups where possible. d353 1 a353 1 void gl_exec_array_elements( GLcontext *ctx ) a354 2 static GLuint sz_flags[5] = { 0, 0, 0, 0x1, 0x2 }; struct immediate *IM = ctx->input; d357 3 a359 2 GLuint translate; GLuint lastelt = IM->LastArrayElement + 1; a360 2 translate = ctx->Array.Flags; d362 1 a362 10 #if 0 /* wont work without some code to update the current values that * aren't actually needed. */ if (!ctx->Compile) { translate &= ctx->Flags; /* skip things enabled but not needed */ } #endif if (translate & VERT_OBJ) d366 1 a366 1 VB_START, lastelt); d368 1 a368 1 if (translate & VERT_NORM) { d372 3 a374 6 VB_START, lastelt); if (lastelt > IM->LastNormal) IM->LastNormal = lastelt; } if (translate & VERT_EDGE) { d378 1 a378 5 VB_START, lastelt); if (lastelt > IM->LastEdgeFlag) IM->LastEdgeFlag = lastelt; } d380 1 a380 1 if (translate & VERT_RGBA) { d384 1 a384 4 VB_START, lastelt); if (lastelt > IM->LastColor) IM->LastColor = lastelt; } d386 1 a386 1 if (translate & VERT_INDEX) { d390 1 a390 4 VB_START, lastelt); if (lastelt > IM->LastIndex) IM->LastIndex = lastelt; } d392 1 a392 1 if (translate & VERT_TEX0) { d395 2 a396 5 flags, elts, (VERT_ELT|VERT_TEX0), VB_START, lastelt); if (lastelt > IM->LastTexCoord[0]) IM->LastTexCoord[0] = lastelt; d398 1 a398 4 IM->TexCoordSize[0] |= sz_flags[ctx->Array.TexCoord[0].Size]; } if (translate & VERT_TEX1) { d401 4 a404 4 flags, elts, (VERT_ELT|VERT_TEX1), VB_START, lastelt); if (lastelt > IM->LastTexCoord[1]) IM->LastTexCoord[1] = lastelt; d406 9 a414 1 IM->TexCoordSize[0] |= sz_flags[ctx->Array.TexCoord[0].Size]; a415 6 IM->AndFlag &= VERT_PRESERVE | translate; for (i = 0 ; i < lastelt ; i++) if (flags[i] & VERT_ELT) flags[i] |= translate; a421 14 /* */ struct vertex_arrays { GLvector4f *ObjPtr; GLvector3f *NormalPtr; GLvector4ub *ColorPtr; GLvector1ui *IndexPtr; GLvector1ub *EdgeFlagPtr; GLvector4f *TexCoordPtr[MAX_TEXTURE_UNITS]; }; d448 2 a449 1 struct vertex_arrays VSrc; d454 7 a460 7 VSrc.ColorPtr = &VB->store.vColor; VSrc.IndexPtr = &VB->store.vIndex; VSrc.EdgeFlagPtr = &VB->store.vEdgeFlag; VSrc.TexCoordPtr[0] = &VB->store.vTexCoord[0]; VSrc.TexCoordPtr[1] = &VB->store.vTexCoord[1]; VSrc.ObjPtr = &VB->store.vObj; VSrc.NormalPtr = &VB->store.vNormal; d468 1 a468 1 VSrc.ColorPtr = &col; d478 1 a478 1 COPY_4UBV( VB->store.Color[i], ctx->Current.ByteColor ); d488 1 a488 1 VSrc.IndexPtr = &index; d498 1 a498 1 VB->store.Index[i] = ctx->Current.Index; d503 5 a507 2 for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++) if (ctx->Flags & (i+1)) { d511 1 a511 1 VSrc.TexCoordPtr[i] = &tc[i]; d515 1 a515 1 update |= (i+1); /* max 2 texture units */ d517 1 a517 1 translate |= (i+1); d520 1 a520 11 GLuint sz = 4; if (ctx->Current.Texcoord[i][3] == 1) { sz = 3; if (ctx->Current.Texcoord[i][2] == 0) { sz = 2; if (ctx->Current.Texcoord[i][1] == 0) { sz = 1; } } } d531 3 a533 5 VB->store.vTexCoord[i].size = sz; for (j=0;jstore.TexCoord[i][j], ctx->Current.Texcoord[i] ); } d537 5 d546 1 a546 1 VSrc.ObjPtr = &obj; d551 1 a551 1 update |= VERT_OBJ; d555 1 a555 1 translate |= VERT_OBJ; d561 1 a561 1 VSrc.NormalPtr = &norm; d581 1 a581 1 VSrc.EdgeFlagPtr = &edge; d591 1 a591 1 VB->store.EdgeFlag[i] = ctx->Current.EdgeFlag; d596 4 a599 4 VB->Primitive = VB->store.Primitive; VB->NextPrimitive = VB->store.NextPrimitive; VB->MaterialMask = VB->store.MaterialMask; VB->Material = VB->store.Material; d622 1 a622 1 if (update & VERT_OBJ) { d642 1 a642 1 if (update & VERT_TEX0) { d646 1 a646 1 if (update & VERT_TEX1) { d655 2 a656 2 if (translate & VERT_OBJ) { ctx->Array.VertexFunc( VB->store.Obj, d661 1 a661 1 ctx->Array.NormalFunc( VB->store.Normal, d666 1 a666 1 ctx->Array.EdgeFlagFunc( VB->store.EdgeFlag, d671 1 a671 1 ctx->Array.ColorFunc( VB->store.Color, d676 1 a676 1 ctx->Array.IndexFunc( VB->store.Index, d680 3 a682 3 if (translate & VERT_TEX0) { VB->store.vTexCoord[0].size = tc[0].size; ctx->Array.TexCoordFunc[0]( VB->store.TexCoord[0], d686 3 a688 3 if (translate & VERT_TEX1) { VB->store.vTexCoord[1].size = tc[1].size; ctx->Array.TexCoordFunc[1]( VB->store.TexCoord[1], d699 1 a699 1 if (copy & VERT_TEX0) { d701 1 a701 1 COPY_4V( VB->store.TexCoord[0][i], ctx->Current.Texcoord[0]); d703 1 a703 1 VB->store.vTexCoord[0].size = tc[0].size; d706 1 a706 1 if (copy & VERT_TEX1) { d708 1 a708 1 COPY_4V( VB->store.TexCoord[1][i], ctx->Current.Texcoord[1]); d710 1 a710 1 VB->store.vTexCoord[1].size = tc[1].size; d714 1 a714 1 COPY_3V(VB->store.Normal[start], ctx->Current.Normal); d718 8 a725 7 VB->ObjPtr = VSrc.ObjPtr; VB->NormalPtr = VSrc.NormalPtr; VB->ColorPtr = VSrc.ColorPtr; VB->IndexPtr = VSrc.IndexPtr; VB->EdgeFlagPtr = VSrc.EdgeFlagPtr; VB->TexCoordPtr[0] = VSrc.TexCoordPtr[0]; VB->TexCoordPtr[1] = VSrc.TexCoordPtr[1]; d728 2 d743 1 a743 1 VB->Flag[vb_start] |= (VB->store.Flag[vb_start] & VERT_MATERIAL); d750 2 a751 2 gl_transform_vb( ctx ); gl_reset_vb( ctx, &ctx->VB->store ); d755 1 a755 1 VB->store.Flag[vb_start] = 0; d788 32 d821 3 a825 3 /* KW: To execute is to save. This could be pushed into api1.c * as array_element commands now just set some flags and increment. */ d830 2 a831 1 d838 1 d844 2 a845 2 /* No need to RESET_IMMEDIATE() because this command isn't saved * in display lists. d847 22 d872 1 d875 21 a895 7 GLint i; gl_Begin( ctx, mode ); for (i=0;iArray.TexCoord[0].Enabled) ctx->Array.Flags |= VERT_TEX0; if (ctx->Array.TexCoord[1].Enabled) ctx->Array.Flags |= VERT_TEX1; a1191 1 ctx->Array.Flags |= VERT_OBJ; d1193 7 d1201 3 a1203 1 d1205 1 a1205 1 /* This is passed to gl_transform_vb. d1207 4 a1210 4 if (ctx->Array.Flags) for (i = 0 ; i < VB_MAX ; i++) ctx->Array.Flag[i] = ctx->Array.Flags; d1212 2 @ 3.16 log @Merged in kw3 patch @ text @d1 1 a1 1 /* $Id: varray.c,v 3.15 1999/02/24 22:48:08 jens Exp $ */ a487 12 #if 0 tmp = ((mode >= GL_TRIANGLES) && ctx->Light.Enabled && ctx->Light.Model.TwoSide); if (tmp != ctx->LightTwoSide) { ctx->NewState |= NEW_LIGHTING; ctx->LightTwoSide = tmp; } #endif @ 3.15 log @Added header file to get XMesa to compile standalone and inside XFree86 @ text @d1 1 a1 1 /* $Id: varray.c,v 3.14 1999/02/14 03:46:34 brianp Exp $ */ a27 48 /* * $Log: varray.c,v $ * Revision 3.14 1999/02/14 03:46:34 brianp * new copyright * * Revision 3.13 1998/11/25 04:18:19 brianp * fixed a few IRIX compiler warnings * * Revision 3.12 1998/11/08 22:34:07 brianp * renamed texture sets to texture units * * Revision 3.11 1998/11/07 02:14:17 brianp * bug fixes and optimizations to gl_DrawArrays() * * Revision 3.10 1998/10/31 17:06:15 brianp * variety of multi-texture changes * * Revision 3.9 1998/10/29 03:57:11 brianp * misc clean-up of new vertex transformation code * * Revision 3.8 1998/10/29 02:28:13 brianp * incorporated Keith Whitwell's transformation optimizations * * Revision 3.7 1998/09/01 03:05:22 brianp * fixed interleaved texture coordinate problem * * Revision 3.6 1998/08/21 01:50:53 brianp * added support for texture coordinate set interleave factor * * Revision 3.5 1998/06/07 22:18:52 brianp * implemented GL_EXT_multitexture extension * * Revision 3.4 1998/03/27 04:26:44 brianp * fixed G++ warnings * * Revision 3.3 1998/02/20 04:53:07 brianp * implemented GL_SGIS_multitexture * * Revision 3.2 1998/02/01 20:05:10 brianp * added glDrawRangeElements() * * Revision 3.1 1998/02/01 16:37:19 brianp * added GL_EXT_rescale_normal extension * * Revision 3.0 1998/01/31 21:06:45 brianp * initial rev * */ d31 4 a34 7 /* * NOTE: At this time, only three vertex array configurations are optimized: * 1. glVertex3fv(), zero stride * 2. glNormal3fv() with glVertex3fv(), zero stride * 3. glNormal3fv() with glVertex4fv(), zero stride * * More optimized array configurations can be added. d48 1 d50 1 d78 1 a78 1 ctx->Array.VertexStrideB = stride ? stride : size*sizeof(GLshort); d81 1 a81 1 ctx->Array.VertexStrideB = stride ? stride : size*sizeof(GLint); d84 1 a84 1 ctx->Array.VertexStrideB = stride ? stride : size*sizeof(GLfloat); d87 1 a87 1 ctx->Array.VertexStrideB = stride ? stride : size*sizeof(GLdouble); d93 6 a98 4 ctx->Array.VertexSize = size; ctx->Array.VertexType = type; ctx->Array.VertexStride = stride; ctx->Array.VertexPtr = (void *) ptr; d113 1 a113 1 ctx->Array.NormalStrideB = stride ? stride : 3*sizeof(GLbyte); d116 1 a116 1 ctx->Array.NormalStrideB = stride ? stride : 3*sizeof(GLshort); d119 1 a119 1 ctx->Array.NormalStrideB = stride ? stride : 3*sizeof(GLint); d122 1 a122 1 ctx->Array.NormalStrideB = stride ? stride : 3*sizeof(GLfloat); d125 1 a125 1 ctx->Array.NormalStrideB = stride ? stride : 3*sizeof(GLdouble); d131 5 a135 3 ctx->Array.NormalType = type; ctx->Array.NormalStride = stride; ctx->Array.NormalPtr = (void *) ptr; d154 1 a154 1 ctx->Array.ColorStrideB = stride ? stride : size*sizeof(GLbyte); d157 1 a157 1 ctx->Array.ColorStrideB = stride ? stride : size*sizeof(GLubyte); d160 1 a160 1 ctx->Array.ColorStrideB = stride ? stride : size*sizeof(GLshort); d163 1 a163 1 ctx->Array.ColorStrideB = stride ? stride : size*sizeof(GLushort); d166 1 a166 1 ctx->Array.ColorStrideB = stride ? stride : size*sizeof(GLint); d169 1 a169 1 ctx->Array.ColorStrideB = stride ? stride : size*sizeof(GLuint); d172 1 a172 1 ctx->Array.ColorStrideB = stride ? stride : size*sizeof(GLfloat); d175 1 a175 1 ctx->Array.ColorStrideB = stride ? stride : size*sizeof(GLdouble); d181 6 a186 4 ctx->Array.ColorSize = size; ctx->Array.ColorType = type; ctx->Array.ColorStride = stride; ctx->Array.ColorPtr = (void *) ptr; d200 1 a200 1 ctx->Array.IndexStrideB = stride ? stride : sizeof(GLbyte); d203 1 a203 1 ctx->Array.IndexStrideB = stride ? stride : sizeof(GLint); d206 1 a206 1 ctx->Array.IndexStrideB = stride ? stride : sizeof(GLfloat); d209 1 a209 1 ctx->Array.IndexStrideB = stride ? stride : sizeof(GLdouble); d215 5 a219 3 ctx->Array.IndexType = type; ctx->Array.IndexStride = stride; ctx->Array.IndexPtr = (void *) ptr; d239 1 a239 1 ctx->Array.TexCoordStrideB[texUnit] = stride ? stride : size*sizeof(GLshort); d242 1 a242 1 ctx->Array.TexCoordStrideB[texUnit] = stride ? stride : size*sizeof(GLint); d245 1 a245 1 ctx->Array.TexCoordStrideB[texUnit] = stride ? stride : size*sizeof(GLfloat); d248 1 a248 1 ctx->Array.TexCoordStrideB[texUnit] = stride ? stride : size*sizeof(GLdouble); d254 7 a260 4 ctx->Array.TexCoordSize[texUnit] = size; ctx->Array.TexCoordType[texUnit] = type; ctx->Array.TexCoordStride[texUnit] = stride; ctx->Array.TexCoordPtr[texUnit] = (void *) ptr; d286 1 a286 1 ctx->Array.TexCoordStrideB[texUnit] = stride ? stride : size*sizeof(GLshort); d289 1 a289 1 ctx->Array.TexCoordStrideB[texUnit] = stride ? stride : size*sizeof(GLint); d292 1 a292 1 ctx->Array.TexCoordStrideB[texUnit] = stride ? stride : size*sizeof(GLfloat); d295 1 a295 1 ctx->Array.TexCoordStrideB[texUnit] = stride ? stride : size*sizeof(GLdouble); d301 6 a306 4 ctx->Array.TexCoordSize[texUnit] = size; ctx->Array.TexCoordType[texUnit] = type; ctx->Array.TexCoordStride[texUnit] = stride; ctx->Array.TexCoordPtr[texUnit] = (void *) ptr; d329 9 a337 3 ctx->Array.EdgeFlagStride = stride; ctx->Array.EdgeFlagStrideB = stride ? stride : sizeof(GLboolean); ctx->Array.EdgeFlagPtr = (GLboolean *) ptr; d342 6 a347 2 /* * Execute d349 1 a349 1 void gl_ArrayElement( GLcontext *ctx, GLint i ) d351 18 a368 3 struct vertex_buffer *VB = ctx->VB; GLint count = VB->Count; GLuint texUnit; d370 13 a382 36 /* copy vertex data into the Vertex Buffer */ if (ctx->Array.NormalEnabled) { GLbyte *p = (GLbyte*) ctx->Array.NormalPtr + i * ctx->Array.NormalStrideB; switch (ctx->Array.NormalType) { case GL_BYTE: VB->Normal[count][0] = BYTE_TO_FLOAT( p[0] ); VB->Normal[count][1] = BYTE_TO_FLOAT( p[1] ); VB->Normal[count][2] = BYTE_TO_FLOAT( p[2] ); break; case GL_SHORT: VB->Normal[count][0] = SHORT_TO_FLOAT( ((GLshort*)p)[0] ); VB->Normal[count][1] = SHORT_TO_FLOAT( ((GLshort*)p)[1] ); VB->Normal[count][2] = SHORT_TO_FLOAT( ((GLshort*)p)[2] ); break; case GL_INT: VB->Normal[count][0] = INT_TO_FLOAT( ((GLint*)p)[0] ); VB->Normal[count][1] = INT_TO_FLOAT( ((GLint*)p)[1] ); VB->Normal[count][2] = INT_TO_FLOAT( ((GLint*)p)[2] ); break; case GL_FLOAT: VB->Normal[count][0] = ((GLfloat*)p)[0]; VB->Normal[count][1] = ((GLfloat*)p)[1]; VB->Normal[count][2] = ((GLfloat*)p)[2]; break; case GL_DOUBLE: VB->Normal[count][0] = ((GLdouble*)p)[0]; VB->Normal[count][1] = ((GLdouble*)p)[1]; VB->Normal[count][2] = ((GLdouble*)p)[2]; break; default: gl_problem(ctx, "Bad normal type in gl_ArrayElement"); return; } VB->MonoNormal = GL_FALSE; d384 8 a391 63 else { VB->Normal[count][0] = ctx->Current.Normal[0]; VB->Normal[count][1] = ctx->Current.Normal[1]; VB->Normal[count][2] = ctx->Current.Normal[2]; } /* TODO: directly set VB->Fcolor instead of calling a glColor command */ if (ctx->Array.ColorEnabled) { GLbyte *p = (GLbyte*) ctx->Array.ColorPtr + i * ctx->Array.ColorStrideB; switch (ctx->Array.ColorType) { case GL_BYTE: switch (ctx->Array.ColorSize) { case 4: glColor4bv( (GLbyte*) p ); break; case 3: glColor3bv( (GLbyte*) p ); break; } break; case GL_UNSIGNED_BYTE: switch (ctx->Array.ColorSize) { case 3: glColor3ubv( (GLubyte*) p ); break; case 4: glColor4ubv( (GLubyte*) p ); break; } break; case GL_SHORT: switch (ctx->Array.ColorSize) { case 3: glColor3sv( (GLshort*) p ); break; case 4: glColor4sv( (GLshort*) p ); break; } break; case GL_UNSIGNED_SHORT: switch (ctx->Array.ColorSize) { case 3: glColor3usv( (GLushort*) p ); break; case 4: glColor4usv( (GLushort*) p ); break; } break; case GL_INT: switch (ctx->Array.ColorSize) { case 3: glColor3iv( (GLint*) p ); break; case 4: glColor4iv( (GLint*) p ); break; } break; case GL_UNSIGNED_INT: switch (ctx->Array.ColorSize) { case 3: glColor3uiv( (GLuint*) p ); break; case 4: glColor4uiv( (GLuint*) p ); break; } break; case GL_FLOAT: switch (ctx->Array.ColorSize) { case 3: glColor3fv( (GLfloat*) p ); break; case 4: glColor4fv( (GLfloat*) p ); break; } break; case GL_DOUBLE: switch (ctx->Array.ColorSize) { case 3: glColor3dv( (GLdouble*) p ); break; case 4: glColor4dv( (GLdouble*) p ); break; } break; default: gl_problem(ctx, "Bad color type in gl_ArrayElement"); return; } ctx->VB->MonoColor = GL_FALSE; d394 8 a401 11 /* current color has been updated. store in vertex buffer now */ { COPY_4UBV( VB->Fcolor[count], ctx->Current.ByteColor ); if (ctx->Light.ColorMaterialEnabled) { GLfloat color[4]; color[0] = ctx->Current.ByteColor[0] * (1.0F / 255.0F); color[1] = ctx->Current.ByteColor[1] * (1.0F / 255.0F); color[2] = ctx->Current.ByteColor[2] * (1.0F / 255.0F); color[3] = ctx->Current.ByteColor[3] * (1.0F / 255.0F); gl_set_material( ctx, ctx->Light.ColorMaterialBitmask, color ); } d404 7 a410 86 if (ctx->Array.IndexEnabled) { GLbyte *p = (GLbyte*) ctx->Array.IndexPtr + i * ctx->Array.IndexStrideB; switch (ctx->Array.IndexType) { case GL_SHORT: VB->Findex[count] = (GLuint) (*((GLshort*) p)); break; case GL_INT: VB->Findex[count] = (GLuint) (*((GLint*) p)); break; case GL_FLOAT: VB->Findex[count] = (GLuint) (*((GLfloat*) p)); break; case GL_DOUBLE: VB->Findex[count] = (GLuint) (*((GLdouble*) p)); break; default: gl_problem(ctx, "Bad index type in gl_ArrayElement"); return; } ctx->VB->MonoColor = GL_FALSE; } else { VB->Findex[count] = ctx->Current.Index; } for (texUnit=0; texUnitConst.MaxTextureUnits; texUnit++) { if (ctx->Array.TexCoordEnabled[texUnit]) { GLbyte *p = (GLbyte*) ctx->Array.TexCoordPtr[texUnit] + i * ctx->Array.TexCoordStrideB[texUnit]; VB->MultiTexCoord[texUnit][count][1] = 0.0F; VB->MultiTexCoord[texUnit][count][2] = 0.0F; VB->MultiTexCoord[texUnit][count][3] = 1.0F; switch (ctx->Array.TexCoordType[texUnit]) { case GL_SHORT: switch (ctx->Array.TexCoordSize[texUnit]) { /* FALL THROUGH! */ case 4: VB->MultiTexCoord[texUnit][count][3] = ((GLshort*) p)[3]; case 3: VB->MultiTexCoord[texUnit][count][2] = ((GLshort*) p)[2]; case 2: VB->MultiTexCoord[texUnit][count][1] = ((GLshort*) p)[1]; case 1: VB->MultiTexCoord[texUnit][count][0] = ((GLshort*) p)[0]; } break; case GL_INT: switch (ctx->Array.TexCoordSize[texUnit]) { /* FALL THROUGH! */ case 4: VB->MultiTexCoord[texUnit][count][3] = ((GLint*) p)[3]; case 3: VB->MultiTexCoord[texUnit][count][2] = ((GLint*) p)[2]; case 2: VB->MultiTexCoord[texUnit][count][1] = ((GLint*) p)[1]; case 1: VB->MultiTexCoord[texUnit][count][0] = ((GLint*) p)[0]; } break; case GL_FLOAT: switch (ctx->Array.TexCoordSize[texUnit]) { /* FALL THROUGH! */ case 4: VB->MultiTexCoord[texUnit][count][3] = ((GLfloat*) p)[3]; case 3: VB->MultiTexCoord[texUnit][count][2] = ((GLfloat*) p)[2]; case 2: VB->MultiTexCoord[texUnit][count][1] = ((GLfloat*) p)[1]; case 1: VB->MultiTexCoord[texUnit][count][0] = ((GLfloat*) p)[0]; } break; case GL_DOUBLE: switch (ctx->Array.TexCoordSize[texUnit]) { /* FALL THROUGH! */ case 4: VB->MultiTexCoord[texUnit][count][3] = ((GLdouble*) p)[3]; case 3: VB->MultiTexCoord[texUnit][count][2] = ((GLdouble*) p)[2]; case 2: VB->MultiTexCoord[texUnit][count][1] = ((GLdouble*) p)[1]; case 1: VB->MultiTexCoord[texUnit][count][0] = ((GLdouble*) p)[0]; } break; default: gl_problem(ctx, "Bad texcoord type in gl_ArrayElement"); return; } } else { COPY_4V( VB->MultiTexCoord[texUnit][count], ctx->Current.MultiTexCoord[texUnit] ); } } if (ctx->Array.EdgeFlagEnabled) { GLbyte *b = (GLbyte*) ctx->Array.EdgeFlagPtr + i * ctx->Array.EdgeFlagStrideB; VB->Edgeflag[count] = *((GLboolean*) b); } else { VB->Edgeflag[count] = ctx->Current.EdgeFlag; d413 5 a417 46 if (ctx->Array.VertexEnabled) { GLbyte *b = (GLbyte*) ctx->Array.VertexPtr + i * ctx->Array.VertexStrideB; VB->Obj[count][2] = 0.0F; VB->Obj[count][3] = 1.0F; switch (ctx->Array.VertexType) { case GL_SHORT: switch (ctx->Array.VertexSize) { /* FALL THROUGH */ case 4: VB->Obj[count][3] = ((GLshort*) b)[3]; case 3: VB->Obj[count][2] = ((GLshort*) b)[2]; case 2: VB->Obj[count][1] = ((GLshort*) b)[1]; VB->Obj[count][0] = ((GLshort*) b)[0]; } break; case GL_INT: switch (ctx->Array.VertexSize) { /* FALL THROUGH */ case 4: VB->Obj[count][3] = ((GLint*) b)[3]; case 3: VB->Obj[count][2] = ((GLint*) b)[2]; case 2: VB->Obj[count][1] = ((GLint*) b)[1]; VB->Obj[count][0] = ((GLint*) b)[0]; } break; case GL_FLOAT: switch (ctx->Array.VertexSize) { /* FALL THROUGH */ case 4: VB->Obj[count][3] = ((GLfloat*) b)[3]; case 3: VB->Obj[count][2] = ((GLfloat*) b)[2]; case 2: VB->Obj[count][1] = ((GLfloat*) b)[1]; VB->Obj[count][0] = ((GLfloat*) b)[0]; } break; case GL_DOUBLE: switch (ctx->Array.VertexSize) { /* FALL THROUGH */ case 4: VB->Obj[count][3] = ((GLdouble*) b)[3]; case 3: VB->Obj[count][2] = ((GLdouble*) b)[2]; case 2: VB->Obj[count][1] = ((GLdouble*) b)[1]; VB->Obj[count][0] = ((GLdouble*) b)[0]; } break; default: gl_problem(ctx, "Bad vertex type in gl_ArrayElement"); return; } d419 2 a420 6 /* Only store vertex if Vertex array pointer is enabled */ count++; VB->Count = count; if (count==VB_MAX) { gl_transform_vb( ctx, GL_FALSE ); } d422 1 a423 4 else { /* vertex array pointer not enabled: no vertex to process */ } } d425 7 d433 2 d436 1 d438 4 a441 33 /* * Save into display list * Use external API entry points since speed isn't too important here * and makes the code simpler. Also, if GL_COMPILE_AND_EXECUTE then * execute will happen too. */ void gl_save_ArrayElement( GLcontext *ctx, GLint i ) { GLuint texUnit; if (ctx->Array.NormalEnabled) { GLbyte *p = (GLbyte*) ctx->Array.NormalPtr + i * ctx->Array.NormalStrideB; switch (ctx->Array.NormalType) { case GL_BYTE: glNormal3bv( (GLbyte*) p ); break; case GL_SHORT: glNormal3sv( (GLshort*) p ); break; case GL_INT: glNormal3iv( (GLint*) p ); break; case GL_FLOAT: glNormal3fv( (GLfloat*) p ); break; case GL_DOUBLE: glNormal3dv( (GLdouble*) p ); break; default: gl_problem(ctx, "Bad normal type in gl_save_ArrayElement"); return; } } a442 56 if (ctx->Array.ColorEnabled) { GLbyte *p = (GLbyte*) ctx->Array.ColorPtr + i * ctx->Array.ColorStrideB; switch (ctx->Array.ColorType) { case GL_BYTE: switch (ctx->Array.ColorSize) { case 3: glColor3bv( (GLbyte*) p ); break; case 4: glColor4bv( (GLbyte*) p ); break; } break; case GL_UNSIGNED_BYTE: switch (ctx->Array.ColorSize) { case 3: glColor3ubv( (GLubyte*) p ); break; case 4: glColor4ubv( (GLubyte*) p ); break; } break; case GL_SHORT: switch (ctx->Array.ColorSize) { case 3: glColor3sv( (GLshort*) p ); break; case 4: glColor4sv( (GLshort*) p ); break; } break; case GL_UNSIGNED_SHORT: switch (ctx->Array.ColorSize) { case 3: glColor3usv( (GLushort*) p ); break; case 4: glColor4usv( (GLushort*) p ); break; } break; case GL_INT: switch (ctx->Array.ColorSize) { case 3: glColor3iv( (GLint*) p ); break; case 4: glColor4iv( (GLint*) p ); break; } break; case GL_UNSIGNED_INT: switch (ctx->Array.ColorSize) { case 3: glColor3uiv( (GLuint*) p ); break; case 4: glColor4uiv( (GLuint*) p ); break; } break; case GL_FLOAT: switch (ctx->Array.ColorSize) { case 3: glColor3fv( (GLfloat*) p ); break; case 4: glColor4fv( (GLfloat*) p ); break; } break; case GL_DOUBLE: switch (ctx->Array.ColorSize) { case 3: glColor3dv( (GLdouble*) p ); break; case 4: glColor4dv( (GLdouble*) p ); break; } break; default: gl_problem(ctx, "Bad color type in gl_save_ArrayElement"); return; } } a443 20 if (ctx->Array.IndexEnabled) { GLbyte *p = (GLbyte*) ctx->Array.IndexPtr + i * ctx->Array.IndexStrideB; switch (ctx->Array.IndexType) { case GL_SHORT: glIndexsv( (GLshort*) p ); break; case GL_INT: glIndexiv( (GLint*) p ); break; case GL_FLOAT: glIndexfv( (GLfloat*) p ); break; case GL_DOUBLE: glIndexdv( (GLdouble*) p ); break; default: gl_problem(ctx, "Bad index type in gl_save_ArrayElement"); return; } } a444 44 for (texUnit = 0; texUnit < ctx->Const.MaxTextureUnits; texUnit++) { if (ctx->Array.TexCoordEnabled[texUnit]) { GLbyte *p = (GLbyte*) ctx->Array.TexCoordPtr[texUnit] + i * ctx->Array.TexCoordStrideB[texUnit]; GLenum target = (GLenum) (GL_TEXTURE0_SGIS + texUnit); switch (ctx->Array.TexCoordType[texUnit]) { case GL_SHORT: switch (ctx->Array.TexCoordSize[texUnit]) { case 1: glMultiTexCoord1svSGIS( target, (GLshort*) p ); break; case 2: glMultiTexCoord2svSGIS( target, (GLshort*) p ); break; case 3: glMultiTexCoord3svSGIS( target, (GLshort*) p ); break; case 4: glMultiTexCoord4svSGIS( target, (GLshort*) p ); break; } break; case GL_INT: switch (ctx->Array.TexCoordSize[texUnit]) { case 1: glMultiTexCoord1ivSGIS( target, (GLint*) p ); break; case 2: glMultiTexCoord2ivSGIS( target, (GLint*) p ); break; case 3: glMultiTexCoord3ivSGIS( target, (GLint*) p ); break; case 4: glMultiTexCoord4ivSGIS( target, (GLint*) p ); break; } break; case GL_FLOAT: switch (ctx->Array.TexCoordSize[texUnit]) { case 1: glMultiTexCoord1fvSGIS( target, (GLfloat*) p ); break; case 2: glMultiTexCoord2fvSGIS( target, (GLfloat*) p ); break; case 3: glMultiTexCoord3fvSGIS( target, (GLfloat*) p ); break; case 4: glMultiTexCoord4fvSGIS( target, (GLfloat*) p ); break; } break; case GL_DOUBLE: switch (ctx->Array.TexCoordSize[texUnit]) { case 1: glMultiTexCoord1dvSGIS( target, (GLdouble*) p ); break; case 2: glMultiTexCoord2dvSGIS( target, (GLdouble*) p ); break; case 3: glMultiTexCoord3dvSGIS( target, (GLdouble*) p ); break; case 4: glMultiTexCoord4dvSGIS( target, (GLdouble*) p ); break; } break; default: gl_problem(ctx, "Bad texcoord type in gl_save_ArrayElement"); return; } } } a445 4 if (ctx->Array.EdgeFlagEnabled) { GLbyte *b = (GLbyte*) ctx->Array.EdgeFlagPtr + i * ctx->Array.EdgeFlagStrideB; glEdgeFlagv( (GLboolean*) b ); } d447 11 a457 38 if (ctx->Array.VertexEnabled) { GLbyte *b = (GLbyte*) ctx->Array.VertexPtr + i * ctx->Array.VertexStrideB; switch (ctx->Array.VertexType) { case GL_SHORT: switch (ctx->Array.VertexSize) { case 2: glVertex2sv( (GLshort*) b ); break; case 3: glVertex3sv( (GLshort*) b ); break; case 4: glVertex4sv( (GLshort*) b ); break; } break; case GL_INT: switch (ctx->Array.VertexSize) { case 2: glVertex2iv( (GLint*) b ); break; case 3: glVertex3iv( (GLint*) b ); break; case 4: glVertex4iv( (GLint*) b ); break; } break; case GL_FLOAT: switch (ctx->Array.VertexSize) { case 2: glVertex2fv( (GLfloat*) b ); break; case 3: glVertex3fv( (GLfloat*) b ); break; case 4: glVertex4fv( (GLfloat*) b ); break; } break; case GL_DOUBLE: switch (ctx->Array.VertexSize) { case 2: glVertex2dv( (GLdouble*) b ); break; case 3: glVertex3dv( (GLdouble*) b ); break; case 4: glVertex4dv( (GLdouble*) b ); break; } break; default: gl_problem(ctx, "Bad vertex type in gl_save_ArrayElement"); return; } } } d461 2 a462 2 /* * Execute d464 1 a464 1 void gl_DrawArrays( GLcontext *ctx, GLenum mode, GLint first, GLsizei count ) a466 1 GLuint texUnit = ctx->Texture.CurrentUnit; a467 1 GLboolean need_edges; d469 2 a470 4 if (INSIDE_BEGIN_END(ctx)) { gl_error( ctx, GL_INVALID_OPERATION, "glDrawArrays" ); return; } d476 1 a476 17 if (ctx->Primitive==GL_TRIANGLES || ctx->Primitive==GL_QUADS || ctx->Primitive==GL_POLYGON) { need_edges = GL_TRUE; } else { need_edges = GL_FALSE; } if (!ctx->CompileFlag && !ctx->Texture.Enabled && ctx->Array.VertexEnabled && ctx->Array.VertexType==GL_FLOAT && (!ctx->Array.NormalEnabled || ctx->Array.NormalType==GL_FLOAT) && !ctx->Array.ColorEnabled && !ctx->Array.IndexEnabled && !ctx->Array.TexCoordEnabled[texUnit] && !ctx->Array.EdgeFlagEnabled) d479 14 a492 4 GLuint vstride = ctx->Array.VertexStrideB / sizeof(GLfloat); GLuint nstride = ctx->Array.NormalStrideB / sizeof(GLfloat); GLfloat *vptr = (GLfloat *) ctx->Array.VertexPtr + vstride * first; GLfloat *nptr = (GLfloat *) ctx->Array.NormalPtr + nstride * first; d494 58 a551 2 ASSERT(ctx->Array.VertexStrideB % 4 == 0); /* unaligned data is bad */ ASSERT(ctx->Array.NormalStrideB % 4 == 0); d553 46 a598 1 /* setup constant values */ d600 48 a647 11 GLint i, n = MIN2(VB_MAX, count); if (!ctx->Light.Enabled) { for (i=0;iFcolor[i], ctx->Current.ByteColor ); } } if (need_edges) { for (i=0;iEdgeflag[i] = ctx->Current.EdgeFlag; } } d650 5 a654 1 gl_Begin( ctx, mode ); d657 47 a703 2 GLint vbspace = VB_MAX - VB->Start; GLint n = MIN2( vbspace, remaining ); d705 65 a769 10 /* Vertexes */ VB->ObjPtr = vptr - VB->Start * vstride; VB->VertexSizeMask = VERTEX_SZ_BIT(ctx->Array.VertexSize); VB->ObjStride = vstride; /* Normals */ if (ctx->Array.NormalEnabled) { VB->NormalPtr = nptr - VB->Start * nstride; VB->NormalStride = nstride; VB->MonoNormal = GL_FALSE; a770 3 else { VB->MonoNormal = GL_TRUE; } d772 35 a806 2 /* update the lighting pointers */ gl_update_shade_context(ctx, &ctx->shade_context); d808 1 a809 7 VB->Count = VB->Start + n; /* Transform and render */ gl_transform_vb( ctx, remaining==0 ? GL_TRUE : GL_FALSE ); vptr += vstride * n; nptr += nstride * n; a810 13 gl_End( ctx ); /* put the pointers back where they were */ VB->ObjPtr = (GLfloat *)VB->Obj; VB->ObjCoordSize = 4; VB->ObjStride = 4; VB->NormalPtr = (GLfloat *)VB->Normal; VB->NormalStride = 3; /* reset the lighting pointers */ gl_update_shade_context( ctx, &ctx->shade_context ); d812 5 a816 3 else { /* * GENERAL CASE: d818 1 d821 1 a821 1 gl_ArrayElement( ctx, first+i ); d825 10 a838 42 /* * Save into a display list */ void gl_save_DrawArrays( GLcontext *ctx, GLenum mode, GLint first, GLsizei count ) { GLint i; if (INSIDE_BEGIN_END(ctx)) { gl_error( ctx, GL_INVALID_OPERATION, "glDrawArrays" ); return; } if (count<0) { gl_error( ctx, GL_INVALID_VALUE, "glDrawArrays(count)" ); return; } switch (mode) { case GL_POINTS: case GL_LINES: case GL_LINE_STRIP: case GL_LINE_LOOP: case GL_TRIANGLES: case GL_TRIANGLE_STRIP: case GL_TRIANGLE_FAN: case GL_QUADS: case GL_QUAD_STRIP: case GL_POLYGON: /* OK */ break; default: gl_error( ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" ); return; } /* Note: this will do compile AND execute if needed */ gl_save_Begin( ctx, mode ); for (i=0;iTexCoordSet; d264 1 a264 1 ctx->Array.TexCoordStrideB[texSet] = stride ? stride : size*sizeof(GLshort); d267 1 a267 1 ctx->Array.TexCoordStrideB[texSet] = stride ? stride : size*sizeof(GLint); d270 1 a270 1 ctx->Array.TexCoordStrideB[texSet] = stride ? stride : size*sizeof(GLfloat); d273 1 a273 1 ctx->Array.TexCoordStrideB[texSet] = stride ? stride : size*sizeof(GLdouble); d279 4 a282 4 ctx->Array.TexCoordSize[texSet] = size; ctx->Array.TexCoordType[texSet] = type; ctx->Array.TexCoordStride[texSet] = stride; ctx->Array.TexCoordPtr[texSet] = (void *) ptr; d292 1 a292 1 GLuint texSet; d305 1 a305 1 texSet = target - GL_TEXTURE0_SGIS; d308 1 a308 1 ctx->Array.TexCoordStrideB[texSet] = stride ? stride : size*sizeof(GLshort); d311 1 a311 1 ctx->Array.TexCoordStrideB[texSet] = stride ? stride : size*sizeof(GLint); d314 1 a314 1 ctx->Array.TexCoordStrideB[texSet] = stride ? stride : size*sizeof(GLfloat); d317 1 a317 1 ctx->Array.TexCoordStrideB[texSet] = stride ? stride : size*sizeof(GLdouble); d323 4 a326 4 ctx->Array.TexCoordSize[texSet] = size; ctx->Array.TexCoordType[texSet] = type; ctx->Array.TexCoordStride[texSet] = stride; ctx->Array.TexCoordPtr[texSet] = (void *) ptr; d363 1 a363 1 GLuint texSet; d505 8 a512 8 for (texSet=0; texSetConst.MaxTextureUnits; texSet++) { if (ctx->Array.TexCoordEnabled[texSet]) { GLbyte *p = (GLbyte*) ctx->Array.TexCoordPtr[texSet] + i * ctx->Array.TexCoordStrideB[texSet]; VB->MultiTexCoord[texSet][count][1] = 0.0F; VB->MultiTexCoord[texSet][count][2] = 0.0F; VB->MultiTexCoord[texSet][count][3] = 1.0F; switch (ctx->Array.TexCoordType[texSet]) { d514 1 a514 1 switch (ctx->Array.TexCoordSize[texSet]) { d516 4 a519 4 case 4: VB->MultiTexCoord[texSet][count][3] = ((GLshort*) p)[3]; case 3: VB->MultiTexCoord[texSet][count][2] = ((GLshort*) p)[2]; case 2: VB->MultiTexCoord[texSet][count][1] = ((GLshort*) p)[1]; case 1: VB->MultiTexCoord[texSet][count][0] = ((GLshort*) p)[0]; d523 1 a523 1 switch (ctx->Array.TexCoordSize[texSet]) { d525 4 a528 4 case 4: VB->MultiTexCoord[texSet][count][3] = ((GLint*) p)[3]; case 3: VB->MultiTexCoord[texSet][count][2] = ((GLint*) p)[2]; case 2: VB->MultiTexCoord[texSet][count][1] = ((GLint*) p)[1]; case 1: VB->MultiTexCoord[texSet][count][0] = ((GLint*) p)[0]; d532 1 a532 1 switch (ctx->Array.TexCoordSize[texSet]) { d534 4 a537 4 case 4: VB->MultiTexCoord[texSet][count][3] = ((GLfloat*) p)[3]; case 3: VB->MultiTexCoord[texSet][count][2] = ((GLfloat*) p)[2]; case 2: VB->MultiTexCoord[texSet][count][1] = ((GLfloat*) p)[1]; case 1: VB->MultiTexCoord[texSet][count][0] = ((GLfloat*) p)[0]; d541 1 a541 1 switch (ctx->Array.TexCoordSize[texSet]) { d543 4 a546 4 case 4: VB->MultiTexCoord[texSet][count][3] = ((GLdouble*) p)[3]; case 3: VB->MultiTexCoord[texSet][count][2] = ((GLdouble*) p)[2]; case 2: VB->MultiTexCoord[texSet][count][1] = ((GLdouble*) p)[1]; case 1: VB->MultiTexCoord[texSet][count][0] = ((GLdouble*) p)[0]; d555 1 a555 1 COPY_4V( VB->MultiTexCoord[texSet][count], ctx->Current.MultiTexCoord[texSet] ); d639 1 a639 1 GLuint texSet; d743 6 a748 6 for (texSet = 0; texSet < ctx->Const.MaxTextureUnits; texSet++) { if (ctx->Array.TexCoordEnabled[texSet]) { GLbyte *p = (GLbyte*) ctx->Array.TexCoordPtr[texSet] + i * ctx->Array.TexCoordStrideB[texSet]; GLenum target = (GLenum) (GL_TEXTURE0_SGIS + texSet); switch (ctx->Array.TexCoordType[texSet]) { d750 1 a750 1 switch (ctx->Array.TexCoordSize[texSet]) { d758 1 a758 1 switch (ctx->Array.TexCoordSize[texSet]) { d766 1 a766 1 switch (ctx->Array.TexCoordSize[texSet]) { d774 1 a774 1 switch (ctx->Array.TexCoordSize[texSet]) { d840 1 a840 1 GLuint texSet = ctx->Texture.CurrentSet; d868 1 a868 1 && !ctx->Array.TexCoordEnabled[texSet] d1137 1 a1137 1 GLint coordSetSave; d1266 1 a1266 1 coordSetSave = ctx->TexCoordSet; d1288 2 a1289 2 /* Restore texture coordinate set index */ gl_SelectTextureCoordSet( ctx, GL_TEXTURE0_SGIS + coordSetSave ); @ 3.10 log @variety of multi-texture changes @ text @d1 1 a1 1 /* $Id: varray.c,v 3.9 1998/10/29 03:57:11 brianp Exp brianp $ */ d26 3 d834 1 a834 2 void gl_DrawArrays( GLcontext *ctx, GLenum mode, GLint first, GLsizei count ) d836 1 a836 1 struct vertex_buffer* VB = ctx->VB; a858 1 d869 2 a870 2 GLuint vstride = ctx->Array.VertexStride + ctx->Array.VertexSize; GLuint nstride = ctx->Array.NormalStride + 3; d874 17 d894 1 a894 1 while (remaining>0) { d898 1 d903 2 a904 6 /* printf("vptr: %x sz %d mask %d stride %d n %d\n", */ /* vptr, ctx->Array.VertexSize, */ /* VB->VertexSizeMask, VB->obj_stride, n); */ if (ctx->Array.NormalEnabled) { d909 1 a909 1 else d911 1 a915 17 /* assign vertex colors */ if (!ctx->Light.Enabled) { GLint i, start = VB->Start; for (i=0;iFcolor[start+i], ctx->Current.ByteColor ); } } /* assign polygon edgeflags */ if (need_edges) { GLint i; for (i=0;iEdgeflag[VB->Start+i] = ctx->Current.EdgeFlag; } } d919 1 a919 3 /* Let gl_transform_vb_range() decide whether to do the * modelview transform or not. */ a923 1 /* remaining = 0; */ @ 3.9 log @misc clean-up of new vertex transformation code @ text @d1 1 a1 1 /* $Id: varray.c,v 3.8 1998/10/29 02:28:13 brianp Exp brianp $ */ d26 3 d327 1 a327 2 GLint maxSets = gl_max_texture_coord_sets(ctx); if (factor < 1 || factor > maxSets) { d499 1 a499 1 for (texSet=0; texSetobjp = vptr - VB->Start * vstride; d880 1 a880 1 VB->obj_stride = vstride; d888 2 a889 2 VB->normp = nptr - VB->Start * nstride; VB->norm_stride = nstride; d921 1 a921 1 gl_transform_vb_part1( ctx, remaining==0 ? GL_TRUE : GL_FALSE ); d931 5 a935 5 VB->objp = (GLfloat *)VB->Obj; VB->obj_sz = 4; VB->obj_stride = 4; VB->normp = (GLfloat *)VB->Normal; VB->norm_stride = 3; @ 3.7 log @fixed interleaved texture coordinate problem @ text @d1 1 a1 1 /* $Id: varray.c,v 3.6 1998/08/21 01:50:53 brianp Exp brianp $ */ d5 1 a5 1 * Version: 3.0 d26 3 d843 3 a845 2 if (ctx->Primitive==GL_TRIANGLES || ctx->Primitive==GL_QUADS || ctx->Primitive==GL_POLYGON) { d852 2 a853 1 if (!ctx->Light.Enabled d856 1 a856 2 && ctx->Array.VertexStride==0 && ctx->Array.VertexSize==3 && !ctx->Array.NormalEnabled d860 8 a867 6 && !ctx->Array.EdgeFlagEnabled) { /* * SPECIAL CASE: glVertex3fv() with no lighting */ GLfloat (*vptr)[3]; GLint remaining; a870 2 remaining = count; vptr = (GLfloat (*)[3]) ctx->Array.VertexPtr + 3 * first; d872 2 a873 1 GLint vbspace, n; d875 16 a890 2 vbspace = VB_MAX - VB->Start; n = MIN2( vbspace, remaining ); d892 2 a893 1 gl_xform_points_3fv( n, VB->Eye+VB->Start, ctx->ModelViewMatrix, vptr ); d896 1 a912 54 VB->MonoNormal = GL_FALSE; VB->Count = VB->Start + n; gl_transform_vb_part2( ctx, remaining==0 ? GL_TRUE : GL_FALSE ); vptr += n; } gl_End( ctx ); } else if (!ctx->CompileFlag && ctx->Light.Enabled && !ctx->Texture.Enabled && ctx->Array.VertexEnabled && ctx->Array.VertexType==GL_FLOAT && ctx->Array.VertexStride==0 && ctx->Array.VertexSize==4 && ctx->Array.NormalEnabled && ctx->Array.NormalType==GL_FLOAT && ctx->Array.NormalStride==0 && !ctx->Array.ColorEnabled && !ctx->Array.IndexEnabled && !ctx->Array.TexCoordEnabled[texSet] && !ctx->Array.EdgeFlagEnabled) { /* * SPECIAL CASE: glNormal3fv(); glVertex4fv(); with lighting */ GLfloat (*vptr)[4], (*nptr)[3]; GLint remaining; gl_Begin( ctx, mode ); remaining = count; vptr = (GLfloat (*)[4]) ctx->Array.VertexPtr + 4 * first; nptr = (GLfloat (*)[3]) ctx->Array.NormalPtr + 3 * first; while (remaining>0) { GLint vbspace, n; vbspace = VB_MAX - VB->Start; n = MIN2( vbspace, remaining ); gl_xform_points_4fv( n, VB->Eye+VB->Start, ctx->ModelViewMatrix, vptr ); gl_xform_normals_3fv( n, VB->Normal+VB->Start, ctx->ModelViewInv, nptr, ctx->Transform.Normalize, ctx->Transform.RescaleNormals ); /* assign polygon edgeflags */ if (need_edges) { GLint i; for (i=0;iEdgeflag[VB->Start+i] = ctx->Current.EdgeFlag; } } remaining -= n; VB->MonoNormal = GL_FALSE; a913 1 gl_transform_vb_part2( ctx, remaining==0 ? GL_TRUE : GL_FALSE ); d915 8 a922 2 vptr += n; nptr += n; d924 1 a924 1 a925 28 } else if (!ctx->CompileFlag && ctx->Light.Enabled && !ctx->Texture.Enabled && ctx->Array.VertexEnabled && ctx->Array.VertexType==GL_FLOAT && ctx->Array.VertexStride==0 && ctx->Array.VertexSize==3 && ctx->Array.NormalEnabled && ctx->Array.NormalType==GL_FLOAT && ctx->Array.NormalStride==0 && !ctx->Array.ColorEnabled && !ctx->Array.IndexEnabled && !ctx->Array.TexCoordEnabled[texSet] && !ctx->Array.EdgeFlagEnabled) { /* * SPECIAL CASE: glNormal3fv(); glVertex3fv(); with lighting */ GLfloat (*vptr)[3], (*nptr)[3]; GLint remaining; gl_Begin( ctx, mode ); remaining = count; vptr = (GLfloat (*)[3]) ctx->Array.VertexPtr + 3 * first; nptr = (GLfloat (*)[3]) ctx->Array.NormalPtr + 3 * first; while (remaining>0) { GLint vbspace, n; vbspace = VB_MAX - VB->Start; n = MIN2( vbspace, remaining ); d927 10 a936 24 gl_xform_points_3fv( n, VB->Eye+VB->Start, ctx->ModelViewMatrix, vptr ); gl_xform_normals_3fv( n, VB->Normal+VB->Start, ctx->ModelViewInv, nptr, ctx->Transform.Normalize, ctx->Transform.RescaleNormals ); /* assign polygon edgeflags */ if (need_edges) { GLint i; for (i=0;iEdgeflag[VB->Start+i] = ctx->Current.EdgeFlag; } } remaining -= n; VB->MonoNormal = GL_FALSE; VB->Count = VB->Start + n; gl_transform_vb_part2( ctx, remaining==0 ? GL_TRUE : GL_FALSE ); vptr += n; nptr += n; } gl_End( ctx ); d1128 1 d1267 1 a1267 1 gl_SelectTextureCoordSet( ctx, GL_TEXTURE0_EXT + i ); d1273 1 a1273 1 gl_SelectTextureCoordSet( ctx, GL_TEXTURE0_EXT + i ); d1280 1 a1280 1 gl_SelectTextureCoordSet( ctx, GL_TEXTURE0_EXT + i ); d1285 1 a1285 1 gl_SelectTextureCoordSet( ctx, GL_TEXTURE0_EXT + coordSetSave ); @ 3.6 log @added support for texture coordinate set interleave factor @ text @d1 1 a1 1 /* $Id: varray.c,v 3.5 1998/06/07 22:18:52 brianp Exp brianp $ */ d26 3 d238 1 a238 1 GLuint texSet = ctx->Texture.CurrentSet; d272 1 a272 1 /* GL_SGIS_multitexture */ d1330 1 d1334 2 a1335 1 for (i = 0; i < ctx->Array.TexCoordInterleaveFactor; i++) { d1341 1 a1341 1 for (i = 0; i < MAX_TEX_COORD_SETS; i++) { d1354 1 a1354 1 gl_SelectTextureCoordSet( ctx, coordSetSave ); d1356 2 d1367 2 @ 3.5 log @implemented GL_EXT_multitexture extension @ text @d1 1 a1 1 /* $Id: varray.c,v 3.4 1998/03/27 04:26:44 brianp Exp brianp $ */ d26 3 d68 1 d312 1 d315 6 a320 1 gl_problem( ctx, "glInterleavedTextureCoordSets() not implemented" ); d324 1 a1052 1 a1188 1 d1199 1 d1327 1 d1329 11 a1339 2 gl_EnableClientState( ctx, GL_TEXTURE_COORD_ARRAY ); gl_TexCoordPointer( ctx, tcomps, GL_FLOAT, stride, pointer ); d1342 5 a1346 1 gl_DisableClientState( ctx, GL_TEXTURE_COORD_ARRAY ); d1348 2 @ 3.4 log @fixed G++ warnings @ text @d1 1 a1 1 /* $Id: varray.c,v 3.3 1998/02/20 04:53:07 brianp Exp brianp $ */ d26 3 d307 5 @ 3.3 log @implemented GL_SGIS_multitexture @ text @d1 1 a1 1 /* $Id: varray.c,v 3.2 1998/02/01 20:05:10 brianp Exp brianp $ */ d26 3 d711 1 a711 1 GLenum target = GL_TEXTURE0_SGIS + texSet; @ 3.2 log @added glDrawRangeElements() @ text @d1 1 a1 1 /* $Id: varray.c,v 3.1 1998/02/01 16:37:19 brianp Exp brianp $ */ d26 3 d225 1 d230 4 d236 1 a236 1 ctx->Array.TexCoordStrideB = stride ? stride : size*sizeof(GLshort); d239 1 a239 1 ctx->Array.TexCoordStrideB = stride ? stride : size*sizeof(GLint); d242 1 a242 1 ctx->Array.TexCoordStrideB = stride ? stride : size*sizeof(GLfloat); d245 1 a245 1 ctx->Array.TexCoordStrideB = stride ? stride : size*sizeof(GLdouble); d251 18 d270 5 a274 1 gl_error( ctx, GL_INVALID_VALUE, "glTexCoordPointer(stride)" ); d277 22 a298 4 ctx->Array.TexCoordSize = size; ctx->Array.TexCoordType = type; ctx->Array.TexCoordStride = stride; ctx->Array.TexCoordPtr = (void *) ptr; d324 1 d466 52 a517 50 if (ctx->Array.TexCoordEnabled) { GLbyte *p = (GLbyte*) ctx->Array.TexCoordPtr + i * ctx->Array.TexCoordStrideB; VB->TexCoord[count][1] = 0.0F; VB->TexCoord[count][2] = 0.0F; VB->TexCoord[count][3] = 1.0F; switch (ctx->Array.TexCoordType) { case GL_SHORT: switch (ctx->Array.TexCoordSize) { /* FALL THROUGH! */ case 4: VB->TexCoord[count][3] = ((GLshort*) p)[3]; case 3: VB->TexCoord[count][2] = ((GLshort*) p)[2]; case 2: VB->TexCoord[count][1] = ((GLshort*) p)[1]; case 1: VB->TexCoord[count][0] = ((GLshort*) p)[0]; } break; case GL_INT: switch (ctx->Array.TexCoordSize) { /* FALL THROUGH! */ case 4: VB->TexCoord[count][3] = ((GLint*) p)[3]; case 3: VB->TexCoord[count][2] = ((GLint*) p)[2]; case 2: VB->TexCoord[count][1] = ((GLint*) p)[1]; case 1: VB->TexCoord[count][0] = ((GLint*) p)[0]; } break; case GL_FLOAT: switch (ctx->Array.TexCoordSize) { /* FALL THROUGH! */ case 4: VB->TexCoord[count][3] = ((GLfloat*) p)[3]; case 3: VB->TexCoord[count][2] = ((GLfloat*) p)[2]; case 2: VB->TexCoord[count][1] = ((GLfloat*) p)[1]; case 1: VB->TexCoord[count][0] = ((GLfloat*) p)[0]; } break; case GL_DOUBLE: switch (ctx->Array.TexCoordSize) { /* FALL THROUGH! */ case 4: VB->TexCoord[count][3] = ((GLdouble*) p)[3]; case 3: VB->TexCoord[count][2] = ((GLdouble*) p)[2]; case 2: VB->TexCoord[count][1] = ((GLdouble*) p)[1]; case 1: VB->TexCoord[count][0] = ((GLdouble*) p)[0]; } break; default: gl_problem(ctx, "Bad texcoord type in gl_ArrayElement"); return; } } else { COPY_4V( VB->TexCoord[count], ctx->Current.TexCoord ); d600 1 d704 42 a745 39 if (ctx->Array.TexCoordEnabled) { GLbyte *p = (GLbyte*) ctx->Array.TexCoordPtr + i * ctx->Array.TexCoordStrideB; switch (ctx->Array.TexCoordType) { case GL_SHORT: switch (ctx->Array.TexCoordSize) { case 1: glTexCoord1sv( (GLshort*) p ); break; case 2: glTexCoord2sv( (GLshort*) p ); break; case 3: glTexCoord3sv( (GLshort*) p ); break; case 4: glTexCoord4sv( (GLshort*) p ); break; } break; case GL_INT: switch (ctx->Array.TexCoordSize) { case 1: glTexCoord1iv( (GLint*) p ); break; case 2: glTexCoord2iv( (GLint*) p ); break; case 3: glTexCoord3iv( (GLint*) p ); break; case 4: glTexCoord4iv( (GLint*) p ); break; } break; case GL_FLOAT: switch (ctx->Array.TexCoordSize) { case 1: glTexCoord1fv( (GLfloat*) p ); break; case 2: glTexCoord2fv( (GLfloat*) p ); break; case 3: glTexCoord3fv( (GLfloat*) p ); break; case 4: glTexCoord4fv( (GLfloat*) p ); break; } break; case GL_DOUBLE: switch (ctx->Array.TexCoordSize) { case 1: glTexCoord1dv( (GLdouble*) p ); break; case 2: glTexCoord2dv( (GLdouble*) p ); break; case 3: glTexCoord3dv( (GLdouble*) p ); break; case 4: glTexCoord4dv( (GLdouble*) p ); break; } break; default: gl_problem(ctx, "Bad texcoord type in gl_save_ArrayElement"); return; d802 1 a802 1 d830 1 a830 1 && !ctx->Array.TexCoordEnabled d886 1 a886 1 && !ctx->Array.TexCoordEnabled d939 1 a939 1 && !ctx->Array.TexCoordEnabled @ 3.1 log @added GL_EXT_rescale_normal extension @ text @d1 1 a1 1 /* $Id: varray.c,v 3.0 1998/01/31 21:06:45 brianp Exp brianp $ */ d26 3 d1294 26 @ 3.0 log @initial rev @ text @d1 1 a1 1 /* $Id$ */ d25 4 a28 1 * $Log$ d849 2 a850 1 ctx->Transform.Normalize ); d902 2 a903 1 ctx->Transform.Normalize ); @