Ignore:
Timestamp:
May 23, 2000, 10:41:28 PM (25 years ago)
Author:
jeroen
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/opengl/mesa/vbxform.c

    r2962 r3598  
    1 /* $Id: vbxform.c,v 1.2 2000-03-01 18:49:39 jeroen Exp $ */
     1/* $Id: vbxform.c,v 1.3 2000-05-23 20:41:03 jeroen Exp $ */
    22
    33/*
     
    3030#include "all.h"
    3131#else
    32 #ifndef XFree86Server
    33 #include <math.h>
    34 #include <stdlib.h>
    35 #include <stdio.h>
    36 #else
    37 #include "GL/xf86glx.h"
    38 #endif
     32#include "glheader.h"
    3933#include "types.h"
    4034#include "context.h"
     
    5953#include "vbxform.h"
    6054#include "xform.h"
     55#include "mem.h"
     56#include "state.h"
    6157#endif
    6258
     
    132128   {
    133129      if (VB->Count != IM->Count && 0) {
    134         fprintf(stderr, "Trying to copy vertices in the middle of an IM (%d/%d)!!\n",
    135                 VB->Count, IM->Count);
     130        fprintf(stderr, "Trying to copy vertices in the middle of an IM (%d/%d)!!\n",
     131                VB->Count, IM->Count);
    136132      }
    137133      else if (VB->pipeline->copy_transformed_data) {
    138134
    139         for (dst = start ; dst < VB_START ; dst++)
    140         {
    141             GLuint src = VB->Copy[dst];
    142        
    143             if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
    144                fprintf(stderr, "copying vertex %u to %u\n", src, dst);
    145        
    146             COPY_4FV( VB->Clip.data[dst], VEC_ELT(VB->ClipPtr, GLfloat, src) );
    147             COPY_4FV( VB->Win.data[dst], VB->Win.data[src] );
    148        
    149             VB->UserClipMask[dst] = VB->UserClipMask[src];
    150             VB->ClipMask[dst] = (GLubyte) (VB->ClipMask[src] & ~CLIP_CULLED_BIT);
    151             VB->ClipAndMask &= VB->ClipMask[dst];
    152             VB->ClipOrMask  |= VB->ClipMask[dst];
    153             VB->ClipMask[src] = 0;      /* hack for bounds_cull_vb */
    154 
    155             COPY_4UBV( IM->Color[dst], IM->Color[src] );
    156             COPY_4UBV( VB->Spec[0][dst], VB->Spec[0][src] );
    157             COPY_4UBV( VB->Spec[1][dst], VB->Spec[1][src] );
    158             COPY_4UBV( VB->BColor.data[dst], VB->BColor.data[src] );
    159             IM->Index[dst] = IM->Index[src];
    160             VB->BIndex.data[dst] = VB->BIndex.data[src];
    161 
    162             if (VB->TexCoordPtr[0] == &IM->v.TexCoord[0])
    163                COPY_4FV( IM->TexCoord[0][dst], IM->TexCoord[0][src] );
    164        
    165             if (VB->TexCoordPtr[1] == &IM->v.TexCoord[1])
    166                COPY_4FV( IM->TexCoord[1][dst], IM->TexCoord[1][src] );
    167 
    168             IM->Elt[dst] = IM->Elt[src];
    169             VB->SavedOrFlag |= IM->Flag[src];
    170         }
     135        for (dst = start ; dst < VB_START ; dst++)
     136        {
     137            GLuint src = VB->Copy[dst];
     138
     139            if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
     140               fprintf(stderr, "copying vertex %u to %u\n", src, dst);
     141
     142            COPY_4FV( VB->Clip.data[dst], VEC_ELT(VB->ClipPtr, GLfloat, src) );
     143            COPY_4FV( VB->Win.data[dst], VB->Win.data[src] );
     144
     145            VB->UserClipMask[dst] = VB->UserClipMask[src];
     146            VB->ClipMask[dst] = (GLubyte) (VB->ClipMask[src] & ~CLIP_CULLED_BIT);
     147            VB->ClipAndMask &= VB->ClipMask[dst];
     148            VB->ClipOrMask  |= VB->ClipMask[dst];
     149            VB->ClipMask[src] = 0;      /* hack for bounds_cull_vb */
     150
     151            COPY_4UBV( IM->Color[dst], IM->Color[src] );
     152            COPY_4UBV( VB->Spec[0][dst], VB->Spec[0][src] );
     153            COPY_4UBV( VB->Spec[1][dst], VB->Spec[1][src] );
     154            COPY_4UBV( VB->BColor.data[dst], VB->BColor.data[src] );
     155            IM->Index[dst] = IM->Index[src];
     156            VB->BIndex.data[dst] = VB->BIndex.data[src];
     157
     158            if (VB->TexCoordPtr[0] == &IM->v.TexCoord[0])
     159               COPY_4FV( IM->TexCoord[0][dst], IM->TexCoord[0][src] );
     160
     161            if (VB->TexCoordPtr[1] == &IM->v.TexCoord[1])
     162               COPY_4FV( IM->TexCoord[1][dst], IM->TexCoord[1][src] );
     163
     164            IM->Elt[dst] = IM->Elt[src];
     165            VB->SavedOrFlag |= IM->Flag[src];
     166        }
    171167      }
    172168
     
    198194 */
    199195void gl_copy_prev_vertices( struct vertex_buffer *VB,
    200                             struct immediate *prev,
    201                             struct immediate *next )
     196                            struct immediate *prev,
     197                            struct immediate *next )
    202198{
    203199   GLuint dst;
     
    206202   if (MESA_VERBOSE&VERBOSE_CULL)
    207203      fprintf(stderr, "copy prev vertices im: prev %d next %d copystart %d\n",
    208               prev->id, next->id, VB->CopyStart);
     204              prev->id, next->id, VB->CopyStart);
    209205
    210206   /* VB_START is correct as vertex copying is only required when an
     
    216212
    217213      if (MESA_VERBOSE&VERBOSE_CULL)
    218         fprintf(stderr, "copy_prev: copy %d to %d\n", src, dst );
     214        fprintf(stderr, "copy_prev: copy %d to %d\n", src, dst );
    219215
    220216      COPY_4FV( next->Obj[dst], prev->Obj[src] );
    221217
    222218      if ((flags&VERT_TEX0_ANY) && VB->TexCoordPtr[0] == &prev->v.TexCoord[0])
    223         COPY_4FV( next->TexCoord[0][dst], prev->TexCoord[0][src] );
    224        
     219        COPY_4FV( next->TexCoord[0][dst], prev->TexCoord[0][src] );
     220
    225221      if ((flags&VERT_TEX1_ANY) && VB->TexCoordPtr[1] == &prev->v.TexCoord[1])
    226         COPY_4FV( next->TexCoord[1][dst], prev->TexCoord[1][src] );
     222        COPY_4FV( next->TexCoord[1][dst], prev->TexCoord[1][src] );
    227223
    228224      COPY_4UBV( next->Color[dst], prev->Color[src] );
     
    270266   if (0)
    271267      fprintf(stderr,
    272            "in reset_input(IM %d), BeginState is %x, setting prim[%d] to %s\n",
    273            IM->id,
    274            VERT_BEGIN_0,
    275            IM->Start, gl_lookup_enum_by_nr(ctx->Current.Primitive));
     268           "in reset_input(IM %d), BeginState is %x, setting prim[%d] to %s\n",
     269           IM->id,
     270           VERT_BEGIN_0,
     271           IM->Start, gl_lookup_enum_by_nr(ctx->Current.Primitive));
    276272
    277273   IM->ArrayAndFlags = ~ctx->Array.Flags;
     
    290286   for (;;) {
    291287      if ((flag[++i] & match) == 0) {
    292         COPY_4FV(data[i], data[i-1]);
    293         flag[i] |= (flag[i-1] & match);
    294         if (flag[i] & VERT_END_VB) break;
     288        COPY_4FV(data[i], data[i-1]);
     289        flag[i] |= (flag[i-1] & match);
     290        if (flag[i] & VERT_END_VB) break;
    295291      }
    296292   }
     
    308304   for (;;) {
    309305      if ((flag[++i] & match) == 0) {
    310         COPY_3V(data[i], data[i-1]);
    311         flag[i] |= match;
    312         if (flag[i] & VERT_END_VB) break;
     306        COPY_3V(data[i], data[i-1]);
     307        flag[i] |= match;
     308        if (flag[i] & VERT_END_VB) break;
    313309      }
    314310   }
     
    323319   for (;;) {
    324320      if ((flag[++i] & match) == 0) {
    325         data[i] = data[i-1];
    326         if (flag[i] & VERT_END_VB) break;
     321        data[i] = data[i-1];
     322        if (flag[i] & VERT_END_VB) break;
    327323      }
    328324   }
     
    337333   for (;;) {
    338334      if ((flag[++i] & match) == 0) {
    339         data[i] = data[i-1];
    340         if (flag[i] & VERT_END_VB) break;
     335        data[i] = data[i-1];
     336        if (flag[i] & VERT_END_VB) break;
    341337      }
    342338   }
     
    352348   for (;;) {
    353349      if ((flag[++i] & match) == 0) {
    354         COPY_4UBV(data[i], data[i-1]);
    355         if (flag[i] & VERT_END_VB) break;
     350        COPY_4UBV(data[i], data[i-1]);
     351        if (flag[i] & VERT_END_VB) break;
    356352      }
    357353   }
     
    365361find_last_3f( float data[][3], GLuint flag[], GLuint match, GLuint count )
    366362{
    367    GLuint i = count;
    368 
    369    for (;;)
     363   int i = count;
     364
     365   do {
    370366      if ((flag[--i] & match) != 0) {
    371          COPY_3V(data[count], data[i]);
    372          return;
    373       }
     367         COPY_3V(data[count], data[i]);
     368         return;
     369      }
     370   } while (i >= 0);
     371
     372   /* To reach this point excercises a bug that seems only to exist on
     373    * dec alpha installations.  I want to leave this print statement
     374    * enabled on the 3.3 branch so that we are reminded to track down
     375    * the problem.
     376    */
     377   fprintf(stderr,
     378           "didn't find VERT_NORM in find_last_3f"
     379           "(Dec alpha problem?)\n");
    374380}
    375381
    376382static void
    377383fixup_first_4v( GLfloat data[][4], GLuint flag[], GLuint match,
    378                 GLuint start, GLfloat *dflt )
     384                GLuint start, GLfloat *dflt )
    379385{
    380386   GLuint i = start-1;
     
    388394static void
    389395fixup_first_1ui( GLuint data[], GLuint flag[], GLuint match,
    390                 GLuint start, GLuint dflt )
     396                GLuint start, GLuint dflt )
    391397{
    392398   GLuint i = start-1;
     
    400406static void
    401407fixup_first_1ub( GLubyte data[], GLuint flag[], GLuint match,
    402                 GLuint start, GLubyte dflt )
     408                GLuint start, GLubyte dflt )
    403409{
    404410   GLuint i = start-1;
     
    412418static void
    413419fixup_first_4ub( GLubyte data[][4], GLuint flag[], GLuint match,
    414                 GLuint start, GLubyte dflt[4] )
     420                GLuint start, GLubyte dflt[4] )
    415421{
    416422   GLuint i = start-1;
     
    425431
    426432static GLuint vertex_sizes[16] = { 0,
    427                                    1,
    428                                    2, 2,
    429                                    3, 3, 3, 3,
    430                                    4, 4, 4, 4, 4, 4, 4, 4 };
     433                                   1,
     434                                   2, 2,
     435                                   3, 3, 3, 3,
     436                                   4, 4, 4, 4, 4, 4, 4, 4 };
    431437
    432438
     
    450456   for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++) {
    451457      if (orflag & VERT_TEX_ANY(i)) {
    452         GLuint szflag = ((orflag>>(VERT_TEX0_SHIFT+i*NR_TEXSIZE_BITS))
    453                           & 0xf);
    454         IM->v.TexCoord[i].size = vertex_sizes[szflag];
     458        GLuint szflag = ((orflag>>(VERT_TEX0_SHIFT+i*NR_TEXSIZE_BITS))
     459                          & 0xf);
     460        IM->v.TexCoord[i].size = vertex_sizes[szflag];
    455461      }
    456462   }
     
    505511   {
    506512      fprintf(stderr, "Start: %u Count: %u LastData: %u\n",
    507               IM->Start, IM->Count, IM->LastData);
     513              IM->Start, IM->Count, IM->LastData);
    508514      gl_print_vert_flags("Orflag", orflag);
    509515      gl_print_vert_flags("Andflag", andflag);
     
    541547
    542548      if (ctx->ExecuteFlag && (fixup & ~IM->Flag[start])) {
    543         GLuint copy = fixup & ~IM->Flag[start];
    544 
    545          if (copy & VERT_NORM) 
    546             COPY_3V( IM->Normal[start], ctx->Current.Normal );
    547        
    548         if (copy & VERT_RGBA)
    549             COPY_4UBV( IM->Color[start], ctx->Current.ByteColor);
    550 
    551         if (copy & VERT_INDEX)
    552             IM->Index[start] = ctx->Current.Index;
    553        
    554         if (copy & VERT_EDGE)
    555             IM->EdgeFlag[start] = ctx->Current.EdgeFlag;
    556 
    557         if (copy & VERT_TEX0_ANY)
    558             COPY_4FV( IM->TexCoord[0][start], ctx->Current.Texcoord[0] );
    559        
    560         if (copy & VERT_TEX1_ANY)
    561             COPY_4FV( IM->TexCoord[1][start], ctx->Current.Texcoord[1] );
     549        GLuint copy = fixup & ~IM->Flag[start];
     550
     551         if (copy & VERT_NORM)
     552            COPY_3V( IM->Normal[start], ctx->Current.Normal );
     553
     554        if (copy & VERT_RGBA)
     555            COPY_4UBV( IM->Color[start], ctx->Current.ByteColor);
     556
     557        if (copy & VERT_INDEX)
     558            IM->Index[start] = ctx->Current.Index;
     559
     560        if (copy & VERT_EDGE)
     561            IM->EdgeFlag[start] = ctx->Current.EdgeFlag;
     562
     563        if (copy & VERT_TEX0_ANY)
     564            COPY_4FV( IM->TexCoord[0][start], ctx->Current.Texcoord[0] );
     565
     566        if (copy & VERT_TEX1_ANY)
     567            COPY_4FV( IM->TexCoord[1][start], ctx->Current.Texcoord[1] );
    562568      }
    563569
    564570
    565571      if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
    566         gl_print_vert_flags("fixup", fixup);
     572        gl_print_vert_flags("fixup", fixup);
    567573
    568574      if (fixup & VERT_TEX0_ANY) {
    569         if (orflag & VERT_TEX0_ANY)
    570             fixup_4f( IM->TexCoord[0], IM->Flag, start, VERT_TEX0_1234 );
    571         else
    572             fixup_first_4v( IM->TexCoord[0], IM->Flag, 0, start,
    573                             IM->TexCoord[0][start]);
     575        if (orflag & VERT_TEX0_ANY)
     576            fixup_4f( IM->TexCoord[0], IM->Flag, start, VERT_TEX0_1234 );
     577        else
     578            fixup_first_4v( IM->TexCoord[0], IM->Flag, 0, start,
     579                            IM->TexCoord[0][start]);
    574580      }
    575581
    576582      if (fixup & VERT_TEX1_ANY) {
    577         if (orflag & VERT_TEX1_ANY)
    578             fixup_4f( IM->TexCoord[1], IM->Flag, start, VERT_TEX1_1234 );
    579         else
    580             fixup_first_4v( IM->TexCoord[1], IM->Flag, 0, start,
    581                             IM->TexCoord[1][start] );
     583        if (orflag & VERT_TEX1_ANY)
     584            fixup_4f( IM->TexCoord[1], IM->Flag, start, VERT_TEX1_1234 );
     585        else
     586            fixup_first_4v( IM->TexCoord[1], IM->Flag, 0, start,
     587                            IM->TexCoord[1][start] );
    582588      }
    583589
    584590      if (fixup & VERT_EDGE) {
    585         if (orflag & VERT_EDGE)
    586             fixup_1ub( IM->EdgeFlag, IM->Flag, start, VERT_EDGE );
    587         else
    588             fixup_first_1ub( IM->EdgeFlag, IM->Flag, 0, start,
    589                              IM->EdgeFlag[start] );
     591        if (orflag & VERT_EDGE)
     592            fixup_1ub( IM->EdgeFlag, IM->Flag, start, VERT_EDGE );
     593        else
     594            fixup_first_1ub( IM->EdgeFlag, IM->Flag, 0, start,
     595                             IM->EdgeFlag[start] );
    590596      }
    591597
    592598      if (fixup & VERT_INDEX) {
    593         if (orflag & VERT_INDEX)
    594             fixup_1ui( IM->Index, IM->Flag, start, VERT_INDEX );
    595         else
    596             fixup_first_1ui( IM->Index, IM->Flag, 0, start, IM->Index[start] );
     599        if (orflag & VERT_INDEX)
     600            fixup_1ui( IM->Index, IM->Flag, start, VERT_INDEX );
     601        else
     602            fixup_first_1ui( IM->Index, IM->Flag, 0, start, IM->Index[start] );
    597603      }
    598604
    599605      if (fixup & VERT_RGBA) {
    600         if (orflag & VERT_RGBA)
    601             fixup_4ub( IM->Color, IM->Flag, start, VERT_RGBA );
    602         else
    603             fixup_first_4ub( IM->Color, IM->Flag, 0, start, IM->Color[start] );
     606        if (orflag & VERT_RGBA)
     607            fixup_4ub( IM->Color, IM->Flag, start, VERT_RGBA );
     608        else
     609            fixup_first_4ub( IM->Color, IM->Flag, 0, start, IM->Color[start] );
    604610      }
    605611
    606612      if (fixup & VERT_NORM) {
    607          if (IM->OrFlag & VERT_EVAL_ANY)
    608             fixup_3f( IM->Normal, IM->Flag, start, VERT_NORM );
    609          else if (!(IM->Flag[IM->LastData] & VERT_NORM))
    610             find_last_3f( IM->Normal, IM->Flag, VERT_NORM, IM->LastData );
     613         /* Only eval cannot use the Flag member to find valid normals:
     614          */
     615         if (IM->OrFlag & VERT_EVAL_ANY)
     616            fixup_3f( IM->Normal, IM->Flag, start, VERT_NORM );
     617         else {
     618            /* Copy-to-current requires a valid normal in the last slot:
     619             */
     620            if ((IM->OrFlag & VERT_NORM) &&
     621                !(IM->Flag[IM->LastData] & VERT_NORM))
     622               find_last_3f( IM->Normal, IM->Flag, VERT_NORM, IM->LastData );
     623         }
    611624      }
    612625   }
     
    629642
    630643static void calc_normal_lengths( GLfloat *dest,
    631                                 CONST GLfloat (*data)[3],
    632                                 const GLuint *flags,
    633                                 GLuint count )
     644                                CONST GLfloat (*data)[3],
     645                                const GLuint *flags,
     646                                GLuint count )
    634647{
    635648   GLuint i;
     
    637650   for (i = 0 ; i < count ; i++ )
    638651      if (flags[i] & VERT_NORM) {
    639         GLfloat tmp = (GLfloat) LEN_3FV( data[i] );
    640         dest[i] = 0;
    641         if (tmp > 0)
    642             dest[i] = 1.0F / tmp;
     652        GLfloat tmp = (GLfloat) LEN_3FV( data[i] );
     653        dest[i] = 0;
     654        if (tmp > 0)
     655            dest[i] = 1.0F / tmp;
    643656      }
    644657}
     
    666679
    667680      if (!IM->NormalLengths)
    668         IM->NormalLengths = (GLfloat *)MALLOC(sizeof(GLfloat) * VB_SIZE);
     681        IM->NormalLengths = (GLfloat *)MALLOC(sizeof(GLfloat) * VB_SIZE);
    669682
    670683      calc_normal_lengths( IM->NormalLengths + start,
    671                            (const GLfloat (*)[3])(IM->Normal + start),
    672                            IM->Flag + start,
    673                            IM->Count - start);
     684                           (const GLfloat (*)[3])(IM->Normal + start),
     685                           IM->Flag + start,
     686                           IM->Count - start);
    674687
    675688      IM->LastCalcedLength = IM->Count;
     
    681694
    682695      if (MESA_VERBOSE & VERBOSE_IMMEDIATE) {
    683         fprintf(stderr, "start: %d count: %d\n", start, count);
    684         gl_print_vert_flags("fixup_cassette", fixup);
     696        fprintf(stderr, "start: %d count: %d\n", start, count);
     697        gl_print_vert_flags("fixup_cassette", fixup);
    685698      }
    686699
    687700      if (fixup & VERT_TEX0_ANY)
    688         fixup_first_4v( IM->TexCoord[0], IM->Flag, VERT_TEX0_ANY, start,
    689                         ctx->Current.Texcoord[0] );
     701        fixup_first_4v( IM->TexCoord[0], IM->Flag, VERT_TEX0_ANY, start,
     702                        ctx->Current.Texcoord[0] );
    690703
    691704      if (fixup & VERT_TEX1_ANY)
    692         fixup_first_4v( IM->TexCoord[1], IM->Flag, VERT_TEX1_ANY, start,
    693                         ctx->Current.Texcoord[1] );
     705        fixup_first_4v( IM->TexCoord[1], IM->Flag, VERT_TEX1_ANY, start,
     706                        ctx->Current.Texcoord[1] );
    694707
    695708      if (fixup & VERT_EDGE)
    696         fixup_first_1ub(IM->EdgeFlag, IM->Flag, VERT_EDGE, start,
    697                         ctx->Current.EdgeFlag );
     709        fixup_first_1ub(IM->EdgeFlag, IM->Flag, VERT_EDGE, start,
     710                        ctx->Current.EdgeFlag );
    698711
    699712      if (fixup & VERT_INDEX)
    700         fixup_first_1ui(IM->Index, IM->Flag, VERT_INDEX, start,
    701                         ctx->Current.Index );
     713        fixup_first_1ui(IM->Index, IM->Flag, VERT_INDEX, start,
     714                        ctx->Current.Index );
    702715
    703716      if (fixup & VERT_RGBA)
    704         fixup_first_4ub(IM->Color, IM->Flag, VERT_RGBA, start,
    705                         ctx->Current.ByteColor );
     717        fixup_first_4ub(IM->Color, IM->Flag, VERT_RGBA, start,
     718                        ctx->Current.ByteColor );
    706719
    707720      if ((fixup & VERT_NORM) && !(IM->Flag[start] & VERT_NORM)) {
    708         COPY_3V(IM->Normal[start], ctx->Current.Normal);
    709         if (ctx->Transform.Normalize)
    710             IM->NormalLengths[start] = 1.0F / (GLfloat) LEN_3FV(ctx->Current.Normal);
     721        COPY_3V(IM->Normal[start], ctx->Current.Normal);
     722        if (ctx->Transform.Normalize)
     723            IM->NormalLengths[start] = 1.0F / (GLfloat) LEN_3FV(ctx->Current.Normal);
    711724      }
    712725   }
     
    754767   for (in = start ; in <= count ; in = in_nextprim[in])
    755768      if (flags[in] & interesting)
    756         break;
     769        break;
    757770
    758771   out = VB->CopyStart;
     
    778791      out_nextprim[in] = in_nextprim[in];
    779792   }
    780        
     793
    781794
    782795   VB->Primitive = out_prim;
     
    803816   if (0)
    804817      fprintf(stderr, "prim: %s count %u last %u incr %u ovf: %u\n",
    805               gl_prim_name[prim], count, last, incr, VB->Ovf);
     818              gl_prim_name[prim], count, last, incr, VB->Ovf);
    806819}
    807820
     
    927940   if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
    928941      fprintf(stderr,
    929               "executing cassette, rows %u tc0->size == %u tc1->size == %u\n",
    930               VB->Count,
    931               VB->TexCoordPtr[0]->size,
    932               VB->TexCoordPtr[1]->size);
     942              "executing cassette, rows %u tc0->size == %u tc1->size == %u\n",
     943              VB->Count,
     944              VB->TexCoordPtr[0]->size,
     945              VB->TexCoordPtr[1]->size);
    933946
    934947   if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
     
    951964   if (VB->pipeline->replay_copied_vertices) {
    952965      if (!VB->CullDone)
    953         gl_fast_copy_vb( VB );
     966        gl_fast_copy_vb( VB );
    954967
    955968      gl_copy_prev_vertices( VB, VB->prev_buffer, IM );
     
    972985   GLuint req = ~0;
    973986   static const char *tplate[5] = { "%s ",
    974                                     "%s: %f ",
    975                                     "%s: %f %f ",
    976                                     "%s: %f %f %f ",
    977                                     "%s: %f %f %f %f " };
     987                                    "%s: %f ",
     988                                    "%s: %f %f ",
     989                                    "%s: %f %f %f ",
     990                                    "%s: %f %f %f %f " };
    978991
    979992   fprintf(stderr, "Cassette id %d, %u rows.\n", IM->id, IM->Count - IM->Start);
     
    986999
    9871000      fprintf(stderr, "Final begin/end state %s/%s, errors %s/%s\n",
    988              (state & VERT_BEGIN_0) ? "in" : "out",
    989              (state & VERT_BEGIN_1) ? "in" : "out",
    990              (state & VERT_ERROR_0) ? "y" : "n",
    991              (state & VERT_ERROR_1) ? "y" : "n");
     1001             (state & VERT_BEGIN_0) ? "in" : "out",
     1002             (state & VERT_BEGIN_1) ? "in" : "out",
     1003             (state & VERT_ERROR_0) ? "y" : "n",
     1004             (state & VERT_ERROR_1) ? "y" : "n");
    9921005
    9931006      fprintf(stderr, "Obj size: %u, TexCoord0 size: %u, TexCoord1 size: %u\n",
    994              IM->v.Obj.size,
    995              IM->v.TexCoord[0].size,
    996              IM->v.TexCoord[1].size);
     1007             IM->v.Obj.size,
     1008             IM->v.TexCoord[0].size,
     1009             IM->v.TexCoord[1].size);
    9971010   }
    9981011
     
    10001013      fprintf(stderr, "%u: ", i);
    10011014      if (req & VERT_OBJ_ANY) {
    1002         if (flags[i] & VERT_EVAL_C1)
    1003             fprintf(stderr, "EvalCoord %f ", IM->Obj[i][0]);
    1004         else if (flags[i] & VERT_EVAL_P1)
    1005             fprintf(stderr, "EvalPoint %.0f ", IM->Obj[i][0]);
    1006         else if (flags[i] & VERT_EVAL_C2)
    1007             fprintf(stderr, "EvalCoord %f %f ", IM->Obj[i][0], IM->Obj[i][1]);
    1008         else if (flags[i] & VERT_EVAL_P2)
    1009             fprintf(stderr, "EvalPoint %.0f %.0f ", IM->Obj[i][0], IM->Obj[i][1]);
    1010         else if (i < IM->Count && (flags[i]&VERT_OBJ_234)) {
    1011             fprintf(stderr, "(%x) ", flags[i] & VERT_OBJ_234);
    1012             fprintf(stderr, tplate[vertex_sizes[(flags[i]&VERT_OBJ_234)<<1]],
    1013                    "Obj",
    1014                    IM->Obj[i][0], IM->Obj[i][1], IM->Obj[i][2], IM->Obj[i][3]);
    1015         }
     1015        if (flags[i] & VERT_EVAL_C1)
     1016            fprintf(stderr, "EvalCoord %f ", IM->Obj[i][0]);
     1017        else if (flags[i] & VERT_EVAL_P1)
     1018            fprintf(stderr, "EvalPoint %.0f ", IM->Obj[i][0]);
     1019        else if (flags[i] & VERT_EVAL_C2)
     1020            fprintf(stderr, "EvalCoord %f %f ", IM->Obj[i][0], IM->Obj[i][1]);
     1021        else if (flags[i] & VERT_EVAL_P2)
     1022            fprintf(stderr, "EvalPoint %.0f %.0f ", IM->Obj[i][0], IM->Obj[i][1]);
     1023        else if (i < IM->Count && (flags[i]&VERT_OBJ_234)) {
     1024            fprintf(stderr, "(%x) ", flags[i] & VERT_OBJ_234);
     1025            fprintf(stderr, tplate[vertex_sizes[(flags[i]&VERT_OBJ_234)<<1]],
     1026                   "Obj",
     1027                   IM->Obj[i][0], IM->Obj[i][1], IM->Obj[i][2], IM->Obj[i][3]);
     1028        }
    10161029      }
    10171030
    10181031      if (req & flags[i] & VERT_ELT)
    1019         fprintf(stderr, " Elt %u\t", IM->Elt[i]);
     1032        fprintf(stderr, " Elt %u\t", IM->Elt[i]);
    10201033
    10211034      if (req & flags[i] & VERT_NORM)
    1022         fprintf(stderr, " Norm %f %f %f ",
    1023                 IM->Normal[i][0], IM->Normal[i][1], IM->Normal[i][2]);
     1035        fprintf(stderr, " Norm %f %f %f ",
     1036                IM->Normal[i][0], IM->Normal[i][1], IM->Normal[i][2]);
    10241037
    10251038      if (req & flags[i] & VERT_TEX0_ANY)
    1026         fprintf(stderr, tplate[vertex_sizes[(flags[i]>>VERT_TEX0_SHIFT)&7]],
    1027                 "TC0",
    1028                 IM->TexCoord[0][i][0], IM->TexCoord[0][i][1],
    1029                 IM->TexCoord[0][i][2], IM->TexCoord[0][i][2]);
     1039        fprintf(stderr, tplate[vertex_sizes[(flags[i]>>VERT_TEX0_SHIFT)&7]],
     1040                "TC0",
     1041                IM->TexCoord[0][i][0], IM->TexCoord[0][i][1],
     1042                IM->TexCoord[0][i][2], IM->TexCoord[0][i][2]);
    10301043
    10311044
    10321045      if (req & flags[i] & VERT_TEX1_ANY)
    1033         fprintf(stderr, tplate[vertex_sizes[(flags[i]>>(VERT_TEX0_SHIFT+4))&7]],
    1034                 "TC1",
    1035                 IM->TexCoord[1][i][0], IM->TexCoord[1][i][1],
    1036                 IM->TexCoord[1][i][2], IM->TexCoord[1][i][2]);
     1046        fprintf(stderr, tplate[vertex_sizes[(flags[i]>>(VERT_TEX0_SHIFT+4))&7]],
     1047                "TC1",
     1048                IM->TexCoord[1][i][0], IM->TexCoord[1][i][1],
     1049                IM->TexCoord[1][i][2], IM->TexCoord[1][i][2]);
    10371050
    10381051      if (req & flags[i] & VERT_RGBA)
    1039         fprintf(stderr, " Rgba %d %d %d %d ",
    1040                 IM->Color[i][0], IM->Color[i][1],
    1041                 IM->Color[i][2], IM->Color[i][3]);
     1052        fprintf(stderr, " Rgba %d %d %d %d ",
     1053                IM->Color[i][0], IM->Color[i][1],
     1054                IM->Color[i][2], IM->Color[i][3]);
    10421055
    10431056      if (req & flags[i] & VERT_INDEX)
    1044         fprintf(stderr, " Index %u ", IM->Index[i]);
     1057        fprintf(stderr, " Index %u ", IM->Index[i]);
    10451058
    10461059      if (req & flags[i] & VERT_EDGE)
    1047         fprintf(stderr, " Edgeflag %d ", IM->EdgeFlag[i]);
     1060        fprintf(stderr, " Edgeflag %d ", IM->EdgeFlag[i]);
    10481061
    10491062      if (req & flags[i] & VERT_MATERIAL)
    1050         fprintf(stderr, " Material ");
    1051        
     1063        fprintf(stderr, " Material ");
     1064
    10521065
    10531066      /* The order of these two is not easily knowable, but this is
     
    10551068       */
    10561069      if (req & flags[i] & VERT_END)
    1057         fprintf(stderr, " END ");
     1070        fprintf(stderr, " END ");
    10581071
    10591072      if (req & flags[i] & VERT_BEGIN)
    1060         fprintf(stderr, " BEGIN(%s) ", gl_prim_name[IM->Primitive[i]]);
     1073        fprintf(stderr, " BEGIN(%s) ", gl_prim_name[IM->Primitive[i]]);
    10611074
    10621075      fprintf(stderr, "\n");
Note: See TracChangeset for help on using the changeset viewer.