2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 * Triangle Rasterizer Template
28 * This file is #include'd to generate custom triangle rasterizers.
30 * The following macros may be defined to indicate what auxillary information
31 * must be interplated across the triangle:
32 * INTERP_Z - if defined, interpolate Z values
33 * INTERP_FOG - if defined, interpolate fog values
34 * INTERP_RGB - if defined, interpolate RGB values
35 * INTERP_ALPHA - if defined, interpolate Alpha values (req's INTERP_RGB)
36 * INTERP_SPEC - if defined, interpolate specular RGB values
37 * INTERP_INDEX - if defined, interpolate color index values
38 * INTERP_INT_TEX - if defined, interpolate integer ST texcoords
39 * (fast, simple 2-D texture mapping)
40 * INTERP_TEX - if defined, interpolate set 0 float STRQ texcoords
41 * NOTE: OpenGL STRQ = Mesa STUV (R was taken for red)
42 * INTERP_MULTITEX - if defined, interpolate N units of STRQ texcoords
44 * When one can directly address pixels in the color buffer the following
45 * macros can be defined and used to compute pixel addresses during
46 * rasterization (see pRow):
47 * PIXEL_TYPE - the datatype of a pixel (GLubyte, GLushort, GLuint)
48 * BYTES_PER_ROW - number of bytes per row in the color buffer
49 * PIXEL_ADDRESS(X,Y) - returns the address of pixel at (X,Y) where
50 * Y==0 at bottom of screen and increases upward.
52 * Similarly, for direct depth buffer access, this type is used for depth
54 * DEPTH_TYPE - either GLushort or GLuint
56 * Optionally, one may provide one-time setup code per triangle:
57 * SETUP_CODE - code which is to be executed once per triangle
58 * CLEANUP_CODE - code to execute at end of triangle
60 * The following macro MUST be defined:
61 * RENDER_SPAN(span) - code to write a span of pixels.
63 * This code was designed for the origin to be in the lower-left corner.
65 * Inspired by triangle rasterizer code written by Allen Akin. Thanks Allen!
70 * ColorTemp is used for intermediate color values.
72 #if CHAN_TYPE == GL_FLOAT
73 #define ColorTemp GLfloat
75 #define ColorTemp GLint /* same as GLfixed */
79 * Either loop over all texture units, or just use unit zero.
81 #ifdef INTERP_MULTITEX
82 #define TEX_UNIT_LOOP(CODE) \
85 for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
86 if (ctx->Texture._EnabledCoordUnits & (1 << u)) { \
92 #elif defined(INTERP_TEX)
93 #define TEX_UNIT_LOOP(CODE) \
101 static void NAME(GLcontext
*ctx
, const SWvertex
*v0
,
106 const SWvertex
*v0
, *v1
; /* Y(v0) < Y(v1) */
107 GLfloat dx
; /* X(v1) - X(v0) */
108 GLfloat dy
; /* Y(v1) - Y(v0) */
109 GLfixed fdxdy
; /* dx/dy in fixed-point */
110 GLfixed fsx
; /* first sample point x coord */
112 GLfloat adjy
; /* adjust from v[0]->fy to fsy, scaled */
113 GLint lines
; /* number of lines to be sampled on this edge */
114 GLfixed fx0
; /* fixed pt X of lower endpoint */
118 const GLint depthBits
= ctx
->Visual
.depthBits
;
119 const GLint fixedToDepthShift
= depthBits
<= 16 ? FIXED_SHIFT
: 0;
120 const GLfloat maxDepth
= ctx
->DepthMaxF
;
121 #define FixedToDepth(F) ((F) >> fixedToDepthShift)
123 EdgeT eMaj
, eTop
, eBot
;
125 const SWvertex
*vMin
, *vMid
, *vMax
; /* Y(vMin)<=Y(vMid)<=Y(vMax) */
126 GLfloat bf
= SWRAST_CONTEXT(ctx
)->_BackfaceSign
;
127 const GLint snapMask
= ~((FIXED_ONE
/ (1 << SUB_PIXEL_BITS
)) - 1); /* for x/y coord snapping */
128 GLfixed vMin_fx
, vMin_fy
, vMid_fx
, vMid_fy
, vMax_fx
, vMax_fy
;
132 INIT_SPAN(span
, GL_POLYGON
, 0, 0, 0);
135 (void) fixedToDepthShift
;
139 printf("%s()\n", __FUNCTION__);
140 printf(" %g, %g, %g\n", v0->win[0], v0->win[1], v0->win[2]);
141 printf(" %g, %g, %g\n", v1->win[0], v1->win[1], v1->win[2]);
142 printf(" %g, %g, %g\n", v2->win[0], v2->win[1], v2->win[2]);
145 /* Compute fixed point x,y coords w/ half-pixel offsets and snapping.
146 * And find the order of the 3 vertices along the Y axis.
149 const GLfixed fy0
= FloatToFixed(v0
->win
[1] - 0.5F
) & snapMask
;
150 const GLfixed fy1
= FloatToFixed(v1
->win
[1] - 0.5F
) & snapMask
;
151 const GLfixed fy2
= FloatToFixed(v2
->win
[1] - 0.5F
) & snapMask
;
156 vMin
= v0
; vMid
= v1
; vMax
= v2
;
157 vMin_fy
= fy0
; vMid_fy
= fy1
; vMax_fy
= fy2
;
159 else if (fy2
<= fy0
) {
161 vMin
= v2
; vMid
= v0
; vMax
= v1
;
162 vMin_fy
= fy2
; vMid_fy
= fy0
; vMax_fy
= fy1
;
166 vMin
= v0
; vMid
= v2
; vMax
= v1
;
167 vMin_fy
= fy0
; vMid_fy
= fy2
; vMax_fy
= fy1
;
174 vMin
= v1
; vMid
= v0
; vMax
= v2
;
175 vMin_fy
= fy1
; vMid_fy
= fy0
; vMax_fy
= fy2
;
178 else if (fy2
<= fy1
) {
180 vMin
= v2
; vMid
= v1
; vMax
= v0
;
181 vMin_fy
= fy2
; vMid_fy
= fy1
; vMax_fy
= fy0
;
186 vMin
= v1
; vMid
= v2
; vMax
= v0
;
187 vMin_fy
= fy1
; vMid_fy
= fy2
; vMax_fy
= fy0
;
191 /* fixed point X coords */
192 vMin_fx
= FloatToFixed(vMin
->win
[0] + 0.5F
) & snapMask
;
193 vMid_fx
= FloatToFixed(vMid
->win
[0] + 0.5F
) & snapMask
;
194 vMax_fx
= FloatToFixed(vMax
->win
[0] + 0.5F
) & snapMask
;
197 /* vertex/edge relationship */
198 eMaj
.v0
= vMin
; eMaj
.v1
= vMax
; /*TODO: .v1's not needed */
199 eTop
.v0
= vMid
; eTop
.v1
= vMax
;
200 eBot
.v0
= vMin
; eBot
.v1
= vMid
;
202 /* compute deltas for each edge: vertex[upper] - vertex[lower] */
203 eMaj
.dx
= FixedToFloat(vMax_fx
- vMin_fx
);
204 eMaj
.dy
= FixedToFloat(vMax_fy
- vMin_fy
);
205 eTop
.dx
= FixedToFloat(vMax_fx
- vMid_fx
);
206 eTop
.dy
= FixedToFloat(vMax_fy
- vMid_fy
);
207 eBot
.dx
= FixedToFloat(vMid_fx
- vMin_fx
);
208 eBot
.dy
= FixedToFloat(vMid_fy
- vMin_fy
);
210 /* compute area, oneOverArea and perform backface culling */
212 const GLfloat area
= eMaj
.dx
* eBot
.dy
- eBot
.dx
* eMaj
.dy
;
214 /* Do backface culling */
218 if (IS_INF_OR_NAN(area
) || area
== 0.0F
)
221 oneOverArea
= 1.0F
/ area
;
224 #ifndef DO_OCCLUSION_TEST
225 ctx
->OcclusionResult
= GL_TRUE
;
227 span
.facing
= ctx
->_Facing
; /* for 2-sided stencil test */
229 /* Edge setup. For a triangle strip these could be reused... */
231 eMaj
.fsy
= FixedCeil(vMin_fy
);
232 eMaj
.lines
= FixedToInt(FixedCeil(vMax_fy
- eMaj
.fsy
));
233 if (eMaj
.lines
> 0) {
234 GLfloat dxdy
= eMaj
.dx
/ eMaj
.dy
;
235 eMaj
.fdxdy
= SignedFloatToFixed(dxdy
);
236 eMaj
.adjy
= (GLfloat
) (eMaj
.fsy
- vMin_fy
); /* SCALED! */
238 eMaj
.fsx
= eMaj
.fx0
+ (GLfixed
) (eMaj
.adjy
* dxdy
);
244 eTop
.fsy
= FixedCeil(vMid_fy
);
245 eTop
.lines
= FixedToInt(FixedCeil(vMax_fy
- eTop
.fsy
));
246 if (eTop
.lines
> 0) {
247 GLfloat dxdy
= eTop
.dx
/ eTop
.dy
;
248 eTop
.fdxdy
= SignedFloatToFixed(dxdy
);
249 eTop
.adjy
= (GLfloat
) (eTop
.fsy
- vMid_fy
); /* SCALED! */
251 eTop
.fsx
= eTop
.fx0
+ (GLfixed
) (eTop
.adjy
* dxdy
);
254 eBot
.fsy
= FixedCeil(vMin_fy
);
255 eBot
.lines
= FixedToInt(FixedCeil(vMid_fy
- eBot
.fsy
));
256 if (eBot
.lines
> 0) {
257 GLfloat dxdy
= eBot
.dx
/ eBot
.dy
;
258 eBot
.fdxdy
= SignedFloatToFixed(dxdy
);
259 eBot
.adjy
= (GLfloat
) (eBot
.fsy
- vMin_fy
); /* SCALED! */
261 eBot
.fsx
= eBot
.fx0
+ (GLfixed
) (eBot
.adjy
* dxdy
);
266 * Conceptually, we view a triangle as two subtriangles
267 * separated by a perfectly horizontal line. The edge that is
268 * intersected by this line is one with maximal absolute dy; we
269 * call it a ``major'' edge. The other two edges are the
270 * ``top'' edge (for the upper subtriangle) and the ``bottom''
271 * edge (for the lower subtriangle). If either of these two
272 * edges is horizontal or very close to horizontal, the
273 * corresponding subtriangle might cover zero sample points;
274 * we take care to handle such cases, for performance as well
277 * By stepping rasterization parameters along the major edge,
278 * we can avoid recomputing them at the discontinuity where
279 * the top and bottom edges meet. However, this forces us to
280 * be able to scan both left-to-right and right-to-left.
281 * Also, we must determine whether the major edge is at the
282 * left or right side of the triangle. We do this by
283 * computing the magnitude of the cross-product of the major
284 * and top edges. Since this magnitude depends on the sine of
285 * the angle between the two edges, its sign tells us whether
286 * we turn to the left or to the right when travelling along
287 * the major edge to the top edge, and from this we infer
288 * whether the major edge is on the left or the right.
290 * Serendipitously, this cross-product magnitude is also a
291 * value we need to compute the iteration parameter
292 * derivatives for the triangle, and it can be used to perform
293 * backface culling because its sign tells us whether the
294 * triangle is clockwise or counterclockwise. In this code we
295 * refer to it as ``area'' because it's also proportional to
296 * the pixel area of the triangle.
300 GLint scan_from_left_to_right
; /* true if scanning left-to-right */
306 * Execute user-supplied setup code
312 scan_from_left_to_right
= (oneOverArea
< 0.0F
);
315 /* compute d?/dx and d?/dy derivatives */
317 span
.interpMask
|= SPAN_Z
;
319 GLfloat eMaj_dz
= vMax
->win
[2] - vMin
->win
[2];
320 GLfloat eBot_dz
= vMid
->win
[2] - vMin
->win
[2];
321 span
.dzdx
= oneOverArea
* (eMaj_dz
* eBot
.dy
- eMaj
.dy
* eBot_dz
);
322 if (span
.dzdx
> maxDepth
|| span
.dzdx
< -maxDepth
) {
323 /* probably a sliver triangle */
328 span
.dzdy
= oneOverArea
* (eMaj
.dx
* eBot_dz
- eMaj_dz
* eBot
.dx
);
331 span
.zStep
= SignedFloatToFixed(span
.dzdx
);
333 span
.zStep
= (GLint
) span
.dzdx
;
338 const GLfloat eMaj_dw
= vMax
->win
[3] - vMin
->win
[3];
339 const GLfloat eBot_dw
= vMid
->win
[3] - vMin
->win
[3];
340 span
.dwdx
= oneOverArea
* (eMaj_dw
* eBot
.dy
- eMaj
.dy
* eBot_dw
);
341 span
.dwdy
= oneOverArea
* (eMaj
.dx
* eBot_dw
- eMaj_dw
* eBot
.dx
);
345 span
.interpMask
|= SPAN_FOG
;
347 const GLfloat eMaj_dfog
= vMax
->fog
- vMin
->fog
;
348 const GLfloat eBot_dfog
= vMid
->fog
- vMin
->fog
;
349 span
.dfogdx
= oneOverArea
* (eMaj_dfog
* eBot
.dy
- eMaj
.dy
* eBot_dfog
);
350 span
.dfogdy
= oneOverArea
* (eMaj
.dx
* eBot_dfog
- eMaj_dfog
* eBot
.dx
);
351 span
.fogStep
= span
.dfogdx
;
355 span
.interpMask
|= SPAN_RGBA
;
356 if (ctx
->Light
.ShadeModel
== GL_SMOOTH
) {
357 GLfloat eMaj_dr
= (GLfloat
) ((ColorTemp
) vMax
->color
[RCOMP
] - vMin
->color
[RCOMP
]);
358 GLfloat eBot_dr
= (GLfloat
) ((ColorTemp
) vMid
->color
[RCOMP
] - vMin
->color
[RCOMP
]);
359 GLfloat eMaj_dg
= (GLfloat
) ((ColorTemp
) vMax
->color
[GCOMP
] - vMin
->color
[GCOMP
]);
360 GLfloat eBot_dg
= (GLfloat
) ((ColorTemp
) vMid
->color
[GCOMP
] - vMin
->color
[GCOMP
]);
361 GLfloat eMaj_db
= (GLfloat
) ((ColorTemp
) vMax
->color
[BCOMP
] - vMin
->color
[BCOMP
]);
362 GLfloat eBot_db
= (GLfloat
) ((ColorTemp
) vMid
->color
[BCOMP
] - vMin
->color
[BCOMP
]);
364 GLfloat eMaj_da
= (GLfloat
) ((ColorTemp
) vMax
->color
[ACOMP
] - vMin
->color
[ACOMP
]);
365 GLfloat eBot_da
= (GLfloat
) ((ColorTemp
) vMid
->color
[ACOMP
] - vMin
->color
[ACOMP
]);
367 span
.drdx
= oneOverArea
* (eMaj_dr
* eBot
.dy
- eMaj
.dy
* eBot_dr
);
368 span
.drdy
= oneOverArea
* (eMaj
.dx
* eBot_dr
- eMaj_dr
* eBot
.dx
);
369 span
.dgdx
= oneOverArea
* (eMaj_dg
* eBot
.dy
- eMaj
.dy
* eBot_dg
);
370 span
.dgdy
= oneOverArea
* (eMaj
.dx
* eBot_dg
- eMaj_dg
* eBot
.dx
);
371 span
.dbdx
= oneOverArea
* (eMaj_db
* eBot
.dy
- eMaj
.dy
* eBot_db
);
372 span
.dbdy
= oneOverArea
* (eMaj
.dx
* eBot_db
- eMaj_db
* eBot
.dx
);
373 # if CHAN_TYPE == GL_FLOAT
374 span
.redStep
= span
.drdx
;
375 span
.greenStep
= span
.dgdx
;
376 span
.blueStep
= span
.dbdx
;
378 span
.redStep
= SignedFloatToFixed(span
.drdx
);
379 span
.greenStep
= SignedFloatToFixed(span
.dgdx
);
380 span
.blueStep
= SignedFloatToFixed(span
.dbdx
);
381 # endif /* GL_FLOAT */
383 span
.dadx
= oneOverArea
* (eMaj_da
* eBot
.dy
- eMaj
.dy
* eBot_da
);
384 span
.dady
= oneOverArea
* (eMaj
.dx
* eBot_da
- eMaj_da
* eBot
.dx
);
385 # if CHAN_TYPE == GL_FLOAT
386 span
.alphaStep
= span
.dadx
;
388 span
.alphaStep
= SignedFloatToFixed(span
.dadx
);
389 # endif /* GL_FLOAT */
390 # endif /* INTERP_ALPHA */
393 ASSERT (ctx
->Light
.ShadeModel
== GL_FLAT
);
394 span
.interpMask
|= SPAN_FLAT
;
395 span
.drdx
= span
.drdy
= 0.0F
;
396 span
.dgdx
= span
.dgdy
= 0.0F
;
397 span
.dbdx
= span
.dbdy
= 0.0F
;
398 # if CHAN_TYPE == GL_FLOAT
400 span
.greenStep
= 0.0F
;
401 span
.blueStep
= 0.0F
;
406 # endif /* GL_FLOAT */
408 span
.dadx
= span
.dady
= 0.0F
;
409 # if CHAN_TYPE == GL_FLOAT
410 span
.alphaStep
= 0.0F
;
413 # endif /* GL_FLOAT */
416 #endif /* INTERP_RGB */
418 span
.interpMask
|= SPAN_SPEC
;
419 if (ctx
->Light
.ShadeModel
== GL_SMOOTH
) {
420 GLfloat eMaj_dsr
= (GLfloat
) ((ColorTemp
) vMax
->specular
[RCOMP
] - vMin
->specular
[RCOMP
]);
421 GLfloat eBot_dsr
= (GLfloat
) ((ColorTemp
) vMid
->specular
[RCOMP
] - vMin
->specular
[RCOMP
]);
422 GLfloat eMaj_dsg
= (GLfloat
) ((ColorTemp
) vMax
->specular
[GCOMP
] - vMin
->specular
[GCOMP
]);
423 GLfloat eBot_dsg
= (GLfloat
) ((ColorTemp
) vMid
->specular
[GCOMP
] - vMin
->specular
[GCOMP
]);
424 GLfloat eMaj_dsb
= (GLfloat
) ((ColorTemp
) vMax
->specular
[BCOMP
] - vMin
->specular
[BCOMP
]);
425 GLfloat eBot_dsb
= (GLfloat
) ((ColorTemp
) vMid
->specular
[BCOMP
] - vMin
->specular
[BCOMP
]);
426 span
.dsrdx
= oneOverArea
* (eMaj_dsr
* eBot
.dy
- eMaj
.dy
* eBot_dsr
);
427 span
.dsrdy
= oneOverArea
* (eMaj
.dx
* eBot_dsr
- eMaj_dsr
* eBot
.dx
);
428 span
.dsgdx
= oneOverArea
* (eMaj_dsg
* eBot
.dy
- eMaj
.dy
* eBot_dsg
);
429 span
.dsgdy
= oneOverArea
* (eMaj
.dx
* eBot_dsg
- eMaj_dsg
* eBot
.dx
);
430 span
.dsbdx
= oneOverArea
* (eMaj_dsb
* eBot
.dy
- eMaj
.dy
* eBot_dsb
);
431 span
.dsbdy
= oneOverArea
* (eMaj
.dx
* eBot_dsb
- eMaj_dsb
* eBot
.dx
);
432 # if CHAN_TYPE == GL_FLOAT
433 span
.specRedStep
= span
.dsrdx
;
434 span
.specGreenStep
= span
.dsgdx
;
435 span
.specBlueStep
= span
.dsbdx
;
437 span
.specRedStep
= SignedFloatToFixed(span
.dsrdx
);
438 span
.specGreenStep
= SignedFloatToFixed(span
.dsgdx
);
439 span
.specBlueStep
= SignedFloatToFixed(span
.dsbdx
);
443 span
.dsrdx
= span
.dsrdy
= 0.0F
;
444 span
.dsgdx
= span
.dsgdy
= 0.0F
;
445 span
.dsbdx
= span
.dsbdy
= 0.0F
;
446 # if CHAN_TYPE == GL_FLOAT
447 span
.specRedStep
= 0.0F
;
448 span
.specGreenStep
= 0.0F
;
449 span
.specBlueStep
= 0.0F
;
451 span
.specRedStep
= 0;
452 span
.specGreenStep
= 0;
453 span
.specBlueStep
= 0;
456 #endif /* INTERP_SPEC */
458 span
.interpMask
|= SPAN_INDEX
;
459 if (ctx
->Light
.ShadeModel
== GL_SMOOTH
) {
460 GLfloat eMaj_di
= (GLfloat
) ((GLint
) vMax
->index
- (GLint
) vMin
->index
);
461 GLfloat eBot_di
= (GLfloat
) ((GLint
) vMid
->index
- (GLint
) vMin
->index
);
462 didx
= oneOverArea
* (eMaj_di
* eBot
.dy
- eMaj
.dy
* eBot_di
);
463 didy
= oneOverArea
* (eMaj
.dx
* eBot_di
- eMaj_di
* eBot
.dx
);
464 span
.indexStep
= SignedFloatToFixed(didx
);
467 span
.interpMask
|= SPAN_FLAT
;
472 #ifdef INTERP_INT_TEX
473 span
.interpMask
|= SPAN_INT_TEXTURE
;
475 GLfloat eMaj_ds
= (vMax
->texcoord
[0][0] - vMin
->texcoord
[0][0]) * S_SCALE
;
476 GLfloat eBot_ds
= (vMid
->texcoord
[0][0] - vMin
->texcoord
[0][0]) * S_SCALE
;
477 GLfloat eMaj_dt
= (vMax
->texcoord
[0][1] - vMin
->texcoord
[0][1]) * T_SCALE
;
478 GLfloat eBot_dt
= (vMid
->texcoord
[0][1] - vMin
->texcoord
[0][1]) * T_SCALE
;
479 span
.texStepX
[0][0] = oneOverArea
* (eMaj_ds
* eBot
.dy
- eMaj
.dy
* eBot_ds
);
480 span
.texStepY
[0][0] = oneOverArea
* (eMaj
.dx
* eBot_ds
- eMaj_ds
* eBot
.dx
);
481 span
.texStepX
[0][1] = oneOverArea
* (eMaj_dt
* eBot
.dy
- eMaj
.dy
* eBot_dt
);
482 span
.texStepY
[0][1] = oneOverArea
* (eMaj
.dx
* eBot_dt
- eMaj_dt
* eBot
.dx
);
483 span
.intTexStep
[0] = SignedFloatToFixed(span
.texStepX
[0][0]);
484 span
.intTexStep
[1] = SignedFloatToFixed(span
.texStepX
[0][1]);
488 span
.interpMask
|= SPAN_TEXTURE
;
491 const GLfloat wMax
= vMax
->win
[3], wMin
= vMin
->win
[3], wMid
= vMid
->win
[3];
493 GLfloat eMaj_ds
= vMax
->texcoord
[u
][0] * wMax
- vMin
->texcoord
[u
][0] * wMin
;
494 GLfloat eBot_ds
= vMid
->texcoord
[u
][0] * wMid
- vMin
->texcoord
[u
][0] * wMin
;
495 GLfloat eMaj_dt
= vMax
->texcoord
[u
][1] * wMax
- vMin
->texcoord
[u
][1] * wMin
;
496 GLfloat eBot_dt
= vMid
->texcoord
[u
][1] * wMid
- vMin
->texcoord
[u
][1] * wMin
;
497 GLfloat eMaj_du
= vMax
->texcoord
[u
][2] * wMax
- vMin
->texcoord
[u
][2] * wMin
;
498 GLfloat eBot_du
= vMid
->texcoord
[u
][2] * wMid
- vMin
->texcoord
[u
][2] * wMin
;
499 GLfloat eMaj_dv
= vMax
->texcoord
[u
][3] * wMax
- vMin
->texcoord
[u
][3] * wMin
;
500 GLfloat eBot_dv
= vMid
->texcoord
[u
][3] * wMid
- vMin
->texcoord
[u
][3] * wMin
;
501 span
.texStepX
[u
][0] = oneOverArea
* (eMaj_ds
* eBot
.dy
- eMaj
.dy
* eBot_ds
);
502 span
.texStepY
[u
][0] = oneOverArea
* (eMaj
.dx
* eBot_ds
- eMaj_ds
* eBot
.dx
);
503 span
.texStepX
[u
][1] = oneOverArea
* (eMaj_dt
* eBot
.dy
- eMaj
.dy
* eBot_dt
);
504 span
.texStepY
[u
][1] = oneOverArea
* (eMaj
.dx
* eBot_dt
- eMaj_dt
* eBot
.dx
);
505 span
.texStepX
[u
][2] = oneOverArea
* (eMaj_du
* eBot
.dy
- eMaj
.dy
* eBot_du
);
506 span
.texStepY
[u
][2] = oneOverArea
* (eMaj
.dx
* eBot_du
- eMaj_du
* eBot
.dx
);
507 span
.texStepX
[u
][3] = oneOverArea
* (eMaj_dv
* eBot
.dy
- eMaj
.dy
* eBot_dv
);
508 span
.texStepY
[u
][3] = oneOverArea
* (eMaj
.dx
* eBot_dv
- eMaj_dv
* eBot
.dx
);
514 * We always sample at pixel centers. However, we avoid
515 * explicit half-pixel offsets in this code by incorporating
516 * the proper offset in each of x and y during the
517 * transformation to window coordinates.
519 * We also apply the usual rasterization rules to prevent
520 * cracks and overlaps. A pixel is considered inside a
521 * subtriangle if it meets all of four conditions: it is on or
522 * to the right of the left edge, strictly to the left of the
523 * right edge, on or below the top edge, and strictly above
524 * the bottom edge. (Some edges may be degenerate.)
526 * The following discussion assumes left-to-right scanning
527 * (that is, the major edge is on the left); the right-to-left
528 * case is a straightforward variation.
530 * We start by finding the half-integral y coordinate that is
531 * at or below the top of the triangle. This gives us the
532 * first scan line that could possibly contain pixels that are
533 * inside the triangle.
535 * Next we creep down the major edge until we reach that y,
536 * and compute the corresponding x coordinate on the edge.
537 * Then we find the half-integral x that lies on or just
538 * inside the edge. This is the first pixel that might lie in
539 * the interior of the triangle. (We won't know for sure
540 * until we check the other edges.)
542 * As we rasterize the triangle, we'll step down the major
543 * edge. For each step in y, we'll move an integer number
544 * of steps in x. There are two possible x step sizes, which
545 * we'll call the ``inner'' step (guaranteed to land on the
546 * edge or inside it) and the ``outer'' step (guaranteed to
547 * land on the edge or outside it). The inner and outer steps
548 * differ by one. During rasterization we maintain an error
549 * term that indicates our distance from the true edge, and
550 * select either the inner step or the outer step, whichever
551 * gets us to the first pixel that falls inside the triangle.
553 * All parameters (z, red, etc.) as well as the buffer
554 * addresses for color and z have inner and outer step values,
555 * so that we can increment them appropriately. This method
556 * eliminates the need to adjust parameters by creeping a
557 * sub-pixel amount into the triangle at each scanline.
563 GLfixed fxLeftEdge
= 0, fxRightEdge
= 0;
564 GLfixed fdxLeftEdge
= 0, fdxRightEdge
= 0;
568 GLfixed fError
= 0, fdError
= 0;
572 PIXEL_TYPE
*pRow
= NULL
;
573 int dPRowOuter
= 0, dPRowInner
; /* offset in bytes */
577 DEPTH_TYPE
*zRow
= NULL
;
578 int dZRowOuter
= 0, dZRowInner
; /* offset in bytes */
580 GLfixed zLeft
= 0, fdzOuter
= 0, fdzInner
;
583 GLfloat wLeft
= 0, dwOuter
= 0, dwInner
;
586 GLfloat fogLeft
= 0, dfogOuter
= 0, dfogInner
;
589 ColorTemp rLeft
= 0, fdrOuter
= 0, fdrInner
;
590 ColorTemp gLeft
= 0, fdgOuter
= 0, fdgInner
;
591 ColorTemp bLeft
= 0, fdbOuter
= 0, fdbInner
;
594 ColorTemp aLeft
= 0, fdaOuter
= 0, fdaInner
;
597 ColorTemp srLeft
=0, dsrOuter
=0, dsrInner
;
598 ColorTemp sgLeft
=0, dsgOuter
=0, dsgInner
;
599 ColorTemp sbLeft
=0, dsbOuter
=0, dsbInner
;
602 GLfixed iLeft
=0, diOuter
=0, diInner
;
604 #ifdef INTERP_INT_TEX
605 GLfixed sLeft
=0, dsOuter
=0, dsInner
;
606 GLfixed tLeft
=0, dtOuter
=0, dtInner
;
609 GLfloat sLeft
[MAX_TEXTURE_COORD_UNITS
];
610 GLfloat tLeft
[MAX_TEXTURE_COORD_UNITS
];
611 GLfloat uLeft
[MAX_TEXTURE_COORD_UNITS
];
612 GLfloat vLeft
[MAX_TEXTURE_COORD_UNITS
];
613 GLfloat dsOuter
[MAX_TEXTURE_COORD_UNITS
], dsInner
[MAX_TEXTURE_COORD_UNITS
];
614 GLfloat dtOuter
[MAX_TEXTURE_COORD_UNITS
], dtInner
[MAX_TEXTURE_COORD_UNITS
];
615 GLfloat duOuter
[MAX_TEXTURE_COORD_UNITS
], duInner
[MAX_TEXTURE_COORD_UNITS
];
616 GLfloat dvOuter
[MAX_TEXTURE_COORD_UNITS
], dvInner
[MAX_TEXTURE_COORD_UNITS
];
619 for (subTriangle
=0; subTriangle
<=1; subTriangle
++) {
620 EdgeT
*eLeft
, *eRight
;
621 int setupLeft
, setupRight
;
624 if (subTriangle
==0) {
626 if (scan_from_left_to_right
) {
629 lines
= eRight
->lines
;
636 lines
= eLeft
->lines
;
643 if (scan_from_left_to_right
) {
646 lines
= eRight
->lines
;
653 lines
= eLeft
->lines
;
661 if (setupLeft
&& eLeft
->lines
> 0) {
662 const SWvertex
*vLower
;
663 GLfixed fsx
= eLeft
->fsx
;
665 fError
= fx
- fsx
- FIXED_ONE
;
666 fxLeftEdge
= fsx
- FIXED_EPSILON
;
667 fdxLeftEdge
= eLeft
->fdxdy
;
668 fdxOuter
= FixedFloor(fdxLeftEdge
- FIXED_EPSILON
);
669 fdError
= fdxOuter
- fdxLeftEdge
+ FIXED_ONE
;
670 idxOuter
= FixedToInt(fdxOuter
);
671 dxOuter
= (float) idxOuter
;
675 span
.y
= FixedToInt(fy
);
677 adjx
= (float)(fx
- eLeft
->fx0
); /* SCALED! */
678 adjy
= eLeft
->adjy
; /* SCALED! */
680 (void) adjx
; /* silence compiler warnings */
681 (void) adjy
; /* silence compiler warnings */
685 (void) vLower
; /* silence compiler warnings */
690 pRow
= (PIXEL_TYPE
*) PIXEL_ADDRESS(FixedToInt(fxLeftEdge
), span
.y
);
691 dPRowOuter
= -((int)BYTES_PER_ROW
) + idxOuter
* sizeof(PIXEL_TYPE
);
692 /* negative because Y=0 at bottom and increases upward */
696 * Now we need the set of parameter (z, color, etc.) values at
697 * the point (fx, fy). This gives us properly-sampled parameter
698 * values that we can step from pixel to pixel. Furthermore,
699 * although we might have intermediate results that overflow
700 * the normal parameter range when we step temporarily outside
701 * the triangle, we shouldn't overflow or underflow for any
702 * pixel that's actually inside the triangle.
707 GLfloat z0
= vLower
->win
[2];
708 if (depthBits
<= 16) {
709 /* interpolate fixed-pt values */
710 GLfloat tmp
= (z0
* FIXED_SCALE
+ span
.dzdx
* adjx
+ span
.dzdy
* adjy
) + FIXED_HALF
;
711 if (tmp
< MAX_GLUINT
/ 2)
712 zLeft
= (GLfixed
) tmp
;
714 zLeft
= MAX_GLUINT
/ 2;
715 fdzOuter
= SignedFloatToFixed(span
.dzdy
+ dxOuter
* span
.dzdx
);
718 /* interpolate depth values exactly */
719 zLeft
= (GLint
) (z0
+ span
.dzdx
* FixedToFloat(adjx
) + span
.dzdy
* FixedToFloat(adjy
));
720 fdzOuter
= (GLint
) (span
.dzdy
+ dxOuter
* span
.dzdx
);
723 zRow
= (DEPTH_TYPE
*)
724 _swrast_zbuffer_address(ctx
, FixedToInt(fxLeftEdge
), span
.y
);
725 dZRowOuter
= (ctx
->DrawBuffer
->Width
+ idxOuter
) * sizeof(DEPTH_TYPE
);
730 wLeft
= vLower
->win
[3] + (span
.dwdx
* adjx
+ span
.dwdy
* adjy
) * (1.0F
/FIXED_SCALE
);
731 dwOuter
= span
.dwdy
+ dxOuter
* span
.dwdx
;
734 fogLeft
= vLower
->fog
+ (span
.dfogdx
* adjx
+ span
.dfogdy
* adjy
) * (1.0F
/FIXED_SCALE
);
735 dfogOuter
= span
.dfogdy
+ dxOuter
* span
.dfogdx
;
738 if (ctx
->Light
.ShadeModel
== GL_SMOOTH
) {
739 # if CHAN_TYPE == GL_FLOAT
740 rLeft
= vLower
->color
[RCOMP
] + (span
.drdx
* adjx
+ span
.drdy
* adjy
) * (1.0F
/ FIXED_SCALE
);
741 gLeft
= vLower
->color
[GCOMP
] + (span
.dgdx
* adjx
+ span
.dgdy
* adjy
) * (1.0F
/ FIXED_SCALE
);
742 bLeft
= vLower
->color
[BCOMP
] + (span
.dbdx
* adjx
+ span
.dbdy
* adjy
) * (1.0F
/ FIXED_SCALE
);
743 fdrOuter
= span
.drdy
+ dxOuter
* span
.drdx
;
744 fdgOuter
= span
.dgdy
+ dxOuter
* span
.dgdx
;
745 fdbOuter
= span
.dbdy
+ dxOuter
* span
.dbdx
;
747 rLeft
= (GLint
)(ChanToFixed(vLower
->color
[RCOMP
]) + span
.drdx
* adjx
+ span
.drdy
* adjy
) + FIXED_HALF
;
748 gLeft
= (GLint
)(ChanToFixed(vLower
->color
[GCOMP
]) + span
.dgdx
* adjx
+ span
.dgdy
* adjy
) + FIXED_HALF
;
749 bLeft
= (GLint
)(ChanToFixed(vLower
->color
[BCOMP
]) + span
.dbdx
* adjx
+ span
.dbdy
* adjy
) + FIXED_HALF
;
750 fdrOuter
= SignedFloatToFixed(span
.drdy
+ dxOuter
* span
.drdx
);
751 fdgOuter
= SignedFloatToFixed(span
.dgdy
+ dxOuter
* span
.dgdx
);
752 fdbOuter
= SignedFloatToFixed(span
.dbdy
+ dxOuter
* span
.dbdx
);
755 # if CHAN_TYPE == GL_FLOAT
756 aLeft
= vLower
->color
[ACOMP
] + (span
.dadx
* adjx
+ span
.dady
* adjy
) * (1.0F
/ FIXED_SCALE
);
757 fdaOuter
= span
.dady
+ dxOuter
* span
.dadx
;
759 aLeft
= (GLint
)(ChanToFixed(vLower
->color
[ACOMP
]) + span
.dadx
* adjx
+ span
.dady
* adjy
) + FIXED_HALF
;
760 fdaOuter
= SignedFloatToFixed(span
.dady
+ dxOuter
* span
.dadx
);
765 ASSERT (ctx
->Light
.ShadeModel
== GL_FLAT
);
766 # if CHAN_TYPE == GL_FLOAT
767 rLeft
= v2
->color
[RCOMP
];
768 gLeft
= v2
->color
[GCOMP
];
769 bLeft
= v2
->color
[BCOMP
];
770 fdrOuter
= fdgOuter
= fdbOuter
= 0.0F
;
772 rLeft
= ChanToFixed(v2
->color
[RCOMP
]);
773 gLeft
= ChanToFixed(v2
->color
[GCOMP
]);
774 bLeft
= ChanToFixed(v2
->color
[BCOMP
]);
775 fdrOuter
= fdgOuter
= fdbOuter
= 0;
778 # if CHAN_TYPE == GL_FLOAT
779 aLeft
= v2
->color
[ACOMP
];
782 aLeft
= ChanToFixed(v2
->color
[ACOMP
]);
790 if (ctx
->Light
.ShadeModel
== GL_SMOOTH
) {
791 # if CHAN_TYPE == GL_FLOAT
792 srLeft
= vLower
->specular
[RCOMP
] + (span
.dsrdx
* adjx
+ span
.dsrdy
* adjy
) * (1.0F
/ FIXED_SCALE
);
793 sgLeft
= vLower
->specular
[GCOMP
] + (span
.dsgdx
* adjx
+ span
.dsgdy
* adjy
) * (1.0F
/ FIXED_SCALE
);
794 sbLeft
= vLower
->specular
[BCOMP
] + (span
.dsbdx
* adjx
+ span
.dsbdy
* adjy
) * (1.0F
/ FIXED_SCALE
);
795 dsrOuter
= span
.dsrdy
+ dxOuter
* span
.dsrdx
;
796 dsgOuter
= span
.dsgdy
+ dxOuter
* span
.dsgdx
;
797 dsbOuter
= span
.dsbdy
+ dxOuter
* span
.dsbdx
;
799 srLeft
= (GLfixed
) (ChanToFixed(vLower
->specular
[RCOMP
]) + span
.dsrdx
* adjx
+ span
.dsrdy
* adjy
) + FIXED_HALF
;
800 sgLeft
= (GLfixed
) (ChanToFixed(vLower
->specular
[GCOMP
]) + span
.dsgdx
* adjx
+ span
.dsgdy
* adjy
) + FIXED_HALF
;
801 sbLeft
= (GLfixed
) (ChanToFixed(vLower
->specular
[BCOMP
]) + span
.dsbdx
* adjx
+ span
.dsbdy
* adjy
) + FIXED_HALF
;
802 dsrOuter
= SignedFloatToFixed(span
.dsrdy
+ dxOuter
* span
.dsrdx
);
803 dsgOuter
= SignedFloatToFixed(span
.dsgdy
+ dxOuter
* span
.dsgdx
);
804 dsbOuter
= SignedFloatToFixed(span
.dsbdy
+ dxOuter
* span
.dsbdx
);
808 #if CHAN_TYPE == GL_FLOAT
809 srLeft
= v2
->specular
[RCOMP
];
810 sgLeft
= v2
->specular
[GCOMP
];
811 sbLeft
= v2
->specular
[BCOMP
];
812 dsrOuter
= dsgOuter
= dsbOuter
= 0.0F
;
814 srLeft
= ChanToFixed(v2
->specular
[RCOMP
]);
815 sgLeft
= ChanToFixed(v2
->specular
[GCOMP
]);
816 sbLeft
= ChanToFixed(v2
->specular
[BCOMP
]);
817 dsrOuter
= dsgOuter
= dsbOuter
= 0;
823 if (ctx
->Light
.ShadeModel
== GL_SMOOTH
) {
824 iLeft
= (GLfixed
)(vLower
->index
* FIXED_SCALE
825 + didx
* adjx
+ didy
* adjy
) + FIXED_HALF
;
826 diOuter
= SignedFloatToFixed(didy
+ dxOuter
* didx
);
829 iLeft
= (GLfixed
) (v2
->index
* FIXED_SCALE
);
833 #ifdef INTERP_INT_TEX
836 s0
= vLower
->texcoord
[0][0] * S_SCALE
;
837 sLeft
= (GLfixed
)(s0
* FIXED_SCALE
+ span
.texStepX
[0][0] * adjx
838 + span
.texStepY
[0][0] * adjy
) + FIXED_HALF
;
839 dsOuter
= SignedFloatToFixed(span
.texStepY
[0][0] + dxOuter
* span
.texStepX
[0][0]);
841 t0
= vLower
->texcoord
[0][1] * T_SCALE
;
842 tLeft
= (GLfixed
)(t0
* FIXED_SCALE
+ span
.texStepX
[0][1] * adjx
843 + span
.texStepY
[0][1] * adjy
) + FIXED_HALF
;
844 dtOuter
= SignedFloatToFixed(span
.texStepY
[0][1] + dxOuter
* span
.texStepX
[0][1]);
849 const GLfloat invW
= vLower
->win
[3];
850 const GLfloat s0
= vLower
->texcoord
[u
][0] * invW
;
851 const GLfloat t0
= vLower
->texcoord
[u
][1] * invW
;
852 const GLfloat u0
= vLower
->texcoord
[u
][2] * invW
;
853 const GLfloat v0
= vLower
->texcoord
[u
][3] * invW
;
854 sLeft
[u
] = s0
+ (span
.texStepX
[u
][0] * adjx
+ span
.texStepY
[u
][0] * adjy
) * (1.0F
/FIXED_SCALE
);
855 tLeft
[u
] = t0
+ (span
.texStepX
[u
][1] * adjx
+ span
.texStepY
[u
][1] * adjy
) * (1.0F
/FIXED_SCALE
);
856 uLeft
[u
] = u0
+ (span
.texStepX
[u
][2] * adjx
+ span
.texStepY
[u
][2] * adjy
) * (1.0F
/FIXED_SCALE
);
857 vLeft
[u
] = v0
+ (span
.texStepX
[u
][3] * adjx
+ span
.texStepY
[u
][3] * adjy
) * (1.0F
/FIXED_SCALE
);
858 dsOuter
[u
] = span
.texStepY
[u
][0] + dxOuter
* span
.texStepX
[u
][0];
859 dtOuter
[u
] = span
.texStepY
[u
][1] + dxOuter
* span
.texStepX
[u
][1];
860 duOuter
[u
] = span
.texStepY
[u
][2] + dxOuter
* span
.texStepX
[u
][2];
861 dvOuter
[u
] = span
.texStepY
[u
][3] + dxOuter
* span
.texStepX
[u
][3];
867 if (setupRight
&& eRight
->lines
>0) {
868 fxRightEdge
= eRight
->fsx
- FIXED_EPSILON
;
869 fdxRightEdge
= eRight
->fdxdy
;
877 /* Rasterize setup */
879 dPRowInner
= dPRowOuter
+ sizeof(PIXEL_TYPE
);
883 dZRowInner
= dZRowOuter
+ sizeof(DEPTH_TYPE
);
885 fdzInner
= fdzOuter
+ span
.zStep
;
888 dwInner
= dwOuter
+ span
.dwdx
;
891 dfogInner
= dfogOuter
+ span
.dfogdx
;
893 #if defined(INTERP_RGB)
894 fdrInner
= fdrOuter
+ span
.redStep
;
895 fdgInner
= fdgOuter
+ span
.greenStep
;
896 fdbInner
= fdbOuter
+ span
.blueStep
;
898 #if defined(INTERP_ALPHA)
899 fdaInner
= fdaOuter
+ span
.alphaStep
;
901 #if defined(INTERP_SPEC)
902 dsrInner
= dsrOuter
+ span
.specRedStep
;
903 dsgInner
= dsgOuter
+ span
.specGreenStep
;
904 dsbInner
= dsbOuter
+ span
.specBlueStep
;
907 diInner
= diOuter
+ span
.indexStep
;
909 #ifdef INTERP_INT_TEX
910 dsInner
= dsOuter
+ span
.intTexStep
[0];
911 dtInner
= dtOuter
+ span
.intTexStep
[1];
915 dsInner
[u
] = dsOuter
[u
] + span
.texStepX
[u
][0];
916 dtInner
[u
] = dtOuter
[u
] + span
.texStepX
[u
][1];
917 duInner
[u
] = duOuter
[u
] + span
.texStepX
[u
][2];
918 dvInner
[u
] = dvOuter
[u
] + span
.texStepX
[u
][3];
923 /* initialize the span interpolants to the leftmost value */
924 /* ff = fixed-pt fragment */
925 const GLint right
= FixedToInt(fxRightEdge
);
927 span
.x
= FixedToInt(fxLeftEdge
);
932 span
.end
= right
- span
.x
;
943 #if defined(INTERP_RGB)
948 #if defined(INTERP_ALPHA)
951 #if defined(INTERP_SPEC)
952 span
.specRed
= srLeft
;
953 span
.specGreen
= sgLeft
;
954 span
.specBlue
= sbLeft
;
959 #ifdef INTERP_INT_TEX
960 span
.intTex
[0] = sLeft
;
961 span
.intTex
[1] = tLeft
;
966 span
.tex
[u
][0] = sLeft
[u
];
967 span
.tex
[u
][1] = tLeft
[u
];
968 span
.tex
[u
][2] = uLeft
[u
];
969 span
.tex
[u
][3] = vLeft
[u
];
975 /* need this to accomodate round-off errors */
976 const GLint len
= right
- span
.x
- 1;
977 GLfixed ffrend
= span
.red
+ len
* span
.redStep
;
978 GLfixed ffgend
= span
.green
+ len
* span
.greenStep
;
979 GLfixed ffbend
= span
.blue
+ len
* span
.blueStep
;
986 span
.green
-= ffgend
;
999 const GLint len
= right
- span
.x
- 1;
1000 GLfixed ffaend
= span
.alpha
+ len
* span
.alphaStep
;
1002 span
.alpha
-= ffaend
;
1010 /* need this to accomodate round-off errors */
1011 const GLint len
= right
- span
.x
- 1;
1012 GLfixed ffsrend
= span
.specRed
+ len
* span
.specRedStep
;
1013 GLfixed ffsgend
= span
.specGreen
+ len
* span
.specGreenStep
;
1014 GLfixed ffsbend
= span
.specBlue
+ len
* span
.specBlueStep
;
1016 span
.specRed
-= ffsrend
;
1017 if (span
.specRed
< 0)
1021 span
.specGreen
-= ffsgend
;
1022 if (span
.specGreen
< 0)
1026 span
.specBlue
-= ffsbend
;
1027 if (span
.specBlue
< 0)
1033 if (span
.index
< 0) span
.index
= 0;
1036 /* This is where we actually generate fragments */
1038 RENDER_SPAN( span
);
1042 * Advance to the next scan line. Compute the
1043 * new edge coordinates, and adjust the
1044 * pixel-center x coordinate so that it stays
1045 * on or inside the major edge.
1050 fxLeftEdge
+= fdxLeftEdge
;
1051 fxRightEdge
+= fdxRightEdge
;
1056 fError
-= FIXED_ONE
;
1057 #ifdef PIXEL_ADDRESS
1058 pRow
= (PIXEL_TYPE
*) ((GLubyte
*) pRow
+ dPRowOuter
);
1062 zRow
= (DEPTH_TYPE
*) ((GLubyte
*) zRow
+ dZRowOuter
);
1070 fogLeft
+= dfogOuter
;
1072 #if defined(INTERP_RGB)
1077 #if defined(INTERP_ALPHA)
1080 #if defined(INTERP_SPEC)
1088 #ifdef INTERP_INT_TEX
1094 sLeft
[u
] += dsOuter
[u
];
1095 tLeft
[u
] += dtOuter
[u
];
1096 uLeft
[u
] += duOuter
[u
];
1097 vLeft
[u
] += dvOuter
[u
];
1102 #ifdef PIXEL_ADDRESS
1103 pRow
= (PIXEL_TYPE
*) ((GLubyte
*) pRow
+ dPRowInner
);
1107 zRow
= (DEPTH_TYPE
*) ((GLubyte
*) zRow
+ dZRowInner
);
1115 fogLeft
+= dfogInner
;
1117 #if defined(INTERP_RGB)
1122 #if defined(INTERP_ALPHA)
1125 #if defined(INTERP_SPEC)
1133 #ifdef INTERP_INT_TEX
1139 sLeft
[u
] += dsInner
[u
];
1140 tLeft
[u
] += dtInner
[u
];
1141 uLeft
[u
] += duInner
[u
];
1142 vLeft
[u
] += dvInner
[u
];
1148 } /* for subTriangle */
1162 #undef BYTES_PER_ROW
1163 #undef PIXEL_ADDRESS
1172 #undef INTERP_INT_TEX
1174 #undef INTERP_MULTITEX
1175 #undef TEX_UNIT_LOOP
1182 #undef DO_OCCLUSION_TEST