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/3dfx/fxvsetup.c

    r2938 r3598  
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    6161{
    6262   fprintf(stderr, "%s: %d %s%s%s%s%s%s\n",
    63           msg,
    64           flags,
    65           (flags & SETUP_XY) ? " xy," : "",
    66           (flags & SETUP_Z)  ? " z," : "",
    67           (flags & SETUP_W)  ? " w," : "",
    68           (flags & SETUP_RGBA) ? " rgba," : "",
    69           (flags & SETUP_TMU0)  ? " tmu0," : "",
    70           (flags & SETUP_TMU1)  ? " tmu1," : "");
     63          msg,
     64          flags,
     65          (flags & SETUP_XY) ? " xy," : "",
     66          (flags & SETUP_Z)  ? " z," : "",
     67          (flags & SETUP_W)  ? " w," : "",
     68          (flags & SETUP_RGBA) ? " rgba," : "",
     69          (flags & SETUP_TMU0)  ? " tmu0," : "",
     70          (flags & SETUP_TMU1)  ? " tmu1," : "");
    7171}
    7272
    7373static void project_texcoords( struct vertex_buffer *VB,
    74                                GLuint tmu_nr, GLuint tc_nr,
    75                                GLuint start, GLuint count )
    76 {                             
     74                               GLuint tmu_nr, GLuint tc_nr,
     75                               GLuint start, GLuint count )
     76{
    7777   fxVertex *v = FX_DRIVER_DATA(VB)->verts + start;
    7878   GrTmuVertex *tmu = &(((GrVertex *)v->f)->tmuvtx[tmu_nr]);
     
    8686      tmu->oow = v->f[OOWCOORD] * data[3];
    8787      tmu = (GrTmuVertex *)((char *)tmu + sizeof(fxVertex));
    88    }     
     88   }
    8989}
    9090
    9191
    9292static void copy_w( struct vertex_buffer *VB,
    93                     GLuint tmu_nr,
    94                     GLuint start, GLuint count )
    95 {                             
     93                    GLuint tmu_nr,
     94                    GLuint start, GLuint count )
     95{
    9696   fxVertex *v = FX_DRIVER_DATA(VB)->verts + start;
    9797   GrTmuVertex *tmu = &(((GrVertex *)v->f)->tmuvtx[tmu_nr]);
     
    101101      tmu->oow = v->f[OOWCOORD];
    102102      tmu = (GrTmuVertex *)((char *)tmu + sizeof(fxVertex));
    103    }     
     103   }
    104104}
    105105
     
    303303      setupindex |= SETUP_RGBA|SETUP_W;
    304304
    305    if ((ctx->Texture.ReallyEnabled & (TEXTURE0_2D|TEXTURE0_3D)) == TEXTURE0_2D) 
     305   if ((ctx->Texture.ReallyEnabled & (TEXTURE0_2D|TEXTURE0_3D)) == TEXTURE0_2D)
    306306   {
    307       if (ctx->Texture.Unit[0].EnvMode == GL_REPLACE) 
    308         setupindex &= ~SETUP_RGBA;
     307      if (ctx->Texture.Unit[0].EnvMode == GL_REPLACE)
     308        setupindex &= ~SETUP_RGBA;
    309309
    310310      setupindex |= SETUP_TMU0|SETUP_W;
     
    313313   if ((ctx->Texture.ReallyEnabled & (TEXTURE1_2D|TEXTURE1_3D)) == TEXTURE1_2D)
    314314   {
    315       if (setupindex & SETUP_TMU0) {
    316          struct gl_texture_object *tObj=ctx->Texture.Unit[0].CurrentD[2];
    317          tfxTexInfo *ti=fxTMGetTexInfo(tObj);
    318 
    319          setupindex |= SETUP_TMU1|SETUP_W;
    320 
    321          if(ti->whichTMU!=FX_TMU0) {
    322             fxMesa->tmu_source[0] = 1; fxMesa->tex_dest[1] = SETUP_TMU0;
    323             fxMesa->tmu_source[1] = 0; fxMesa->tex_dest[0] = SETUP_TMU1;
    324          }
    325       } else {
    326          setupindex |= SETUP_TMU0|SETUP_W;
    327          fxMesa->tmu_source[0] = 1; fxMesa->tex_dest[1] = SETUP_TMU0;
    328          /* not used: */
    329          fxMesa->tmu_source[1] = 0; fxMesa->tex_dest[0] = SETUP_TMU1;
    330       }
     315     setupindex |= SETUP_TMU1|SETUP_W;
     316     if (setupindex & SETUP_TMU0) { /* both TMUs in use */
     317       struct gl_texture_object *tObj=ctx->Texture.Unit[0].CurrentD[2];
     318       tfxTexInfo *ti=fxTMGetTexInfo(tObj);
     319
     320       if (ti->whichTMU!=FX_TMU0) { /* TMU0 and TMU1 are swapped */
     321         fxMesa->tmu_source[0] = 1; fxMesa->tex_dest[1] = SETUP_TMU0;
     322         fxMesa->tmu_source[1] = 0; fxMesa->tex_dest[0] = SETUP_TMU1;
     323       }
     324     }
    331325   }
    332326
     
    335329
    336330   if (MESA_VERBOSE & (VERBOSE_DRIVER|VERBOSE_PIPELINE|VERBOSE_STATE))
    337       fxPrintSetupFlags("fxmesa: vertex setup function", setupindex); 
     331      fxPrintSetupFlags("fxmesa: vertex setup function", setupindex);
    338332
    339333   fxMesa->setupindex = setupindex;
     
    353347      return;
    354348   }
    355      
    356    if (VB->Type == VB_CVA_PRECALC) 
     349
     350   if (VB->Type == VB_CVA_PRECALC)
    357351      fxDDPartialRasterSetup( VB );
    358    else 
     352   else
    359353      ctx->Driver.RasterSetup( VB, VB->CopyStart, VB->Count );
    360354}
     
    366360 * we get a forbidden input in the elt pipeline - and therefore need to check
    367361 * whether we have one *now*.  Similarly need to know if state changes cause
    368  * size4 texcoords to be introduced. 
     362 * size4 texcoords to be introduced.
    369363 */
    370364void fxDDCheckPartialRasterSetup( GLcontext *ctx, struct gl_pipeline_stage *d )
     
    375369   d->type = 0;
    376370   d->pre_forbidden_inputs = 0;
    377    fxMesa->setupdone = 0;       /* cleared if we return */
    378 
    379    /* Indirect triangles must be rendered via the immediate pipeline. 
    380     * If all rasterization is software, no need to set up. 
     371   fxMesa->setupdone = 0;       /* cleared if we return */
     372
     373   /* Indirect triangles must be rendered via the immediate pipeline.
     374    * If all rasterization is software, no need to set up.
    381375    */
    382376   if ((ctx->Array.Summary & VERT_OBJ_ANY) == 0)
    383377      return;
    384    
     378
    385379   if ((ctx->IndirectTriangles & DD_SW_SETUP) ||
    386        (ctx->IndirectTriangles & DD_SW_RASTERIZE) == DD_SW_RASTERIZE) 
     380       (ctx->IndirectTriangles & DD_SW_RASTERIZE) == DD_SW_RASTERIZE)
    387381      return;
    388382
     
    391385   {
    392386      if (ctx->TextureMatrix[0].type == MATRIX_GENERAL ||
    393           ctx->TextureMatrix[0].type == MATRIX_PERSPECTIVE ||
    394           (ctx->Texture.Unit[1].TexGenEnabled & Q_BIT))
    395         return;
     387          ctx->TextureMatrix[0].type == MATRIX_PERSPECTIVE ||
     388          (ctx->Texture.Unit[1].TexGenEnabled & Q_BIT))
     389        return;
    396390
    397391      d->pre_forbidden_inputs |= VERT_TEX0_4;
     
    402396   {
    403397      if (ctx->TextureMatrix[1].type == MATRIX_GENERAL ||
    404           ctx->TextureMatrix[1].type == MATRIX_PERSPECTIVE ||
    405           (ctx->Texture.Unit[1].TexGenEnabled & Q_BIT))
    406         return;
     398          ctx->TextureMatrix[1].type == MATRIX_PERSPECTIVE ||
     399          (ctx->Texture.Unit[1].TexGenEnabled & Q_BIT))
     400        return;
    407401
    408402      d->pre_forbidden_inputs |= VERT_TEX1_4;
    409403   }
    410404
    411    
     405
    412406   fxMesa->setupdone = tmp;
    413407   d->inputs = 0;
     
    444438   if ((newout & VERT_WIN) == 0)
    445439      ind &= ~(fxMesa->setupdone & SETUP_W);
    446      
     440
    447441   fxMesa->setupdone &= ~ind;
    448442   ind &= fxMesa->setupindex;
     
    451445   if (MESA_VERBOSE & (VERBOSE_DRIVER|VERBOSE_PIPELINE)) {
    452446      gl_print_vert_flags("new outputs", VB->pipeline->new_outputs);
    453       fxPrintSetupFlags("fxmesa: partial setup function", ind); 
    454    }
    455 
    456    if (ind) 
    457       setupfuncs[ind]( VB, VB->Start, VB->Count );   
     447      fxPrintSetupFlags("fxmesa: partial setup function", ind);
     448   }
     449
     450   if (ind)
     451      setupfuncs[ind]( VB, VB->Start, VB->Count );
    458452}
    459453
     
    472466   FREE( fvb->vert_store );
    473467   fvb->vert_store = MALLOC( sizeof(fxVertex) * fvb->size + 31);
    474    if (!fvb->vert_store || !VB->ClipMask) 
     468   if (!fvb->vert_store || !VB->ClipMask)
    475469   {
    476470     fprintf(stderr,"fx Driver: out of memory !\n");
    477471     fxCloseHardware();
    478      exit(-1);
     472     EXIT(-1);
    479473   }
    480474   fvb->verts = (fxVertex *)(((unsigned long)fvb->vert_store + 31) & ~31);
     
    482476   gl_vector1ui_free( &fvb->clipped_elements );
    483477   gl_vector1ui_alloc( &fvb->clipped_elements, VEC_WRITABLE, fvb->size, 32 );
    484    
     478
    485479   if (!fvb->clipped_elements.start) goto memerror;
    486    
     480
    487481   return;
    488 memerror: 
     482memerror:
    489483   fprintf(stderr,"fx Driver: out of memory !\n");
    490484   fxCloseHardware();
    491    exit(-1);
     485   EXIT(-1);
    492486}
    493487
     
    507501      fvb->vert_store = MALLOC( sizeof(fxVertex) * fvb->size + 31);
    508502      if (!fvb->vert_store) goto memerror;
    509 #if defined(FX_GLIDE3) 
     503#if defined(FX_GLIDE3)
    510504      fvb->triangle_b = MALLOC( sizeof(GrVertex*) *4* fvb->size+ 31);
    511505      if (!fvb->triangle_b)  goto memerror;
    512506      fvb->strips_b = MALLOC( sizeof(GrVertex*) *4* fvb->size+ 31);
    513       if (!fvb->strips_b )  goto memerror;         
    514 #endif     
     507      if (!fvb->strips_b )  goto memerror;
     508#endif
    515509      fvb->verts = (fxVertex *)(((unsigned long)fvb->vert_store + 31) & ~31);
    516510      gl_vector1ui_alloc( &fvb->clipped_elements, VEC_WRITABLE, fvb->size, 32 );
     
    519513      FREE( VB->ClipMask );
    520514      VB->ClipMask = (GLubyte *)MALLOC(sizeof(GLubyte) * fvb->size);
    521           if (!VB->ClipMask) goto memerror;
     515          if (!VB->ClipMask) goto memerror;
    522516
    523517   } else {
    524518      fvb->vert_store = MALLOC( sizeof(fxVertex) * (VB->Size + 12) + 31);
    525519      if (!fvb->vert_store) goto memerror;
    526 #if defined(FX_GLIDE3) 
     520#if defined(FX_GLIDE3)
    527521      fvb->triangle_b = MALLOC( sizeof(GrVertex*) *4* fvb->size+ 31);
    528522      if (!fvb->triangle_b)  goto memerror;
    529523      fvb->strips_b = MALLOC( sizeof(GrVertex*) *4* fvb->size+ 31);
    530       if (!fvb->strips_b )  goto memerror;     
    531 #endif       
     524      if (!fvb->strips_b )  goto memerror;
     525#endif
    532526      fvb->verts = (fxVertex *)(((unsigned long)fvb->vert_store + 31) & ~31);
    533527      fvb->size = VB->Size + 12;
    534528   }
    535529
    536    
     530
    537531   VB->driver_data = fvb;
    538532   return;
     
    540534   fprintf(stderr,"fx Driver: out of memory !\n");
    541535   fxCloseHardware();
    542    exit(-1);   
     536   EXIT(-1);
    543537}
    544538
     
    546540{
    547541   struct tfxMesaVertexBuffer *fvb = FX_DRIVER_DATA(VB);
    548    
     542
    549543   if (fvb) {
    550544      if (fvb->vert_store) FREE(fvb->vert_store);
     
    553547#if defined(FX_GLIDE3)
    554548      if (fvb->strips_b)
    555         FREE(fvb->strips_b);
     549        FREE(fvb->strips_b);
    556550      if (fvb->triangle_b)
    557         FREE(fvb->triangle_b);
     551        FREE(fvb->triangle_b);
    558552#endif
    559553      VB->driver_data = 0;
    560    }     
     554   }
    561555}
    562556
Note: See TracChangeset for help on using the changeset viewer.