1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
/* #include "mgapipeline.h" */
#include <stdio.h>
#include "mgavb.h"
#include "mgadd.h"
#include "mgalib.h"
#include "mgatris.h"
#include "mgapipeline.h"
#include "fog.h"
static struct gl_pipeline_stage mga_fast_stage = {
"MGA fast path",
(PIPE_OP_VERT_XFORM|PIPE_OP_RAST_SETUP_0|
PIPE_OP_RAST_SETUP_1|PIPE_OP_RENDER),
PIPE_PRECALC,
0, 0, 0, 0, 0, 0, 0, 0, 0,
mgaDDFastPath
};
#define ILLEGAL_ENABLES (TEXTURE0_3D| \
TEXTURE1_3D| \
ENABLE_TEXMAT0 | \
ENABLE_TEXMAT1 | \
ENABLE_TEXGEN0 | \
ENABLE_TEXGEN1 | \
ENABLE_USERCLIP | \
ENABLE_LIGHT | \
ENABLE_FOG)
/* The driver gets first shot at building the pipeline - make some
* quick tests to see if we can use the fast path.
*/
GLboolean mgaDDBuildPrecalcPipeline( GLcontext *ctx )
{
struct gl_pipeline *pipe = &ctx->CVA.pre;
mgaContextPtr mmesa = MGA_CONTEXT( ctx );
if (mmesa->renderindex == 0 &&
(ctx->Enabled & ILLEGAL_ENABLES) == 0 &&
(ctx->Array.Flags & (VERT_OBJ_234|
VERT_TEX0_4|
VERT_TEX1_4|
VERT_ELT)) == (VERT_OBJ_23|VERT_ELT))
{
pipe->stages[0] = &mga_fast_stage;
pipe->stages[1] = 0;
pipe->new_inputs = ctx->RenderFlags & VERT_DATA;
pipe->ops = pipe->stages[0]->ops;
mmesa->using_fast_path = 1;
return 1;
}
if (mmesa->using_fast_path)
{
mmesa->using_fast_path = 0;
ctx->CVA.VB->ClipOrMask = 0;
ctx->CVA.VB->ClipAndMask = CLIP_ALL_BITS;
ctx->Array.NewArrayState |= ctx->Array.Summary;
return 0;
}
return 0;
}
/* Still do the normal fixup and copy-to-current, so this isn't so
* bad.
*/
#define ILLEGAL_INPUTS_IMM (VERT_OBJ_4| \
VERT_TEX0_4| \
VERT_TEX1_4| \
VERT_MATERIAL)
static void mgaDDCheckRasterSetup( GLcontext *ctx, struct gl_pipeline_stage *d )
{
d->type = PIPE_IMMEDIATE|PIPE_PRECALC;
d->inputs = ctx->RenderFlags;
/* MGA requires an extra input:
*/
if (ctx->FogMode == FOG_FRAGMENT)
d->inputs |= VERT_FOG_COORD;
d->outputs = VERT_SETUP_FULL;
if (ctx->IndirectTriangles & DD_SW_SETUP)
d->type = PIPE_IMMEDIATE;
}
GLuint mgaDDRegisterPipelineStages( struct gl_pipeline_stage *out,
const struct gl_pipeline_stage *in,
GLuint nr )
{
GLuint i, o;
for (i = o = 0 ; i < nr ; i++) {
switch (in[i].ops) {
/* Completely replace Mesa's fog processing to generate fog
* coordinates instead of messing with colors.
*/
case PIPE_OP_FOG:
out[o] = gl_fog_coord_stage;
o++;
break;
case PIPE_OP_RAST_SETUP_0:
out[o] = in[i];
out[o].cva_state_change = NEW_LIGHTING|NEW_TEXTURING|NEW_RASTER_OPS;
out[o].state_change = ~0;
out[o].check = mgaDDCheckPartialRasterSetup;
out[o].run = mgaDDPartialRasterSetup;
o++;
break;
case PIPE_OP_RAST_SETUP_0|PIPE_OP_RAST_SETUP_1:
out[o] = in[i];
out[o].check = mgaDDCheckRasterSetup;
out[o].run = mgaDDDoRasterSetup;
o++;
break;
default:
out[o++] = in[i];
break;
}
}
return o;
}
|