Changes to reduce the memory footprint of display lists
authorKeith Whitwell <keith@tungstengraphics.com>
Tue, 19 Oct 1999 18:37:02 +0000 (18:37 +0000)
committerKeith Whitwell <keith@tungstengraphics.com>
Tue, 19 Oct 1999 18:37:02 +0000 (18:37 +0000)
12 files changed:
src/mesa/drivers/glide/fxdd.c
src/mesa/drivers/glide/fxddtex.c
src/mesa/drivers/glide/fxdrv.h
src/mesa/drivers/glide/fxsetup.c
src/mesa/main/context.c
src/mesa/main/dlist.c
src/mesa/main/eval.c
src/mesa/main/light.c
src/mesa/main/varray.c
src/mesa/main/varray.h
src/mesa/x86/3dnow.c
src/mesa/x86/x86.c

index 6eed8ce..3580971 100644 (file)
@@ -347,6 +347,8 @@ void fxDDSetNearFar(GLcontext *ctx, GLfloat n, GLfloat f)
 {
    FX_CONTEXT(ctx)->new_state |= FX_NEW_FOG;
    ctx->Driver.RenderStart = fxSetupFXUnits;
+
+   FX_CONTEXT(ctx)->wscale = fabs(f)/65535.0f;
 }
 
 /* KW: Put the word Mesa in the render string because quakeworld
@@ -360,7 +362,44 @@ static const GLubyte *fxDDGetString(GLcontext *ctx, GLenum name)
 #if defined(GLX_DIRECT_RENDERING)
       return "Mesa Glide - DRI VB/V3";
 #else
-      return (GLubyte*)"Mesa Glide";
+      {
+        static char buf[80];
+
+        if (glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_VOODOO) 
+        {
+           GrVoodooConfig_t *vc = 
+              &glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig;
+
+           sprintf(buf,
+                   "Mesa Glide v0.30 Voodoo_Graphics %d "
+                   "CARD/%d FB/%d TM/%d TMU/%s",
+                   glbCurrentBoard,
+                   (vc->sliDetect ? (vc->fbRam*2) : vc->fbRam),
+                   (vc->tmuConfig[GR_TMU0].tmuRam +
+                    ((vc->nTexelfx>1) ? vc->tmuConfig[GR_TMU1].tmuRam : 0)),
+                   vc->nTexelfx,
+                   (vc->sliDetect ? "SLI" : "NOSLI"));
+        }
+        else if (glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_SST96)
+        {
+           GrSst96Config_t *sc = 
+              &glbHWConfig.SSTs[glbCurrentBoard].sstBoard.SST96Config;
+
+           sprintf(buf,
+                   "Glide v0.30 Voodoo_Rush %d "
+                   "CARD/%d FB/%d TM/%d TMU/NOSLI",
+                   glbCurrentBoard,
+                   sc->fbRam,
+                   sc->tmuConfig.tmuRam,
+                   sc->nTexelfx);
+        }
+        else
+        {
+           strcpy(buf, "Glide v0.30 UNKNOWN");
+        }
+
+        return (GLubyte *) buf;
+      }
 #endif
    default:
       return NULL;
index 0199458..8890902 100644 (file)
@@ -52,7 +52,7 @@ static tfxTexInfo *fxAllocTexObjData(fxMesaContext fxMesa)
   tfxTexInfo *ti;
   int i;
 
-  if(!(ti=MALLOC(sizeof(tfxTexInfo)))) {
+  if(!(ti=CALLOC(sizeof(tfxTexInfo)))) {
     fprintf(stderr,"fx Driver: out of memory !\n");
     fxCloseHardware();
     exit(-1);
@@ -219,6 +219,7 @@ void fxDDTexParam(GLcontext *ctx, GLenum target, struct gl_texture_object *tObj,
       ti->sClamp=GR_TEXTURECLAMP_WRAP;
       break;
     default:
+       fprintf(stderr, "BAD CLAMP\n");
       break;
     }
     fxMesa->new_state|=FX_NEW_TEXTURING;
index f5ef576..aeb56e9 100644 (file)
@@ -61,7 +61,7 @@
 
 
 
-#if defined(MESA_DEBUG) && 0
+#if 0
 extern void fx_sanity_triangle( GrVertex *, GrVertex *, GrVertex * );
 #define grDrawTriangle fx_sanity_triangle
 #endif
@@ -477,6 +477,8 @@ struct tfxMesaContext {
   
   FX_GrContext_t glideContext;
 
+  GLfloat wscale;
+
   DRI_FX_CONTEXT
 
 };
index ce70b47..8367a1f 100644 (file)
@@ -36,9 +36,9 @@ static void fxTexValidate(GLcontext *ctx, struct gl_texture_object *tObj)
   tfxTexInfo *ti=(tfxTexInfo *)tObj->DriverData;
   GLint minl,maxl;
 
-  if (MESA_VERBOSE&VERBOSE_DRIVER) {
+  if (MESA_VERBOSE&VERBOSE_DRIVER) 
      fprintf(stderr,"fxmesa: fxTexValidate(...) Start\n");
-  }
+
 
   if(ti->validated) {
      if (MESA_VERBOSE&VERBOSE_DRIVER) {
@@ -50,13 +50,13 @@ static void fxTexValidate(GLcontext *ctx, struct gl_texture_object *tObj)
   minl=ti->minLevel=tObj->BaseLevel;
   maxl=ti->maxLevel=MIN2(tObj->MaxLevel,tObj->Image[0]->MaxLog2);
 
+  
   fxTexGetInfo(tObj->Image[minl]->Width,tObj->Image[minl]->Height,
               &(FX_largeLodLog2(ti->info)),&(FX_aspectRatioLog2(ti->info)),
               &(ti->sScale),&(ti->tScale),
               &(ti->int_sScale),&(ti->int_tScale),            
               NULL,NULL);
 
-
   if((tObj->MinFilter!=GL_NEAREST) && (tObj->MinFilter!=GL_LINEAR))
     fxTexGetInfo(tObj->Image[maxl]->Width,tObj->Image[maxl]->Height,
                 &(FX_smallLodLog2(ti->info)),NULL,
@@ -292,6 +292,7 @@ static void fxSetupSingleTMU(fxMesaContext fxMesa, struct gl_texture_object *tOb
     if (ti->LODblend && (MESA_VERBOSE&VERBOSE_DRIVER))
        fprintf(stderr, "fxmesa: not blending texture - only on one tmu\n");
 
+
     grTexClampMode(ti->tmi.whichTMU,ti->sClamp,ti->tClamp);
     grTexFilterMode(ti->tmi.whichTMU,ti->minFilt,ti->maxFilt);
     grTexMipMapMode(ti->tmi.whichTMU,ti->mmMode,FXFALSE);
@@ -356,9 +357,9 @@ void fxSetupTextureSingleTMU(GLcontext *ctx, GLuint textureset)
   tfxTexInfo *ti;
   struct gl_texture_object *tObj=ctx->Texture.Unit[textureset].CurrentD[2];
 
-  if (MESA_VERBOSE&VERBOSE_DRIVER) {
+  if (MESA_VERBOSE&VERBOSE_DRIVER) 
      fprintf(stderr,"fxmesa: fxSetupTextureSingleTMU(...) Start\n");
-  }
+
 
   ti=(tfxTexInfo *)tObj->DriverData;
 
@@ -1559,9 +1560,11 @@ void fxSetupFXUnits( GLcontext *ctx )
   fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
   GLuint newstate = fxMesa->new_state;
 
+
   if (MESA_VERBOSE&VERBOSE_DRIVER) 
      gl_print_fx_state_flags("fxmesa: fxSetupFXUnits", newstate);
 
+
   if (newstate) {
      if (newstate & FX_NEW_TEXTURING)
        fxSetupTexture(ctx);
@@ -1588,7 +1591,7 @@ void fxSetupFXUnits( GLcontext *ctx )
        fxSetupCull(ctx);     
 
      fxMesa->new_state = 0;
-     ctx->Driver.RenderStart = 0;
+/*       ctx->Driver.RenderStart = 0; */
   }
 }
 
index ab25fd0..ea66f13 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: context.c,v 1.15 1999/10/13 18:42:49 brianp Exp $ */
+/* $Id: context.c,v 1.16 1999/10/19 18:37:02 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -619,7 +619,6 @@ static void initialize_context( GLcontext *ctx )
       ctx->Const.MaxTextureUnits = MAX_TEXTURE_UNITS;
       ctx->Const.MaxArrayLockSize = MAX_ARRAY_LOCK_SIZE;
 
-
       /* Modelview matrix */
       gl_matrix_ctr( &ctx->ModelView );
       gl_matrix_alloc_inv( &ctx->ModelView );
index f69205c..18fd4f9 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: dlist.c,v 1.10 1999/10/16 11:31:50 brianp Exp $ */
+/* $Id: dlist.c,v 1.11 1999/10/19 18:37:03 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -599,7 +599,7 @@ void gl_init_lists( void )
       InstSize[OPCODE_WINDOW_POS] = 5;
       InstSize[OPCODE_CONTINUE] = 2;
       InstSize[OPCODE_ERROR] = 3;
-      InstSize[OPCODE_VERTEX_CASSETTE] = 2;
+      InstSize[OPCODE_VERTEX_CASSETTE] = 9;
       InstSize[OPCODE_END_OF_LIST] = 1;
       /* GL_ARB_multitexture */
       InstSize[OPCODE_ACTIVE_TEXTURE] = 2;
@@ -2382,27 +2382,53 @@ static void save_ClientActiveTexture( GLcontext *ctx, GLenum target )
 
 void gl_compile_cassette( GLcontext *ctx )
 {
-   Node *n = alloc_instruction( ctx, OPCODE_VERTEX_CASSETTE, 1 );
-   struct immediate *new_im = gl_immediate_alloc(ctx);
-   struct immediate *im = ctx->input;
-   
-   if (!n || !new_im) {
-      if (n)
-        FREE(n);
-      if (new_im)
-        gl_immediate_free(new_im);
+   Node *n = alloc_instruction( ctx, OPCODE_VERTEX_CASSETTE, 8 );
+   struct immediate *im = ctx->input;   
+
+   if (!n) 
       return;
-   }
+   
 
    /* Do some easy optimizations of the cassette.  
     */
-   if (im->v.Obj.size < 4 && im->Count > 15) {
+#if 0
+   if (0 && im->v.Obj.size < 4 && im->Count > 15) {
       im->Bounds = (GLfloat (*)[3]) MALLOC(6 * sizeof(GLfloat));
       (gl_calc_bound_tab[im->v.Obj.size])( im->Bounds, &im->v.Obj );
    }
+#endif
 
    n[1].data = (void *)im;   
-   SET_IMMEDIATE( ctx, new_im );
+   n[2].ui = im->Start;
+   n[3].ui = im->Count;
+   n[4].ui = im->BeginState;
+   n[5].ui = im->OrFlag;
+   n[6].ui = im->AndFlag;
+   n[7].ui = im->LastData;
+   n[8].ui = im->LastPrimitive;
+
+   if (im->Count > VB_MAX - 4) {
+
+      struct immediate *new_im = gl_immediate_alloc(ctx);      
+      if (!new_im) return;
+      SET_IMMEDIATE( ctx, new_im );
+      gl_reset_input( ctx );
+
+   } else {
+      im->Count++;;
+      im->Start = im->Count;   /* don't clear anything in reset_input */
+      im->ref_count++;
+
+      im->Primitive[im->Start] = ctx->Current.Primitive;
+      im->LastPrimitive = im->Start;
+      im->BeginState = VERT_BEGIN_0;
+      im->OrFlag = 0;
+      im->AndFlag = ~0;
+
+      if (0)
+        fprintf(stderr, "in compile_cassette, BeginState is %x\n", 
+             im->BeginState);
+   }   
 }
 
 /* KW: Compile commands  
@@ -2455,7 +2481,9 @@ static void execute_list( GLcontext *ctx, GLuint list )
          case OPCODE_ERROR:
            gl_error( ctx, n[1].e, (const char *) n[2].data ); 
             break;
-         case OPCODE_VERTEX_CASSETTE:
+         case OPCODE_VERTEX_CASSETTE: {
+           struct immediate *IM;
+
            if (ctx->NewState)
               gl_update_state(ctx);
            if (ctx->CompileCVAFlag) {
@@ -2465,13 +2493,29 @@ static void execute_list( GLcontext *ctx, GLuint list )
            if (!ctx->CVA.elt.pipeline_valid)
               gl_build_immediate_pipeline( ctx );
 
+           
+           IM = (struct immediate *) n[1].data;
+           IM->Start = n[2].ui;
+           IM->Count = n[3].ui;
+           IM->BeginState = n[4].ui;
+           IM->OrFlag = n[5].ui;
+           IM->AndFlag = n[6].ui;
+           IM->LastData = n[7].ui;
+           IM->LastPrimitive = n[8].ui;
+
            if ((MESA_VERBOSE & VERBOSE_DISPLAY_LIST) &&
                (MESA_VERBOSE & VERBOSE_IMMEDIATE))
               gl_print_cassette( (struct immediate *) n[1].data, 0, ~0 );
 
+           if (0)
+              fprintf(stderr, "Run cassette %d, rows %d..%d, beginstate %x\n",
+                      IM->id,
+                      IM->Start, IM->Count, IM->BeginState);
+
            gl_fixup_cassette( ctx, (struct immediate *) n[1].data ); 
            gl_execute_cassette( ctx, (struct immediate *) n[1].data ); 
             break;
+        }
          case OPCODE_ACCUM:
            gl_Accum( ctx, n[1].e, n[2].f );
            break;
@@ -3089,7 +3133,9 @@ void gl_EndList( GLcontext *ctx )
 
    /* KW: Put back the old input pointer.
     */
-   FREE( ctx->input );
+   if (--ctx->input->ref_count == 0)
+      gl_immediate_free( ctx->input );
+
    SET_IMMEDIATE( ctx, ctx->VB->IM );
    gl_reset_input( ctx );
 
@@ -3459,6 +3505,13 @@ static void print_list( GLcontext *ctx, FILE *f, GLuint list )
          case OPCODE_TRANSLATE:
             fprintf(f,"Translate %g %g %g\n", n[1].f, n[2].f, n[3].f );
             break;
+         case OPCODE_BIND_TEXTURE:
+           fprintf(f,"BindTexture %s %d\n", gl_lookup_enum_by_nr(n[1].ui), 
+                   n[2].ui);
+           break;
+         case OPCODE_SHADE_MODEL:
+           fprintf(f,"ShadeModel %s\n", gl_lookup_enum_by_nr(n[1].ui)); 
+           break;
 
         /*
          * meta opcodes/commands
@@ -3467,9 +3520,12 @@ static void print_list( GLcontext *ctx, FILE *f, GLuint list )
             fprintf(f,"Error: %s %s\n", enum_string(n[1].e), (const char *)n[2].data );
             break;
         case OPCODE_VERTEX_CASSETTE:
-            fprintf(f,"VERTEX-CASSETTE, id %u, %u elements\n", 
+            fprintf(f,"VERTEX-CASSETTE, id %u, rows %u..%u\n", 
                    ((struct immediate *) n[1].data)->id,
-                   ((struct immediate *) n[1].data)->Count - VB_START );
+                   n[2].ui,
+                   n[3].ui);
+/*         gl_print_cassette( (struct immediate *) n[1].data, */
+/*                            0, ~0 ); */
            break;
         case OPCODE_CONTINUE:
             fprintf(f,"DISPLAY-LIST-CONTINUE\n");
@@ -3512,5 +3568,5 @@ static void print_list( GLcontext *ctx, FILE *f, GLuint list )
 void mesa_print_display_list( GLuint list )
 {
    GET_CONTEXT;
-   print_list( CC, stdout, list );
+   print_list( CC, stderr, list );
 }
index 18676e7..eee7a84 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: eval.c,v 1.4 1999/10/13 18:42:50 brianp Exp $ */
+/* $Id: eval.c,v 1.5 1999/10/19 18:37:03 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -1990,12 +1990,13 @@ void gl_GetMapiv( GLcontext* ctx, GLenum target, GLenum query, GLint *v )
 
 
 static void eval_points1( GLfloat outcoord[][4], 
-                  GLfloat coord[][4],
-                  const GLuint *flags,
-                  GLfloat du, GLfloat u1 )
+                         GLfloat coord[][4],
+                         const GLuint *flags,
+                         GLuint start,
+                         GLfloat du, GLfloat u1 )
 {
    GLuint i;
-   for (i = VB_START ; !(flags[i] & VERT_END_VB) ; i++)
+   for (i = start ; !(flags[i] & VERT_END_VB) ; i++)
       if (flags[i] & VERT_EVAL_P1) 
         outcoord[i][0] = coord[i][0] * du + u1;
       else if (flags[i] & VERT_EVAL_ANY) {
@@ -2005,13 +2006,14 @@ static void eval_points1( GLfloat outcoord[][4],
 }
 
 static void eval_points2( GLfloat outcoord[][4], 
-                  GLfloat coord[][4],
-                  const GLuint *flags,
-                  GLfloat du, GLfloat u1,
-                  GLfloat dv, GLfloat v1 )
+                         GLfloat coord[][4],
+                         const GLuint *flags,
+                         GLuint start,
+                         GLfloat du, GLfloat u1,
+                         GLfloat dv, GLfloat v1 )
 {
    GLuint i;
-   for (i = VB_START ; !(flags[i] & VERT_END_VB) ; i++)
+   for (i = start ; !(flags[i] & VERT_END_VB) ; i++)
       if (flags[i] & VERT_EVAL_P2) {
         outcoord[i][0] = coord[i][0] * du + u1;
         outcoord[i][1] = coord[i][1] * dv + v1;
@@ -2033,7 +2035,8 @@ static const GLubyte dirty_flags[5] = {
 
 static GLvector4f *eval1_4f( GLvector4f *dest, 
                             GLfloat coord[][4], 
-                            const GLuint *flags, 
+                            const GLuint *flags,
+                            GLuint start,
                             GLuint dimension,
                             struct gl_1d_map *map )
 {
@@ -2042,7 +2045,7 @@ static GLvector4f *eval1_4f( GLvector4f *dest,
    GLfloat (*to)[4] = dest->data;
    GLuint i;
    
-   for (i = VB_START ; !(flags[i] & VERT_END_VB) ; i++)
+   for (i = start ; !(flags[i] & VERT_END_VB) ; i++)
       if (flags[i] & (VERT_EVAL_C1|VERT_EVAL_P1)) {
         GLfloat u = (coord[i][0] - u1) * du;
         ASSIGN_4V(to[i], 0,0,0,1);
@@ -2050,6 +2053,7 @@ static GLvector4f *eval1_4f( GLvector4f *dest,
       }
 
    dest->count = i;
+   dest->start = VEC_ELT(dest, GLfloat, start);
    dest->size = MAX2(dest->size, dimension);
    dest->flags |= dirty_flags[dimension];
    return dest;
@@ -2058,7 +2062,8 @@ static GLvector4f *eval1_4f( GLvector4f *dest,
 
 static GLvector1ui *eval1_1ui( GLvector1ui *dest, 
                               GLfloat coord[][4], 
-                              const GLuint *flags, 
+                              const GLuint *flags,
+                              GLuint start,
                               struct gl_1d_map *map )
 {
    const GLfloat u1 = map->u1;
@@ -2066,7 +2071,7 @@ static GLvector1ui *eval1_1ui( GLvector1ui *dest,
    GLuint *to = dest->data;
    GLuint i;
 
-   for (i = VB_START ; !(flags[i] & VERT_END_VB) ; i++)
+   for (i = start ; !(flags[i] & VERT_END_VB) ; i++)
       if (flags[i] & (VERT_EVAL_C1|VERT_EVAL_P1)) {
         GLfloat u = (coord[i][0] - u1) * du;
         GLfloat tmp;
@@ -2074,42 +2079,46 @@ static GLvector1ui *eval1_1ui( GLvector1ui *dest,
         to[i] = (GLuint) (GLint) tmp;
       }
 
+   dest->start = VEC_ELT(dest, GLuint, start);
    dest->count = i;
    return dest;
 }
 
 static GLvector3f *eval1_norm( GLvector3f *dest, 
-                       GLfloat coord[][4],
-                       GLuint *flags, /* not const */
-                       struct gl_1d_map *map )
+                              GLfloat coord[][4],
+                              GLuint *flags, /* not const */
+                              GLuint start,
+                              struct gl_1d_map *map )
 {
    const GLfloat u1 = map->u1;
    const GLfloat du = map->du;
    GLfloat (*to)[3] = dest->data;
    GLuint i;
 
-   for (i = VB_START ; !(flags[i] & VERT_END_VB) ; i++)
+   for (i = start ; !(flags[i] & VERT_END_VB) ; i++)
       if (flags[i] & (VERT_EVAL_C1|VERT_EVAL_P1)) {
         GLfloat u = (coord[i][0] - u1) * du;
         horner_bezier_curve(map->Points, to[i], u, 3, map->Order);
         flags[i+1] |= VERT_NORM; /* reset */
       }
 
+   dest->start = VEC_ELT(dest, GLfloat, start);
    dest->count = i;
    return dest;
 }
 
 static GLvector4ub *eval1_color( GLvector4ub *dest, 
-                         GLfloat coord[][4],
-                         GLuint *flags, /* not const */
-                         struct gl_1d_map *map )
+                                GLfloat coord[][4],
+                                GLuint *flags, /* not const */
+                                GLuint start,
+                                struct gl_1d_map *map )
 {   
    const GLfloat u1 = map->u1;
    const GLfloat du = map->du;
    GLubyte (*to)[4] = dest->data;
    GLuint i;
 
-   for (i = VB_START ; !(flags[i] & VERT_END_VB) ; i++)
+   for (i = start ; !(flags[i] & VERT_END_VB) ; i++)
       if (flags[i] & (VERT_EVAL_C1|VERT_EVAL_P1)) {
         GLfloat u = (coord[i][0] - u1) * du;
         GLfloat fcolor[4];
@@ -2118,6 +2127,7 @@ static GLvector4ub *eval1_color( GLvector4ub *dest,
         flags[i+1] |= VERT_RGBA; /* reset */
       }
 
+   dest->start = VEC_ELT(dest, GLubyte, start);
    dest->count = i;
    return dest;
 }
@@ -2129,6 +2139,7 @@ static GLvector4f *eval2_obj_norm( GLvector4f *obj_ptr,
                                   GLvector3f *norm_ptr,
                                   GLfloat coord[][4], 
                                   GLuint *flags, 
+                                  GLuint start,
                                   GLuint dimension,
                                   struct gl_2d_map *map )
 {
@@ -2140,7 +2151,7 @@ static GLvector4f *eval2_obj_norm( GLvector4f *obj_ptr,
    GLfloat (*normal)[3] = norm_ptr->data;
    GLuint i;
    
-   for (i = VB_START ; !(flags[i] & VERT_END_VB) ; i++)
+   for (i = start ; !(flags[i] & VERT_END_VB) ; i++)
       if (flags[i] & (VERT_EVAL_C2|VERT_EVAL_P2)) {
         GLfloat u = (coord[i][0] - u1) * du;
         GLfloat v = (coord[i][1] - v1) * dv;
@@ -2155,6 +2166,7 @@ static GLvector4f *eval2_obj_norm( GLvector4f *obj_ptr,
         flags[i+1] |= VERT_NORM;
       }
  
+   obj_ptr->start = VEC_ELT(obj_ptr, GLfloat, start);
    obj_ptr->count = i;
    obj_ptr->size = MAX2(obj_ptr->size, dimension);
    obj_ptr->flags |= dirty_flags[dimension];
@@ -2164,7 +2176,8 @@ static GLvector4f *eval2_obj_norm( GLvector4f *obj_ptr,
 
 static GLvector4f *eval2_4f( GLvector4f *dest, 
                             GLfloat coord[][4], 
-                            const GLuint *flags, 
+                            const GLuint *flags,
+                            GLuint start,
                             GLuint dimension,
                             struct gl_2d_map *map )
 {
@@ -2175,7 +2188,7 @@ static GLvector4f *eval2_4f( GLvector4f *dest,
    GLfloat (*to)[4] = dest->data;
    GLuint i;
 
-   for (i = VB_START ; !(flags[i] & VERT_END_VB) ; i++)
+   for (i = start ; !(flags[i] & VERT_END_VB) ; i++)
       if (flags[i] & (VERT_EVAL_C2|VERT_EVAL_P2)) {
         GLfloat u = (coord[i][0] - u1) * du;
         GLfloat v = (coord[i][1] - v1) * dv;
@@ -2183,6 +2196,7 @@ static GLvector4f *eval2_4f( GLvector4f *dest,
                            map->Uorder, map->Vorder);
       }
 
+   dest->start = VEC_ELT(dest, GLfloat, start);
    dest->count = i;
    dest->size = MAX2(dest->size, dimension);
    dest->flags |= dirty_flags[dimension];
@@ -2193,6 +2207,7 @@ static GLvector4f *eval2_4f( GLvector4f *dest,
 static GLvector3f *eval2_norm( GLvector3f *dest, 
                               GLfloat coord[][4], 
                               GLuint *flags, 
+                              GLuint start,
                               struct gl_2d_map *map )
 {
    const GLfloat u1 = map->u1;
@@ -2202,7 +2217,7 @@ static GLvector3f *eval2_norm( GLvector3f *dest,
    GLfloat (*to)[3] = dest->data;
    GLuint i;
 
-   for (i = VB_START ; !(flags[i] & VERT_END_VB) ; i++)
+   for (i = start ; !(flags[i] & VERT_END_VB) ; i++)
       if (flags[i] & (VERT_EVAL_C2|VERT_EVAL_P2)) {
         GLfloat u = (coord[i][0] - u1) * du;
         GLfloat v = (coord[i][1] - v1) * dv;
@@ -2211,6 +2226,7 @@ static GLvector3f *eval2_norm( GLvector3f *dest,
         flags[i+1] |= VERT_NORM; /* reset */
      }
 
+   dest->start = VEC_ELT(dest, GLfloat, start);
    dest->count = i;
    return dest;
 }
@@ -2218,7 +2234,8 @@ static GLvector3f *eval2_norm( GLvector3f *dest,
 
 static GLvector1ui *eval2_1ui( GLvector1ui *dest, 
                               GLfloat coord[][4], 
-                              const GLuint *flags, 
+                              const GLuint *flags,
+                              GLuint start,
                               struct gl_2d_map *map )
 {
    const GLfloat u1 = map->u1;
@@ -2228,7 +2245,7 @@ static GLvector1ui *eval2_1ui( GLvector1ui *dest,
    GLuint *to = dest->data;
    GLuint i;
 
-   for (i = VB_START ; !(flags[i] & VERT_END_VB) ; i++)
+   for (i = start ; !(flags[i] & VERT_END_VB) ; i++)
       if (flags[i] & (VERT_EVAL_C2|VERT_EVAL_P2)) {
         GLfloat u = (coord[i][0] - u1) * du;
         GLfloat v = (coord[i][1] - v1) * dv;
@@ -2239,6 +2256,7 @@ static GLvector1ui *eval2_1ui( GLvector1ui *dest,
         to[i] = (GLuint) (GLint) tmp;
       }
 
+   dest->start = VEC_ELT(dest, GLuint, start);
    dest->count = i;
    return dest;
 }
@@ -2248,6 +2266,7 @@ static GLvector1ui *eval2_1ui( GLvector1ui *dest,
 static GLvector4ub *eval2_color( GLvector4ub *dest,
                                 GLfloat coord[][4], 
                                 GLuint *flags,
+                                GLuint start,
                                 struct gl_2d_map *map )
 {
    const GLfloat u1 = map->u1;
@@ -2257,7 +2276,7 @@ static GLvector4ub *eval2_color( GLvector4ub *dest,
    GLubyte (*to)[4] = dest->data;
    GLuint i;
 
-   for (i = VB_START ; !(flags[i] & VERT_END_VB) ; i++)
+   for (i = start ; !(flags[i] & VERT_END_VB) ; i++)
       if (flags[i] & (VERT_EVAL_C2|VERT_EVAL_P2)) {
         GLfloat u = (coord[i][0] - u1) * du;
         GLfloat v = (coord[i][1] - v1) * dv;
@@ -2268,64 +2287,75 @@ static GLvector4ub *eval2_color( GLvector4ub *dest,
         flags[i+1] |= VERT_RGBA; /* reset */
       }
 
+   dest->start = VEC_ELT(dest, GLubyte, start);
    dest->count = i;
    return dest;
 }
 
 
 static GLvector4f *copy_4f( GLvector4f *out, CONST GLvector4f *in, 
-                           const GLuint *flags)
+                           const GLuint *flags,
+                           GLuint start )
 {
    GLfloat (*to)[4] = out->data;
    GLfloat (*from)[4] = in->data;
    GLuint i;
    
-   for ( i = VB_START ; !(flags[i] & VERT_END_VB) ; i++) 
+   for ( i = start ; !(flags[i] & VERT_END_VB) ; i++) 
       if (!(flags[i] & VERT_EVAL_ANY)) 
         COPY_4FV( to[i], from[i] );
    
+   out->start = VEC_ELT(out, GLfloat, start);
    return out;
 }
 
 static GLvector3f *copy_3f( GLvector3f *out, CONST GLvector3f *in, 
-                           const GLuint *flags)
+                           const GLuint *flags,
+                           GLuint start )
 {
    GLfloat (*to)[3] = out->data;
    GLfloat (*from)[3] = in->data;
    GLuint i;
    
-   for ( i = VB_START ; !(flags[i] & VERT_END_VB) ; i++) 
+   for ( i = start ; !(flags[i] & VERT_END_VB) ; i++) 
       if (!(flags[i] & VERT_EVAL_ANY)) 
         COPY_3V( to[i], from[i] );
    
+   out->start = VEC_ELT(out, GLfloat, start);
    return out;
 }
 
-static GLvector4ub *copy_4ub( GLvector4ub *out, CONST GLvector4ub *in, 
-                             const GLuint *flags )
+static GLvector4ub *copy_4ub( GLvector4ub *out, 
+                             CONST GLvector4ub *in, 
+                             const GLuint *flags,
+                             GLuint start )
 {
    GLubyte (*to)[4] = out->data;
    GLubyte (*from)[4] = in->data;
    GLuint i;
    
-   for ( i = VB_START ; !(flags[i] & VERT_END_VB) ; i++) 
+   for ( i = start ; !(flags[i] & VERT_END_VB) ; i++) 
       if (!(flags[i] & VERT_EVAL_ANY)) 
         COPY_4UBV( to[i], from[i] );
 
+   out->start = VEC_ELT(out, GLubyte, start);
    return out;
 }
 
-static GLvector1ui *copy_1ui( GLvector1ui *out, CONST GLvector1ui *in, 
-                             const GLuint *flags )
+static GLvector1ui *copy_1ui( GLvector1ui *out, 
+                             CONST GLvector1ui *in, 
+                             const GLuint *flags,
+                             GLuint start )
 {
    GLuint *to = out->data;
    CONST GLuint *from = in->data;
    GLuint i;
    
-   for ( i = VB_START ; !(flags[i] & VERT_END_VB) ; i++) 
+   for ( i = start ; !(flags[i] & VERT_END_VB) ; i++) 
       if (!(flags[i] & VERT_EVAL_ANY)) 
         to[i] = from[i];
 
+   out->start = VEC_ELT(out, GLuint, start);
    return out;
 }
 
@@ -2354,7 +2384,7 @@ void gl_eval_vb( struct vertex_buffer *VB )
 
    GLuint any_eval1 = VB->OrFlag & (VERT_EVAL_C1|VERT_EVAL_P1);
    GLuint any_eval2 = VB->OrFlag & (VERT_EVAL_C2|VERT_EVAL_P2);
-   GLuint all_eval = VB->AndFlag & VERT_EVAL_ANY;
+   GLuint all_eval = IM->AndFlag & VERT_EVAL_ANY;
 
    /* Handle the degenerate cases.
     */
@@ -2379,7 +2409,7 @@ void gl_eval_vb( struct vertex_buffer *VB )
     * work on useful changes.
     */
    if (VB->PurgeFlags) {
-      if (!any_eval1 && !any_eval2 && all_eval) VB->Count = VB_START;
+      if (!any_eval1 && !any_eval2 && all_eval) VB->Count = VB->Start;
       gl_purge_vertices( VB );
       if (!any_eval1 && !any_eval2) return;
    } else
@@ -2389,7 +2419,7 @@ void gl_eval_vb( struct vertex_buffer *VB )
     */
    if (any_eval1 && (VB->OrFlag & VERT_EVAL_P1)) 
    {
-      eval_points1( IM->Obj, coord, flags, 
+      eval_points1( IM->Obj, coord, flags, IM->Start,
                    ctx->Eval.MapGrid1du,
                    ctx->Eval.MapGrid1u1);
 
@@ -2398,7 +2428,7 @@ void gl_eval_vb( struct vertex_buffer *VB )
 
    if (any_eval2 && (VB->OrFlag & VERT_EVAL_P2)) 
    {
-      eval_points2( IM->Obj, coord, flags, 
+      eval_points2( IM->Obj, coord, flags, IM->Start,
                    ctx->Eval.MapGrid2du,
                    ctx->Eval.MapGrid2u1,
                    ctx->Eval.MapGrid2dv,
@@ -2415,17 +2445,17 @@ void gl_eval_vb( struct vertex_buffer *VB )
       GLvector1ui  *out_index = &IM->v.Index;
 
       if (ctx->Eval.Map1Index && any_eval1) 
-        VB->IndexPtr = eval1_1ui( out_index, coord, flags, 
+        VB->IndexPtr = eval1_1ui( out_index, coord, flags, IM->Start,
                                   &ctx->EvalMap.Map1Index );
       
       if (ctx->Eval.Map2Index && any_eval2)
-        VB->IndexPtr = eval2_1ui( out_index, coord, flags, 
+        VB->IndexPtr = eval2_1ui( out_index, coord, flags, IM->Start,
                                   &ctx->EvalMap.Map2Index );
         
       if (VB->IndexPtr != in_index) {
         new_flags |= VERT_INDEX;
         if (!all_eval)
-           VB->IndexPtr = copy_1ui( out_index, in_index, flags );
+           VB->IndexPtr = copy_1ui( out_index, in_index, flags, IM->Start );
       }
    }
 
@@ -2435,17 +2465,17 @@ void gl_eval_vb( struct vertex_buffer *VB )
       GLvector4ub  *out_color = &IM->v.Color;
 
       if (ctx->Eval.Map1Color4 && any_eval1) 
-        VB->ColorPtr = eval1_color( out_color, coord, flags, 
+        VB->ColorPtr = eval1_color( out_color, coord, flags, IM->Start,
                                   &ctx->EvalMap.Map1Color4 );
       
       if (ctx->Eval.Map2Color4 && any_eval2)
-        VB->ColorPtr = eval2_color( out_color, coord, flags, 
+        VB->ColorPtr = eval2_color( out_color, coord, flags, IM->Start,
                                     &ctx->EvalMap.Map2Color4 );
         
       if (VB->ColorPtr != in_color) {
         new_flags |= VERT_RGBA;
         if (!all_eval)
-           VB->ColorPtr = copy_4ub( out_color, in_color, flags );
+           VB->ColorPtr = copy_4ub( out_color, in_color, flags, IM->Start );
       }
 
       VB->Color[0] = VB->Color[1] = VB->ColorPtr;
@@ -2458,17 +2488,17 @@ void gl_eval_vb( struct vertex_buffer *VB )
       GLvector3f  *out_normal = &IM->v.Normal;
 
       if (ctx->Eval.Map1Normal && any_eval1) 
-        VB->NormalPtr = eval1_norm( out_normal, coord, flags, 
+        VB->NormalPtr = eval1_norm( out_normal, coord, flags, IM->Start,
                                     &ctx->EvalMap.Map1Normal );
       
       if (ctx->Eval.Map2Normal && any_eval2)
-        VB->NormalPtr = eval2_norm( out_normal, coord, flags, 
+        VB->NormalPtr = eval2_norm( out_normal, coord, flags, IM->Start,
                                     &ctx->EvalMap.Map2Normal );
         
       if (VB->NormalPtr != in_normal) {
         new_flags |= VERT_NORM;
         if (!all_eval)
-           VB->NormalPtr = copy_3f( out_normal, in_normal, flags );
+           VB->NormalPtr = copy_3f( out_normal, in_normal, flags, IM->Start );
       }
    }
 
@@ -2481,30 +2511,38 @@ void gl_eval_vb( struct vertex_buffer *VB )
 
       if (any_eval1) {
         if (ctx->Eval.Map1TextureCoord4) 
-           tc = eval1_4f( out, coord, flags, 4, &ctx->EvalMap.Map1Texture4);
+           tc = eval1_4f( out, coord, flags, IM->Start, 
+                          4, &ctx->EvalMap.Map1Texture4);
         else if (ctx->Eval.Map1TextureCoord3) 
-           tc = eval1_4f( out, coord, flags, 3, &ctx->EvalMap.Map1Texture3);
+           tc = eval1_4f( out, coord, flags, IM->Start, 3,
+                          &ctx->EvalMap.Map1Texture3);
         else if (ctx->Eval.Map1TextureCoord2) 
-           tc = eval1_4f( out, coord, flags, 2, &ctx->EvalMap.Map1Texture2);
+           tc = eval1_4f( out, coord, flags, IM->Start, 2,
+                          &ctx->EvalMap.Map1Texture2);
         else if (ctx->Eval.Map1TextureCoord1) 
-           tc = eval1_4f( out, coord, flags, 1, &ctx->EvalMap.Map1Texture1);
+           tc = eval1_4f( out, coord, flags, IM->Start, 1,
+                          &ctx->EvalMap.Map1Texture1);
       }
 
       if (any_eval2) {
         if (ctx->Eval.Map2TextureCoord4) 
-           tc = eval2_4f( out, coord, flags, 4, &ctx->EvalMap.Map2Texture4);
+           tc = eval2_4f( out, coord, flags, IM->Start,
+                          4, &ctx->EvalMap.Map2Texture4);
         else if (ctx->Eval.Map2TextureCoord3) 
-           tc = eval2_4f( out, coord, flags, 3, &ctx->EvalMap.Map2Texture3);
+           tc = eval2_4f( out, coord, flags, IM->Start,
+                          3, &ctx->EvalMap.Map2Texture3);
         else if (ctx->Eval.Map2TextureCoord2) 
-           tc = eval2_4f( out, coord, flags, 2, &ctx->EvalMap.Map2Texture2);
+           tc = eval2_4f( out, coord, flags, IM->Start,
+                          2, &ctx->EvalMap.Map2Texture2);
         else if (ctx->Eval.Map2TextureCoord1) 
-           tc = eval2_4f( out, coord, flags, 1, &ctx->EvalMap.Map2Texture1);
+           tc = eval2_4f( out, coord, flags, IM->Start,
+                          1, &ctx->EvalMap.Map2Texture1);
       }
 
       if (tc != in) {
         new_flags |= VERT_TEX_ANY(0); /* fix for sizes.. */
         if (!all_eval)
-           tc = copy_4f( out, in, flags );
+           tc = copy_4f( out, in, flags, IM->Start );
       }
 
       VB->TexCoordPtr[0] = tc;
@@ -2518,34 +2556,36 @@ void gl_eval_vb( struct vertex_buffer *VB )
    
       if (any_eval1) {
         if (ctx->Eval.Map1Vertex4) 
-           obj = eval1_4f( out, coord, flags, 4, &ctx->EvalMap.Map1Vertex4);
+           obj = eval1_4f( out, coord, flags, IM->Start,
+                           4, &ctx->EvalMap.Map1Vertex4);
         else 
-           obj = eval1_4f( out, coord, flags, 3, &ctx->EvalMap.Map1Vertex3);
+           obj = eval1_4f( out, coord, flags, IM->Start,
+                           3, &ctx->EvalMap.Map1Vertex3);
       }
 
       if (any_eval2) {
         if (ctx->Eval.Map2Vertex4) 
         {
            if (ctx->Eval.AutoNormal && (req & VERT_NORM)) 
-              obj = eval2_obj_norm( out, VB->NormalPtr, coord, flags, 4,
-                                   &ctx->EvalMap.Map2Vertex4 );
+              obj = eval2_obj_norm( out, VB->NormalPtr, coord, flags, IM->Start,
+                                    4, &ctx->EvalMap.Map2Vertex4 );
            else
-              obj = eval2_4f( out, coord, flags, 4, 
-                              &ctx->EvalMap.Map2Vertex4);
+              obj = eval2_4f( out, coord, flags, IM->Start,
+                              4, &ctx->EvalMap.Map2Vertex4);
         }
         else if (ctx->Eval.Map2Vertex3) 
         {
            if (ctx->Eval.AutoNormal && (req & VERT_NORM)) 
-              obj = eval2_obj_norm( out, VB->NormalPtr, coord, flags, 3,
-                                   &ctx->EvalMap.Map2Vertex3 );
+              obj = eval2_obj_norm( out, VB->NormalPtr, coord, flags, IM->Start,
+                                    3, &ctx->EvalMap.Map2Vertex3 );
            else
-              obj = eval2_4f( out, coord, flags, 3, 
-                              &ctx->EvalMap.Map2Vertex3 );
+              obj = eval2_4f( out, coord, flags, IM->Start,
+                              3, &ctx->EvalMap.Map2Vertex3 );
         }
       }
 
       if (obj != in && !all_eval)
-        obj = copy_4f( out, in, flags );
+        obj = copy_4f( out, in, flags, IM->Start );
 
       VB->ObjPtr = obj;
    }
@@ -2564,7 +2604,6 @@ void gl_eval_vb( struct vertex_buffer *VB )
       if (all_eval) {
         for (i = 0 ; i < count ; i++) 
            flags[i] = oldflags[i] | new_flags;
-        VB->AndFlag |= new_flags; 
       } else {
         GLuint andflag = ~0;
         for (i = 0 ; i < count ; i++) {
@@ -2572,7 +2611,6 @@ void gl_eval_vb( struct vertex_buffer *VB )
               flags[i] = oldflags[i] | new_flags;
            andflag &= flags[i];
         }
-        VB->AndFlag = andflag;
       }
    }
 }
index a9a125b..966b548 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: light.c,v 1.4 1999/10/08 09:27:11 keithw Exp $ */
+/* $Id: light.c,v 1.5 1999/10/19 18:37:04 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -664,14 +664,22 @@ void gl_Materialfv( GLcontext *ctx,
    IM = ctx->input;
    count = IM->Count;
 
+   if (!IM->Material) {
+      IM->Material = 
+        (struct gl_material (*)[2]) MALLOC( sizeof(struct gl_material) * 
+                                            VB_SIZE * 2 );
+      IM->MaterialMask = (GLuint *) MALLOC( sizeof(GLuint) * VB_SIZE );
+   }
+
+
    if (!(IM->Flag[count] & VERT_MATERIAL)) {
       IM->Flag[count] |= VERT_MATERIAL;
-      IM->MaterialMask[count] = 0;
+      IM->MaterialMask[count] = 0;      
    }
 
+
    IM->MaterialMask[count] |= bitmask;
    mat = IM->Material[count];
-   IM->LastMaterial = count;
 
    if (bitmask & FRONT_AMBIENT_BIT) {
       COPY_4FV( mat[0].Ambient, params );
index f11ce2d..5756419 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: varray.c,v 1.4 1999/10/08 09:27:11 keithw Exp $ */
+/* $Id: varray.c,v 1.5 1999/10/19 18:37:05 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -403,15 +403,21 @@ void gl_CVAEltPointer( GLcontext *ctx, GLenum type, const GLvoid *ptr )
 /* 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.
+ *
+ * KW: Have to do this after each glEnd if cva isn't active.  (also
+ *     have to do it after each full buffer)
  */
-void gl_exec_array_elements( GLcontext *ctx, struct immediate *IM )
+void gl_exec_array_elements( GLcontext *ctx, struct immediate *IM,
+                            GLuint start, 
+                            GLuint count)
 {
    GLuint *flags = IM->Flag;
    GLuint *elts = IM->Elt;
-   GLuint count = IM->Count;
-   GLuint start = IM->Start;
    GLuint translate = ctx->Array.Flags;
    GLuint i;
+
+   if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
+      fprintf(stderr, "exec_array_elements %d .. %d\n", start, count);
    
    if (translate & VERT_OBJ_ANY) 
       (ctx->Array.VertexEltFunc)( IM->Obj, 
@@ -455,22 +461,16 @@ void gl_exec_array_elements( GLcontext *ctx, struct immediate *IM )
                                       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++) 
+/*     fprintf(stderr, "start %d count %d\n", start, count); */
+/*     gl_print_vert_flags("translate", translate); */
+
+   for (i = start ; i < count ; i++) 
+      if (flags[i] & VERT_ELT) {
+/*      flags[i] &= ~VERT_ELT; */
         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;
-   }
+      }      
 }
 
 
@@ -762,7 +762,6 @@ void gl_DrawArrays( GLcontext *ctx, GLenum mode, GLint start, GLsizei count )
         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;
@@ -777,7 +776,6 @@ void gl_DrawArrays( GLcontext *ctx, GLenum mode, GLint start, GLsizei 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;
@@ -839,19 +837,19 @@ static void FUNC( GLcontext *ctx, GLenum mode,            \
       GLuint nr = MIN2( VB_MAX, count - j + VB_START );        \
       struct immediate *IM = ctx->input;               \
       GLuint sf = IM->Flag[VB_START];                  \
+      IM->FlushElt |= IM->ArrayEltFlush;               \
                                                        \
       for (i = VB_START ; i < nr ; i++) {              \
         IM->Elt[i] = (GLuint) *indices++;              \
         IM->Flag[i] = VERT_ELT;                        \
       }                                                        \
                                                        \
-      if (j == 0) IM->Flag[VB_START] |= sf;            \
+      if (j == 0) IM->Flag[IM->Start] |= sf;           \
                                                        \
       IM->Count = nr;                                  \
       j += nr - VB_START;                              \
                                                        \
       if (j == count) gl_End( ctx );                   \
-                                                       \
       IM->maybe_transform_vb( IM );                    \
    }                                                   \
 }
@@ -894,8 +892,9 @@ void GLAPIENTRY glDrawElements(CTX_ARG GLenum mode, GLsizei count,
    cva = &ctx->CVA;
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDrawElements");
 
-   if (count<0) {
-      gl_error( ctx, GL_INVALID_VALUE, "glDrawElements(count)" );
+   if (count <= 0) {
+      if (count < 0)
+        gl_error( ctx, GL_INVALID_VALUE, "glDrawElements(count)" );
       return;
    }
 
index 3085c42..88cedb4 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: varray.h,v 1.3 1999/10/08 09:27:11 keithw Exp $ */
+/* $Id: varray.h,v 1.4 1999/10/19 18:37:05 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -99,7 +99,9 @@ extern void gl_save_DrawRangeElements( GLcontext *ctx, GLenum mode,
 
 
 extern void gl_exec_array_elements( GLcontext *ctx, 
-                                   struct immediate *IM );
+                                   struct immediate *IM,
+                                   GLuint start, 
+                                   GLuint end );
 
 extern void gl_update_client_state( GLcontext *ctx );
 
index f91a90b..212b6bf 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: 3dnow.c,v 1.1 1999/08/19 00:55:42 jtg Exp $ */
+/* $Id: 3dnow.c,v 1.2 1999/10/19 18:37:06 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -40,6 +40,7 @@
 #include "context.h"
 #include "types.h"
 #include "xform.h"
+#include "vertices.h"
 
 #ifdef DEBUG
 #include "debug_xform.h"
       gl_##pfx##_transform_normalize_normals_no_rot_##masked##;
 
 
+extern void gl_3dnow_project_vertices( GLfloat *first,
+                                      GLfloat *last,
+                                      const GLfloat *m,
+                                      GLuint stride );
 
+extern void gl_3dnow_project_clipped_vertices( GLfloat *first,
+                                              GLfloat *last,
+                                              const GLfloat *m,
+                                              GLuint stride,
+                                              const GLubyte *clipmask );
+
+extern void gl_v16_3dnow_general_xform( GLfloat *first_vert,
+                                       const GLfloat *m,
+                                       const GLfloat *src,
+                                       GLuint src_stride,
+                                       GLuint count );
 
 void gl_init_3dnow_asm_transforms (void)
 {
@@ -162,6 +178,12 @@ void gl_init_3dnow_asm_transforms (void)
    gl_test_all_transform_functions("3Dnow!");
    gl_test_all_normal_transform_functions("3Dnow!");
 #endif
+
+   /* Hook in some stuff for vertices.c.
+    */
+   gl_xform_points3_v16_general = gl_v16_3dnow_general_xform;
+   gl_project_v16 = gl_3dnow_project_vertices;
+   gl_project_clipped_v16 = gl_3dnow_project_clipped_vertices;
 } 
 
 #endif
index fe3bb34..610ec15 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: x86.c,v 1.1 1999/08/19 00:55:42 jtg Exp $ */
+/* $Id: x86.c,v 1.2 1999/10/19 18:37:07 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
 
 #include "context.h"
 #include "types.h"
+#include "vertices.h"
 #include "xform.h"
 #include "x86.h"
 
+extern void gl_v16_x86_cliptest_points4(GLfloat *first_vert,
+                                       GLfloat *last_vert,
+                                       GLubyte *or_mask,
+                                       GLubyte *and_mask,
+                                       GLubyte *clip_mask );
+
+  
+extern void gl_v16_x86_general_xform(GLfloat *dest,
+                                    const GLfloat *m,
+                                    const GLfloat *src,
+                                    GLuint src_stride,
+                                    GLuint count);
+
 
 
 #define XFORM_ARGS     GLvector4f *to_vec,             \
@@ -103,5 +117,8 @@ void gl_init_x86_asm_transforms( void )
    gl_test_all_transform_functions("x86");
 #endif
 
+
+   gl_cliptest_points4_v16 = gl_v16_x86_cliptest_points4;
+   gl_xform_points3_v16_general = gl_v16_x86_general_xform;
 #endif
 }