Changeset 3598 for trunk/src/opengl/mesa/pipeline.c
- Timestamp:
- May 23, 2000, 10:41:28 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/opengl/mesa/pipeline.c
r2962 r3598 1 /* $Id: pipeline.c,v 1. 2 2000-03-01 18:49:33 jeroen Exp $ */1 /* $Id: pipeline.c,v 1.3 2000-05-23 20:40:43 jeroen Exp $ */ 2 2 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. … … 29 29 */ 30 30 31 #ifndef XFree86Server 32 #include <stdio.h> 33 #else 34 #include "GL/xf86glx.h" 35 #endif 31 #include "glheader.h" 36 32 #include "bbox.h" 37 33 #include "clip.h" … … 50 46 #include "stages.h" 51 47 #include "translate.h" 48 #include "state.h" 52 49 #include "xform.h" 50 #include "mem.h" 53 51 54 52 #ifndef MESA_VERBOSE … … 78 76 { 79 77 fprintf(stderr, 80 81 82 83 84 85 86 87 88 89 90 91 92 78 "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s\n", 79 msg, 80 flags, 81 (flags & PIPE_OP_CVA_PREPARE) ? "cva-prepare, " : "", 82 (flags & PIPE_OP_VERT_XFORM) ? "vert-xform, " : "", 83 (flags & PIPE_OP_NORM_XFORM) ? "norm-xform, " : "", 84 (flags & PIPE_OP_LIGHT) ? "light, " : "", 85 (flags & PIPE_OP_FOG) ? "fog, " : "", 86 (flags & PIPE_OP_TEX0) ? "tex-0, " : "", 87 (flags & PIPE_OP_TEX1) ? "tex-1, " : "", 88 (flags & PIPE_OP_RAST_SETUP_0) ? "rast-0, " : "", 89 (flags & PIPE_OP_RAST_SETUP_1) ? "rast-1, " : "", 90 (flags & PIPE_OP_RENDER) ? "render, " : ""); 93 91 94 92 } … … 111 109 { 112 110 if (VB->ClipOrMask & CLIP_USER_BIT) 113 111 MEMSET(VB->UserClipMask, 0, VB->Count); 114 112 115 113 VB->ClipOrMask = 0; … … 132 130 { 133 131 if (ctx->Light.Enabled) { 134 135 136 137 132 VB->Color[0] = VB->LitColor[0]; 133 VB->Color[1] = VB->LitColor[1]; 134 VB->Index[0] = VB->LitIndex[0]; 135 VB->Index[1] = VB->LitIndex[1]; 138 136 } else { 139 140 137 VB->Color[0] = VB->Color[1] = &ctx->CVA.v.Color; 138 VB->Index[0] = VB->Index[1] = &ctx->CVA.v.Index; 141 139 } 142 140 VB->ColorPtr = VB->Color[0]; … … 177 175 if (ctx->Driver.RegisterPipelineStages) 178 176 ctx->NrPipelineStages = 179 180 181 177 ctx->Driver.RegisterPipelineStages( ctx->PipelineStage, 178 gl_default_pipeline, 179 gl_default_nr_stages ); 182 180 else 183 181 { 184 182 MEMCPY( ctx->PipelineStage, 185 186 183 gl_default_pipeline, 184 sizeof(*gl_default_pipeline) * gl_default_nr_stages ); 187 185 188 186 ctx->NrPipelineStages = gl_default_nr_stages; … … 201 199 202 200 #define VERT_CURRENT_DATA (VERT_TEX0_1234|VERT_TEX1_1234|VERT_RGBA| \ 203 204 201 VERT_INDEX|VERT_EDGE|VERT_NORM| \ 202 VERT_MATERIAL) 205 203 206 204 /* Called prior to every recomputation of the CVA precalc data, except where 207 205 * the driver is able to calculate the pipeline unassisted. 208 206 */ 209 void gl_build_full_precalc_pipeline( GLcontext *ctx )207 static void build_full_precalc_pipeline( GLcontext *ctx ) 210 208 { 211 209 struct gl_pipeline_stage *pipeline = ctx->PipelineStage; … … 219 217 GLuint oldinputs = pre->inputs; 220 218 GLuint fallback = (VERT_CURRENT_DATA & ctx->Current.Flag & 221 219 ~ctx->Array.Summary); 222 220 GLuint changed_outputs = (ctx->Array.NewArrayState | 223 221 (fallback & cva->orflag)); 224 222 GLuint available = fallback | ctx->Array.Flags; 225 223 … … 261 259 if (pipeline[i].type & PIPE_PRECALC) 262 260 { 263 264 265 266 { 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 261 if ((newstate & pipeline[i].cva_state_change) || 262 (changed_outputs & pipeline[i].inputs) || 263 !pipeline[i].inputs) 264 { 265 changed_ops |= pipeline[i].ops; 266 changed_outputs |= pipeline[i].outputs; 267 pipeline[i].active &= ~PIPE_PRECALC; 268 269 if ((pipeline[i].inputs & ~available) == 0 && 270 (pipeline[i].ops & pre->ops) == 0) 271 { 272 pipeline[i].active |= PIPE_PRECALC; 273 *stages++ = &pipeline[i]; 274 } 275 } 276 277 /* Incompatible with multiple stages structs implementing 278 * the same stage. 279 */ 280 available &= ~pipeline[i].outputs; 281 pre->outputs &= ~pipeline[i].outputs; 282 283 if (pipeline[i].active & PIPE_PRECALC) { 284 pre->ops |= pipeline[i].ops; 285 pre->outputs |= pipeline[i].outputs; 286 available |= pipeline[i].outputs; 287 pre->forbidden_inputs |= pipeline[i].pre_forbidden_inputs; 288 } 291 289 } 292 290 else if (pipeline[i].active & PIPE_PRECALC) 293 291 { 294 295 296 292 pipeline[i].active &= ~PIPE_PRECALC; 293 changed_outputs |= pipeline[i].outputs; 294 changed_ops |= pipeline[i].ops; 297 295 } 298 296 } … … 318 316 if (!ctx->Driver.BuildPrecalcPipeline || 319 317 !ctx->Driver.BuildPrecalcPipeline( ctx )) 320 gl_build_full_precalc_pipeline( ctx );318 build_full_precalc_pipeline( ctx ); 321 319 322 320 pre->data_valid = 0; … … 331 329 332 330 333 static void gl_build_full_immediate_pipeline( GLcontext *ctx )331 static void build_full_immediate_pipeline( GLcontext *ctx ) 334 332 { 335 333 struct gl_pipeline_stage *pipeline = ctx->PipelineStage; … … 352 350 353 351 354 elt->outputs = 0; 352 elt->outputs = 0; /* not used */ 355 353 elt->inputs = 0; 356 354 … … 359 357 360 358 if ((pipeline[i].state_change & newstate) || 361 359 (pipeline[i].elt_forbidden_inputs & available)) 362 360 { 363 361 pipeline[i].check(ctx, &pipeline[i]); 364 362 } 365 363 366 364 if ((pipeline[i].type & PIPE_IMMEDIATE) && 367 368 369 365 (pipeline[i].ops & active_ops) == 0 && 366 (pipeline[i].elt_forbidden_inputs & available) == 0 367 ) 370 368 { 371 372 373 374 375 376 377 378 379 380 381 382 369 if (pipeline[i].inputs & ~available) 370 elt->forbidden_inputs |= pipeline[i].inputs & ~available; 371 else 372 { 373 elt->inputs |= pipeline[i].inputs & ~generated; 374 elt->forbidden_inputs |= pipeline[i].elt_forbidden_inputs; 375 pipeline[i].active |= PIPE_IMMEDIATE; 376 *stages++ = &pipeline[i]; 377 generated |= pipeline[i].outputs; 378 available |= pipeline[i].outputs; 379 active_ops |= pipeline[i].ops; 380 } 383 381 } 384 382 } … … 403 401 if (!ctx->Driver.BuildEltPipeline || 404 402 !ctx->Driver.BuildEltPipeline( ctx )) { 405 gl_build_full_immediate_pipeline( ctx );403 build_full_immediate_pipeline( ctx ); 406 404 } 407 405 … … 433 431 434 432 if (ctx->Visual->RGBAflag) 435 433 flags |= VERT_RGBA; 436 434 else 437 435 flags |= VERT_INDEX; 438 436 439 437 if (ctx->Texture.Enabled & 0xf) { 440 441 442 443 438 if (ctx->Texture.Unit[0].EnvMode == GL_REPLACE) 439 flags &= ~VERT_RGBA; 440 441 flags |= VERT_TEX0_ANY; 444 442 } 445 443 446 444 if (ctx->Texture.Enabled & 0xf0) 447 445 flags |= VERT_TEX1_ANY; 448 446 449 447 if (ctx->Polygon.Unfilled) 450 448 flags |= VERT_EDGE; 451 449 452 450 if (ctx->RenderMode==GL_FEEDBACK) 453 451 { 454 455 456 452 flags = (VERT_WIN|VERT_RGBA|VERT_INDEX| 453 VERT_NORM|VERT_EDGE| 454 VERT_TEX0_ANY|VERT_TEX1_ANY); 457 455 } 458 456 … … 481 479 struct gl_pipeline *pipe = VB->pipeline; 482 480 struct gl_pipeline_stage **stages = pipe->stages; 483 short x;484 485 pipe->data_valid = 1; 481 unsigned short x; 482 483 pipe->data_valid = 1; /* optimized stages might want to reset this. */ 486 484 487 485 START_FAST_MATH(x); … … 498 496 { 499 497 fprintf(stderr, 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 498 "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", 499 name, 500 flags, 501 (flags & VERT_OBJ_ANY) ? "vertices (obj), " : "", 502 (flags & VERT_ELT) ? "array-elt, " : "", 503 (flags & VERT_RGBA) ? "colors, " : "", 504 (flags & VERT_NORM) ? "normals, " : "", 505 (flags & VERT_INDEX) ? "index, " : "", 506 (flags & VERT_EDGE) ? "edgeflag, " : "", 507 (flags & VERT_MATERIAL) ? "material, " : "", 508 (flags & VERT_TEX0_ANY) ? "texcoord0, " : "", 509 (flags & VERT_TEX1_ANY) ? "texcoord1, " : "", 510 (flags & VERT_EVAL_ANY) ? "eval-coord, " : "", 511 (flags & VERT_EYE) ? "eye, " : "", 512 (flags & VERT_WIN) ? "win, " : "", 513 (flags & VERT_PRECALC_DATA) ? "precalc data, " : "", 514 (flags & VERT_SETUP_FULL) ? "driver-data, " : "", 515 (flags & VERT_SETUP_PART) ? "partial-driver-data, " : "" 518 516 ); 519 517 } … … 522 520 { 523 521 fprintf(stderr, 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 522 "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", 523 name, 524 flags, 525 (flags & DD_FEEDBACK) ? "feedback, " : "", 526 (flags & DD_SELECT) ? "select, " : "", 527 (flags & DD_FLATSHADE) ? "flat-shade, " : "", 528 (flags & DD_MULTIDRAW) ? "multidraw, " : "", 529 (flags & DD_SEPERATE_SPECULAR) ? "seperate-specular, " : "", 530 (flags & DD_TRI_LIGHT_TWOSIDE) ? "tri-light-twoside, " : "", 531 (flags & DD_TRI_UNFILLED) ? "tri-unfilled, " : "", 532 (flags & DD_TRI_STIPPLE) ? "tri-stipple, " : "", 533 (flags & DD_TRI_OFFSET) ? "tri-offset, " : "", 534 (flags & DD_TRI_CULL) ? "tri-bf-cull, " : "", 535 (flags & DD_LINE_SMOOTH) ? "line-smooth, " : "", 536 (flags & DD_LINE_STIPPLE) ? "line-stipple, " : "", 537 (flags & DD_LINE_WIDTH) ? "line-wide, " : "", 538 (flags & DD_POINT_SMOOTH) ? "point-smooth, " : "", 539 (flags & DD_POINT_SIZE) ? "point-size, " : "", 540 (flags & DD_POINT_ATTEN) ? "point-atten, " : "", 541 (flags & DD_LIGHTING_CULL) ? "lighting-cull, " : "", 542 (flags & DD_POINT_SW_RASTERIZE) ? "sw-points, " : "", 543 (flags & DD_LINE_SW_RASTERIZE) ? "sw-lines, " : "", 544 (flags & DD_TRI_SW_RASTERIZE) ? "sw-tris, " : "", 545 (flags & DD_QUAD_SW_RASTERIZE) ? "sw-quads, " : "", 546 (flags & DD_TRI_CULL_FRONT_BACK) ? "cull-all, " : "" 549 547 ); 550 548 } … … 569 567 if (0) 570 568 for (i = 0 ; i < ctx->NrPipelineStages ; i++) 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 569 if (pipeline[i].active & p->type) { 570 fprintf(stderr,"%u: %s\n", i, pipeline[i].name); 571 572 gl_print_vert_flags("\tinputs", pipeline[i].inputs); 573 gl_print_vert_flags("\toutputs", pipeline[i].outputs); 574 575 if (p->type == PIPE_PRECALC && pipeline[i].pre_forbidden_inputs) 576 gl_print_vert_flags("\tforbidden", 577 pipeline[i].pre_forbidden_inputs); 578 579 if (p->type == PIPE_IMMEDIATE && pipeline[i].elt_forbidden_inputs) 580 gl_print_vert_flags("\tforbidden", 581 pipeline[i].elt_forbidden_inputs); 582 583 } 586 584 587 585 … … 590 588 fprintf(stderr,"\nStages requiring precalculation:\n"); 591 589 for ( i=0 ; stages[i] ; i++) { 592 593 594 595 596 597 598 599 600 601 590 fprintf(stderr, "%u: %s\n", i, stages[i]->name); 591 gl_print_vert_flags("\tinputs", stages[i]->inputs); 592 gl_print_vert_flags("\toutputs", stages[i]->outputs); 593 if (p->type == PIPE_PRECALC && pipeline[i].pre_forbidden_inputs) 594 gl_print_vert_flags("\tforbidden", 595 pipeline[i].pre_forbidden_inputs); 596 597 if (p->type == PIPE_IMMEDIATE && pipeline[i].elt_forbidden_inputs) 598 gl_print_vert_flags("\tforbidden", 599 pipeline[i].elt_forbidden_inputs); 602 600 } 603 601 } … … 631 629 632 630 if (p->type == PIPE_PRECALC && stages[i]->pre_forbidden_inputs) 633 634 635 } 636 } 637 638 631 gl_print_vert_flags("\tforbidden", 632 stages[i]->pre_forbidden_inputs); 633 } 634 } 635 636
Note:
See TracChangeset
for help on using the changeset viewer.