Changeset 3598 for trunk/src/opengl/mesa/3dfx/fxcva.c
- Timestamp:
- May 23, 2000, 10:41:28 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/opengl/mesa/3dfx/fxcva.c
r2938 r3598 3 3 /* 4 4 * Mesa 3-D graphics library 5 * Version: 3. 15 * Version: 3.3 6 6 * 7 7 * Copyright (C) 1999 Brian Paul All Rights Reserved. … … 82 82 83 83 typedef void (*mergefunc)( struct vertex_buffer *cvaVB, 84 85 86 87 84 struct vertex_buffer *VB, 85 const struct gl_prim_state *state, 86 GLuint start, 87 GLuint count ); 88 88 89 89 static void fxCvaRenderNoop( struct vertex_buffer *cvaVB, 90 91 92 93 90 struct vertex_buffer *VB, 91 const struct gl_prim_state *state, 92 GLuint start, 93 GLuint count ) 94 94 { 95 95 } 96 96 97 97 static INLINE void fxRenderClippedTriangle2( struct vertex_buffer *VB, 98 98 GLuint v1, GLuint v2, GLuint v3 ) 99 99 { 100 100 fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; … … 103 103 104 104 if (!mask) { 105 FX_grDrawTriangle((GrVertex *)gWin[v1].f, 106 (GrVertex *)gWin[v2].f, 107 108 } else if (!(clipmask[v1]&clipmask[v2]&clipmask[v3]&CLIP_ALL_BITS)) { 105 FX_grDrawTriangle((GrVertex *)gWin[v1].f, 106 (GrVertex *)gWin[v2].f, 107 (GrVertex *)gWin[v3].f); 108 } else if (!(clipmask[v1]&clipmask[v2]&clipmask[v3]&CLIP_ALL_BITS)) { 109 109 GLuint n; 110 110 GLuint vlist[VB_MAX_CLIPPED_VERTS]; … … 115 115 GLuint i, j0 = vlist[0]; 116 116 for (i=2;i<n;i++) { 117 118 119 117 FX_grDrawTriangle((GrVertex *)gWin[j0].f, 118 (GrVertex *)gWin[vlist[i-1]].f, 119 (GrVertex *)gWin[vlist[i]].f); 120 120 } 121 121 } … … 128 128 129 129 /* 130 #define CVA_VARS_RGBA 131 GLubyte (*color)[4] = VB->ColorPtr->data; 130 #define CVA_VARS_RGBA \ 131 GLubyte (*color)[4] = VB->ColorPtr->data; \ 132 132 GLubyte (*cva_color)[4] = (cvaVB->ColorPtr = cvaVB->LitColor[0])->data; 133 133 */ 134 134 135 #define CVA_VARS_RGBA 136 GLubyte (*color)[4] = VB->ColorPtr->data; 135 #define CVA_VARS_RGBA \ 136 GLubyte (*color)[4] = VB->ColorPtr->data; \ 137 137 GLubyte (*cva_color)[4] = cvaVB->ColorPtr->data; 138 138 … … 141 141 #undef DO_SETUP_RGBA 142 142 #if FX_USE_PARGB 143 #define DO_SETUP_RGBA 144 { 145 GLubyte *col = color[i]; 146 GET_PARGB(v)= ((col[3] << 24) |\147 (col[0] << 16) |\148 149 (col[2]));\143 #define DO_SETUP_RGBA \ 144 { \ 145 GLubyte *col = color[i]; \ 146 GET_PARGB(v)= ((col[3] << 24) | \ 147 (col[0] << 16) | \ 148 (col[1] << 8) | \ 149 (col[2])); \ 150 150 } 151 151 #else 152 #define DO_SETUP_RGBA 153 { 154 GLubyte *col = color[i]; 155 v[GR_VERTEX_R_OFFSET]=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[0]); 156 v[GR_VERTEX_G_OFFSET]=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[1]); 157 v[GR_VERTEX_B_OFFSET]=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[2]); 158 v[GR_VERTEX_A_OFFSET]=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[3]); 152 #define DO_SETUP_RGBA \ 153 { \ 154 GLubyte *col = color[i]; \ 155 v[GR_VERTEX_R_OFFSET]=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[0]); \ 156 v[GR_VERTEX_G_OFFSET]=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[1]); \ 157 v[GR_VERTEX_B_OFFSET]=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[2]); \ 158 v[GR_VERTEX_A_OFFSET]=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[3]); \ 159 159 } 160 160 #endif /* FX_USE_PARGB */ 161 161 162 162 163 #define CVA_VARS_TMU0 164 VARS_TMU0 163 #define CVA_VARS_TMU0 \ 164 VARS_TMU0 \ 165 165 GLfloat (*cva_tex0)[4] = (cvaVB->TexCoordPtr[tmu0_source] = cvaVB->store.TexCoord[tmu0_source])->data; 166 166 167 #define CVA_VARS_TMU1 168 VARS_TMU1 167 #define CVA_VARS_TMU1 \ 168 VARS_TMU1 \ 169 169 GLfloat (*cva_tex1)[4] = (cvaVB->TexCoordPtr[tmu1_source] = cvaVB->store.TexCoord[tmu1_source])->data; 170 170 … … 221 221 #define TAG(x) x##T0T1 222 222 #define IDX SETUP_TMU0|SETUP_TMU1 223 #define VARS CVA_VARS_TMU0 CVA_VARS_TMU1 224 #define INIT INIT_TMU0 INIT_TMU1 223 #define VARS CVA_VARS_TMU0 CVA_VARS_TMU1 224 #define INIT INIT_TMU0 INIT_TMU1 225 225 #define INCR , tmu0_data+=4 , tmu1_data+=4 226 226 #define MERGE_RAST DO_SETUP_TMU0 DO_SETUP_TMU1 … … 231 231 #define TAG(x) x##RGBAT0 232 232 #define IDX SETUP_RGBA|SETUP_TMU0 233 #define VARS CVA_VARS_RGBA CVA_VARS_TMU0 234 #define INIT INIT_RGBA INIT_TMU0 235 #define INCR , tmu0_data+=4 233 #define VARS CVA_VARS_RGBA CVA_VARS_TMU0 234 #define INIT INIT_RGBA INIT_TMU0 235 #define INCR , tmu0_data+=4 236 236 #define MERGE_RAST DO_SETUP_RGBA; DO_SETUP_TMU0 237 237 #define MERGE_VB COPY_2FV(cva_tex0[e], tmu0_data); \ … … 262 262 263 263 264 #undef DRAW_POINT 265 #undef DRAW_LINE 266 #undef DRAW_TRI 267 #undef CLIP_LINE 268 #undef CLIP_OR_DRAW_TRI 264 #undef DRAW_POINT 265 #undef DRAW_LINE 266 #undef DRAW_TRI 267 #undef CLIP_LINE 268 #undef CLIP_OR_DRAW_TRI 269 269 #undef DIRECT 270 270 271 271 #define DRAW_POINT ctx->Driver.PointsFunc( ctx, e, e ) 272 #define DRAW_LINE ctx->Driver.LineFunc( ctx, e, prev, e ) 272 #define DRAW_LINE ctx->Driver.LineFunc( ctx, e, prev, e ) 273 273 #define DRAW_TRI ctx->TriangleFunc( ctx, l[0], l[1], e, e ) 274 274 #define CLIP_LINE gl_render_clipped_line( ctx, e, prev ) 275 #define CLIP_OR_DRAW_TRI 276 do { 277 if (clip[l[0]] | clip[l[1]] | clip[e]) { 278 if (!(clip[l[0]] & clip[l[1]] & clip[e] & CLIP_ALL_BITS)) { 279 COPY_3V(vlist, l);\280 gl_render_clipped_triangle( ctx, 3, vlist, e );\281 } 282 } 283 else ctx->TriangleFunc( ctx, l[0], l[1], e, e ); 275 #define CLIP_OR_DRAW_TRI \ 276 do { \ 277 if (clip[l[0]] | clip[l[1]] | clip[e]) { \ 278 if (!(clip[l[0]] & clip[l[1]] & clip[e] & CLIP_ALL_BITS)) { \ 279 COPY_3V(vlist, l); \ 280 gl_render_clipped_triangle( ctx, 3, vlist, e ); \ 281 } \ 282 } \ 283 else ctx->TriangleFunc( ctx, l[0], l[1], e, e ); \ 284 284 } while (0) 285 285 286 286 287 287 #define DIRECT 0 288 288 … … 325 325 #define TAG(x) x##T0T1_indirect 326 326 #define IDX SETUP_TMU0|SETUP_TMU1 327 #define VARS CVA_VARS_TMU0 CVA_VARS_TMU1 328 #define INIT INIT_TMU0 INIT_TMU1 327 #define VARS CVA_VARS_TMU0 CVA_VARS_TMU1 328 #define INIT INIT_TMU0 INIT_TMU1 329 329 #define INCR , tmu0_data+=4 , tmu1_data+=4 330 330 #define MERGE_RAST DO_SETUP_TMU0 DO_SETUP_TMU1 … … 335 335 #define TAG(x) x##RGBAT0_indirect 336 336 #define IDX SETUP_RGBA|SETUP_TMU0 337 #define VARS CVA_VARS_RGBA CVA_VARS_TMU0 338 #define INIT INIT_RGBA INIT_TMU0 337 #define VARS CVA_VARS_RGBA CVA_VARS_TMU0 338 #define INIT INIT_RGBA INIT_TMU0 339 339 #define INCR , tmu0_data+=4 340 340 #define MERGE_RAST DO_SETUP_RGBA; DO_SETUP_TMU0 … … 398 398 (ctx->Array.Summary & VERT_OBJ_ANY)) 399 399 { 400 d->inputs = (VERT_SETUP_PART | VERT_ELT | inputs); 400 d->inputs = (VERT_SETUP_PART | VERT_ELT | inputs); 401 401 d->outputs = 0; 402 402 d->type = PIPE_IMMEDIATE; … … 409 409 extern void fxPointSmooth(GLcontext *ctx, GLuint first, GLuint last); 410 410 extern void fxLineSmooth(GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv); 411 extern void fxTriangleSmooth(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, 412 411 extern void fxTriangleSmooth(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, 412 GLuint pv); 413 413 extern const char *gl_prim_name[]; 414 414 … … 433 433 GLuint p = 0; 434 434 435 if (fxMesa->new_state) 435 if (fxMesa->new_state) 436 436 fxSetupFXUnits(ctx); 437 437 … … 441 441 * VB so that funcs like fxTriangleFlat will be able to reach them. 442 442 * 443 * This leads to some duplication of effort in the merge funcs. 443 * This leads to some duplication of effort in the merge funcs. 444 444 */ 445 445 if (inputs & VERT_RGBA) { … … 464 464 if (cvaVB->ClipOrMask) 465 465 gl_import_client_data( cvaVB, ctx->RenderFlags, 466 466 VEC_WRITABLE|VEC_GOOD_STRIDE ); 467 467 468 468 ctx->VB = cvaVB; 469 469 470 470 do { 471 for ( i= VB->CopyStart ; i < count ; parity = 0, i = next ) 471 for ( i= VB->CopyStart ; i < count ; parity = 0, i = next ) 472 472 { 473 474 475 476 477 478 479 480 if ( ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE ) 481 482 483 484 485 473 prim = VB->Primitive[i]; 474 next = VB->NextPrimitive[i]; 475 476 state = gl_prim_state_machine[prim][parity]; 477 func = tab[flags][reduce_prim[prim]]; 478 func( cvaVB, VB, state, i, next ); 479 480 if ( ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE ) 481 { 482 cvaVB->Specular = cvaVB->Spec[0]; 483 cvaVB->ColorPtr = cvaVB->Color[0]; 484 cvaVB->IndexPtr = cvaVB->Index[0]; 485 } 486 486 } 487 487 } while (ctx->Driver.MultipassFunc && 488 489 490 491 492 if (ctx->PB->count > 0) 488 ctx->Driver.MultipassFunc( VB, ++p )); 489 490 491 492 if (ctx->PB->count > 0) 493 493 gl_flush_pb(ctx); 494 494
Note:
See TracChangeset
for help on using the changeset viewer.