PageRenderTime 53ms CodeModel.GetById 16ms app.highlight 30ms RepoModel.GetById 0ms app.codeStats 1ms

/opengles/src/RasterizerTriangles.cpp

http://ftk.googlecode.com/
C++ | 861 lines | 504 code | 223 blank | 134 comment | 26 complexity | 4fd666823eafb39122998c49706925e4 MD5 | raw file
  1// ==========================================================================
  2//
  3// RasterizerTraingles.cpp	Rasterizer Class for 3D Rendering Library
  4//
  5// The rasterizer converts transformed and lit primitives and creates a 
  6// raster image in the current rendering surface.
  7//
  8// This files contains the triangle rasterization code, which was
  9// previously in the Rasterizer.cpp source file.
 10//
 11// --------------------------------------------------------------------------
 12//
 13// 05-22-2004		Hans-Martin Will	initial version
 14//
 15// --------------------------------------------------------------------------
 16//
 17// Copyright (c) 2004, Hans-Martin Will. All rights reserved.
 18// 
 19// Redistribution and use in source and binary forms, with or without 
 20// modification, are permitted provided that the following conditions are 
 21// met:
 22// 
 23//	 *  Redistributions of source code must retain the above copyright
 24// 		notice, this list of conditions and the following disclaimer. 
 25//   *	Redistributions in binary form must reproduce the above copyright
 26// 		notice, this list of conditions and the following disclaimer in the 
 27// 		documentation and/or other materials provided with the distribution. 
 28// 
 29// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 30// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
 31// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
 32// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
 33// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 
 34// OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
 35// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 36// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
 37// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
 38// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 
 39// THE POSSIBILITY OF SUCH DAMAGE.
 40//
 41// ==========================================================================
 42
 43
 44#include "stdafx.h"
 45#include "Rasterizer.h"
 46#include "Surface.h"
 47#include "Texture.h"
 48#include "arm/FunctionCache.h"
 49
 50using namespace EGL;
 51
 52
 53namespace {
 54	const I8 Permutation[8][3] = {
 55		{ 0, 1, 2 },
 56		{ 0, 2, 1 },
 57		{ 0, 0, 0 },	// impossible
 58		{ 2, 0, 1 },
 59		{ 1, 0, 2 },
 60		{ 0, 0, 0 },	// impossible
 61		{ 1, 2, 0 },
 62		{ 2, 1, 0 },
 63	};
 64
 65	inline const I8 * SortPermutation(I32 x0, I32 x1, I32 x2) {
 66		U32 y0 = static_cast<U32>(x0);
 67		U32 y1 = static_cast<U32>(x1);
 68		U32 y2 = static_cast<U32>(x2);
 69
 70		const I8 * result = Permutation[
 71			(((y1 - y0) >> 29) & 4) |
 72			(((y2 - y0) >> 30) & 2) |
 73			(((y2 - y1) >> 31) & 1)];
 74
 75		assert(result[0] | result[1] | result[2]);
 76
 77		return result;
 78	}
 79
 80	inline int Greater(I32 x0, I32 x1) {
 81		U32 y0 = static_cast<U32>(x0);
 82		U32 y1 = static_cast<U32>(x1);
 83
 84		return (y1 - y0) >> 31;
 85	}
 86	
 87	inline EGL_Fixed TriangleArea(EGL_Fixed x0, EGL_Fixed y0,
 88								  EGL_Fixed x1, EGL_Fixed y1, 
 89								  EGL_Fixed x2, EGL_Fixed y2) {
 90		return 
 91			EGL_Abs(
 92				EGL_Mul(x1, y2) + EGL_Mul(x2, y0) + EGL_Mul(x0, y1)
 93				- EGL_Mul(x2, y1) - EGL_Mul(x0, y2) - EGL_Mul(x1, y0));
 94	}
 95
 96	inline int Log2(int value) {
 97		if (value <= 1) {
 98			return 0;
 99		}
100
101		int result = 0;
102
103		while (value > 1) {
104			result++;
105			value >>= 1;
106		}
107
108		return result;
109	}
110
111#define DET_SHIFT 4
112
113	inline EGL_Fixed Det2x2(EGL_Fixed a11, EGL_Fixed a12, EGL_Fixed a21, EGL_Fixed a22) {
114		return EGL_Mul(a11 >> DET_SHIFT, a22 >> DET_SHIFT) -
115			EGL_Mul(a12 >> DET_SHIFT, a21 >> DET_SHIFT);
116	}
117
118	inline EGL_Fixed Det2x2NoShift(EGL_Fixed a11, EGL_Fixed a12, EGL_Fixed a21, EGL_Fixed a22) {
119		I64 first = static_cast<I64>(a11) * static_cast<I64>(a22);
120		I64 second = static_cast<I64>(a12) * static_cast<I64>(a21);
121
122		return (EGL_Fixed) ((first - second)  >> EGL_PRECISION);
123	}
124
125}
126
127
128#define SOLVE_PARAM_XY(val, p1, p2, p3, scale) \
129	grad.dx.val = EGL_Mul(																\
130			Det2x2NoShift(																		\
131				p2 - p1, (pos2.m_WindowCoords.y - pos1.m_WindowCoords.y) >> DET_SHIFT,					\
132				p3 - p1, (pos3.m_WindowCoords.y - pos1.m_WindowCoords.y) >> DET_SHIFT) >> DET_SHIFT,				\
133			scale);	\
134	grad.dy.val = EGL_Mul(																\
135			Det2x2NoShift(																		\
136				(pos2.m_WindowCoords.x - pos1.m_WindowCoords.x) >> DET_SHIFT, p2 - p1,					\
137				(pos3.m_WindowCoords.x - pos1.m_WindowCoords.x) >> DET_SHIFT, p3 - p1) >> DET_SHIFT,				\
138			scale)
139
140
141#define SOLVE_XY(param, scale) \
142	SOLVE_PARAM_XY(param, pos1.param, pos2.param, pos3.param, scale)
143
144
145namespace {
146	bool hasAlpha(RasterizerState::TextureFormat format) {
147		switch (format) {
148		case RasterizerState::TextureFormatAlpha:
149		case RasterizerState::TextureFormatLuminanceAlpha:
150		case RasterizerState::TextureFormatRGBA8:
151		case RasterizerState::TextureFormatRGBA4444:
152		case RasterizerState::TextureFormatRGBA5551:
153			return true;
154
155
156		default:
157			return false;
158		}
159	}
160}
161
162
163// ---------------------------------------------------------------------------
164// Prepare rasterizer object for triangles
165// ---------------------------------------------------------------------------
166
167void Rasterizer :: PrepareTriangle() {
168	PrepareTexture();
169
170	m_ScanlineFunction = (ScanlineFunction *)
171		m_FunctionCache->GetFunction(FunctionCache::FunctionTypeScanline, 
172									 *m_State);
173
174	// could be optimized
175	bool needsColor = !m_State->m_Texture[0].Enabled || 
176					  m_State->m_Texture[0].Mode != RasterizerState::TextureModeReplace;
177
178	bool needsTexture = false;
179	
180	for (size_t unit = 0; unit < EGL_NUM_TEXTURE_UNITS; ++unit) {
181		needsTexture |= m_State->m_Texture[unit].Enabled;
182	}
183
184	bool needsFog = m_State->m_Fog.Enabled;
185	bool needsDepth = m_State->m_DepthTest.Enabled || m_State->m_Mask.Depth || m_State->m_Stencil.Enabled;
186	bool needsScissor = m_State->m_ScissorTest.Enabled;
187	bool needsStencil = m_State->m_Stencil.Enabled;
188
189	U32 selector =
190		((needsColor	? 1 : 0) << RasterTriangleColor		) |
191		((needsTexture	? 1 : 0) << RasterTriangleTexture	) |
192		((needsFog		? 1 : 0) << RasterTriangleFog		) |
193		((needsDepth	? 1 : 0) << RasterTriangleDepth		) |
194		((needsScissor	? 1 : 0) << RasterTriangleScissor	) |
195		((needsStencil	? 1 : 0) << RasterTriangleStencil	);
196
197	m_RasterTriangleFunction = m_RasterTriangleFunctions[selector];
198
199	if (m_RasterTriangleFunction == 0)
200        m_RasterTriangleFunction = &Rasterizer::RasterTriangleAll;
201
202	memset(m_RasterInfo.MipmapLevel, 0, sizeof(m_RasterInfo.MipmapLevel));
203}
204
205
206// --------------------------------------------------------------------------
207// number of pixels done with linear interpolation
208// --------------------------------------------------------------------------
209
210
211#define LOG_LINEAR_SPAN 3					// logarithm of value base 2
212#define LINEAR_SPAN (1 << LOG_LINEAR_SPAN)	// must be power of 2
213
214#if !EGL_USE_JIT
215
216inline void Rasterizer :: RasterScanLine(RasterInfo & rasterInfo, const EdgePos & start, const EdgePos & delta) {
217
218	// In the edge buffer, z, tu and tv are actually divided by w
219
220	FractionalColor baseColor = start.m_Color;
221
222	if (!(delta.m_WindowCoords.x - start.m_WindowCoords.x)) {
223		return;
224	}
225
226	const FractionalColor& colorIncrement = delta.m_Color;
227
228	EGL_Fixed deltaFog = delta.m_FogDensity;
229	EGL_Fixed deltaDepth = delta.m_WindowCoords.depth;
230
231	EGL_Fixed deltaInvZ = delta.m_WindowCoords.invZ;
232
233	size_t unit;
234	EGL_Fixed deltaInvU[EGL_NUM_TEXTURE_UNITS],
235		deltaInvV[EGL_NUM_TEXTURE_UNITS],
236		invTu[EGL_NUM_TEXTURE_UNITS],
237		invTv[EGL_NUM_TEXTURE_UNITS];
238
239#if EGL_MIPMAP_PER_TEXEL
240	EGL_Fixed deltaInvDu[EGL_NUM_TEXTURE_UNITS],
241		deltaInvDv[EGL_NUM_TEXTURE_UNITS],
242		dTuDxOverInvZ2[EGL_NUM_TEXTURE_UNITS],
243		dTuDyOverInvZ2[EGL_NUM_TEXTURE_UNITS],
244		dTvDxOverInvZ2[EGL_NUM_TEXTURE_UNITS],
245		dTvDyOverInvZ2[EGL_NUM_TEXTURE_UNITS];
246#endif
247
248	for (unit = 0; unit < EGL_NUM_TEXTURE_UNITS; ++unit) {
249		deltaInvU[unit] = delta.m_TextureCoords[unit].tu;
250		deltaInvV[unit] = delta.m_TextureCoords[unit].tv;
251
252		invTu[unit] = start.m_TextureCoords[unit].tu;
253		invTv[unit] = start.m_TextureCoords[unit].tv;
254
255#if EGL_MIPMAP_PER_TEXEL
256		deltaInvDu[unit] = delta.m_TextureCoords[unit].dtudy;
257		deltaInvDv[unit] = delta.m_TextureCoords[unit].dtvdy;
258
259		dTuDxOverInvZ2[unit] = start.m_TextureCoords[unit].dtudx;
260		dTuDyOverInvZ2[unit] = start.m_TextureCoords[unit].dtudy;
261		dTvDxOverInvZ2[unit] = start.m_TextureCoords[unit].dtvdx;
262		dTvDyOverInvZ2[unit] = start.m_TextureCoords[unit].dtvdy;
263#endif
264	}
265
266	EGL_Fixed invZ = start.m_WindowCoords.invZ;
267
268	EGL_Fixed fogDensity = start.m_FogDensity;
269	I32 x = EGL_IntFromFixed(start.m_WindowCoords.x);
270	I32 xEnd = EGL_IntFromFixed(delta.m_WindowCoords.x);
271	I32 xLinEnd = x + ((xEnd - x) & ~(LINEAR_SPAN - 1));
272
273	EGL_Fixed z = EGL_Inverse(invZ);
274	EGL_Fixed tu[EGL_NUM_TEXTURE_UNITS], tv[EGL_NUM_TEXTURE_UNITS];
275
276	for (unit = 0; unit < EGL_NUM_TEXTURE_UNITS; ++unit) {
277		tu[unit] = EGL_Mul(invTu[unit], z);
278		tv[unit] = EGL_Mul(invTv[unit], z);
279	}
280
281	EGL_Fixed depth = start.m_WindowCoords.depth;
282
283	for (; x < xLinEnd;) {
284
285		// to get started, do mipmap selection at beginning of span
286
287#if EGL_MIPMAP_PER_TEXEL
288
289		for (unit = 0; unit < EGL_NUM_TEXTURE_UNITS; ++unit) {
290			if (m_UseMipmap[unit]) {
291				EGL_Fixed z2 = EGL_Mul(z << 4, z << 4);
292				EGL_Fixed maxDu = EGL_Max(EGL_Abs(dTuDxOverInvZ2[unit]), EGL_Abs(dTuDyOverInvZ2[unit])) >> (16 - m_Texture[unit]->GetTexture(0)->GetLogWidth());
293				EGL_Fixed maxDv = EGL_Max(EGL_Abs(dTvDxOverInvZ2[unit]), EGL_Abs(dTvDyOverInvZ2[unit])) >> (16 - m_Texture[unit]->GetTexture(0)->GetLogHeight());
294
295				//EGL_Fixed maxD = EGL_Max(maxDu, maxDv);
296				EGL_Fixed maxD = maxDu + maxDv;
297				//I64 rho64 = ((I64) EGL_Mul(z2, EGL_FixedFromFloat(1/sqrt(2.0f)) + 1)) * ((I64) maxD);
298				EGL_Fixed rho = EGL_Mul(z2, maxD);
299
300				// we start with nearest/minification only selection; will add LINEAR later
301
302				rasterInfo.MipmapLevel[unit] = EGL_Min(Log2(rho), rasterInfo.MaxMipmapLevel[unit]);
303
304				dTuDyOverInvZ2[unit] += deltaInvDu[unit] << LOG_LINEAR_SPAN;
305				dTvDyOverInvZ2[unit] += deltaInvDv[unit] << LOG_LINEAR_SPAN;
306			}
307		}
308#endif
309
310		invZ += deltaInvZ << LOG_LINEAR_SPAN;
311		EGL_Fixed endZ = EGL_Inverse(invZ);
312		EGL_Fixed deltaZ = (endZ - z) >> LOG_LINEAR_SPAN;
313
314		EGL_Fixed endTu[EGL_NUM_TEXTURE_UNITS];
315		EGL_Fixed endTv[EGL_NUM_TEXTURE_UNITS];
316		EGL_Fixed deltaTu[EGL_NUM_TEXTURE_UNITS];
317		EGL_Fixed deltaTv[EGL_NUM_TEXTURE_UNITS];
318
319		for (unit = 0; unit < EGL_NUM_TEXTURE_UNITS; ++unit) {
320			invTu[unit] += deltaInvU[unit] << LOG_LINEAR_SPAN;
321			invTv[unit] += deltaInvV[unit] << LOG_LINEAR_SPAN;
322
323			endTu[unit] = EGL_Mul(invTu[unit], endZ);
324			endTv[unit] = EGL_Mul(invTv[unit], endZ);
325			deltaTu[unit] = (endTu[unit] - tu[unit]) >> LOG_LINEAR_SPAN; 
326			deltaTv[unit] = (endTv[unit] - tv[unit]) >> LOG_LINEAR_SPAN;
327		}
328
329		int count = LINEAR_SPAN; 
330
331		do {
332			Fragment(&rasterInfo, x, depth, tu, tv, baseColor, fogDensity);
333
334			baseColor += colorIncrement;
335			depth += deltaDepth;
336			fogDensity += deltaFog;
337			z += deltaZ;
338
339			for (unit = 0; unit < EGL_NUM_TEXTURE_UNITS; ++unit) {
340				tu[unit] += deltaTu[unit];
341				tv[unit] += deltaTv[unit];
342			}
343
344			++x;
345		} while (--count);
346	}
347
348	if (x != xEnd) {
349
350		I32 deltaX = xEnd - x;
351
352#if EGL_MIPMAP_PER_TEXEL
353		for (unit = 0; unit < EGL_NUM_TEXTURE_UNITS; ++unit) {
354			if (m_UseMipmap[unit]) {
355				EGL_Fixed z2 = EGL_Mul(z << 4, z << 4);
356				EGL_Fixed maxDu = EGL_Max(EGL_Abs(dTuDxOverInvZ2[unit]), EGL_Abs(dTuDyOverInvZ2[unit])) >> (16 - m_Texture[unit]->GetTexture(0)->GetLogWidth());
357				EGL_Fixed maxDv = EGL_Max(EGL_Abs(dTvDxOverInvZ2[unit]), EGL_Abs(dTvDyOverInvZ2[unit])) >> (16 - m_Texture[unit]->GetTexture(0)->GetLogHeight());
358
359				//EGL_Fixed maxD = EGL_Max(maxDu, maxDv);
360				EGL_Fixed maxD = maxDu + maxDv;
361				//I64 rho64 = ((I64) EGL_Mul(z2, EGL_FixedFromFloat(1/sqrt(2.0f)) + 1)) * ((I64) maxD);
362				EGL_Fixed rho = EGL_Mul(z2, maxD);
363
364				// we start with nearest/minification only selection; will add LINEAR later
365
366				rasterInfo.MipmapLevel[unit] = EGL_Min(Log2(rho), rasterInfo.MaxMipmapLevel[unit]);
367
368				dTuDyOverInvZ2[unit] += deltaInvDu[unit] << LOG_LINEAR_SPAN;
369				dTvDyOverInvZ2[unit] += deltaInvDv[unit] << LOG_LINEAR_SPAN;
370			}
371		}
372#endif
373
374		EGL_Fixed endZ = EGL_Inverse(invZ + deltaX * deltaInvZ);
375		EGL_Fixed invSpan = EGL_Inverse(EGL_FixedFromInt(xEnd - x));
376		EGL_Fixed deltaZ = EGL_Mul(endZ - z, invSpan);
377
378		EGL_Fixed endTu[EGL_NUM_TEXTURE_UNITS];
379		EGL_Fixed endTv[EGL_NUM_TEXTURE_UNITS];
380		EGL_Fixed deltaTu[EGL_NUM_TEXTURE_UNITS];
381		EGL_Fixed deltaTv[EGL_NUM_TEXTURE_UNITS];
382
383		for (unit = 0; unit < EGL_NUM_TEXTURE_UNITS; ++unit) {
384			endTu[unit] = EGL_Mul(invTu[unit] + deltaX * deltaInvU[unit], endZ);
385			endTv[unit] = EGL_Mul(invTv[unit] + deltaX * deltaInvV[unit], endZ);
386			deltaTu[unit] = EGL_Mul(endTu[unit] - tu[unit], invSpan);
387			deltaTv[unit] = EGL_Mul(endTv[unit] - tv[unit], invSpan);
388		}
389
390		for (; x < xEnd; ++x) {
391
392			Fragment(&rasterInfo, x, depth, tu, tv, baseColor, fogDensity);
393
394			baseColor += colorIncrement;
395			depth += deltaDepth;
396
397			for (unit = 0; unit < EGL_NUM_TEXTURE_UNITS; ++unit) {
398				tu[unit] += deltaTu[unit];
399				tv[unit] += deltaTv[unit];
400			}
401
402			fogDensity += deltaFog;
403		}
404	}
405}
406#endif // !EGL_USE_JIT
407
408
409// --------------------------------------------------------------------------
410// Specialized triangle rasterizers go here
411// --------------------------------------------------------------------------
412
413
414//
415// RasterTriangleAll
416//
417
418#define InitScanlineStart		InitScanlineStartAll
419#define InitScanlineDeltas		InitScanlineDeltasAll
420#define RasterTriangle			RasterTriangleAll
421
422#define HasFog		1
423#define HasDepth	1
424#define HasColor	1
425#define HasTexture	1
426#define HasStencil	1
427#define HasScissor	1
428
429#include "RasterizerTriangles.inc"
430
431
432//
433// void RasterTriangle_cTdfs(const RasterPos& a, const RasterPos& b, const RasterPos& c);
434//
435
436#define InitScanlineStart		InitScanlineStart_cTdfs
437#define InitScanlineDeltas		InitScanlineDeltas_cTdfs
438#define RasterTriangle			RasterTriangle_cTdfs
439
440#define HasFog		0
441#define HasDepth	0
442#define HasColor	0
443#define HasTexture	1
444#define HasStencil	0
445#define HasScissor	0
446
447#include "RasterizerTriangles.inc"
448
449
450//
451// void RasterTriangle_cTdFs(const RasterPos& a, const RasterPos& b, const RasterPos& c);
452//
453
454#define InitScanlineStart		InitScanlineStart_cTdFs
455#define InitScanlineDeltas		InitScanlineDeltas_cTdFs
456#define RasterTriangle			RasterTriangle_cTdFs
457
458#define HasFog		1
459#define HasDepth	0
460#define HasColor	0
461#define HasTexture	1
462#define HasStencil	0
463#define HasScissor	0
464
465#include "RasterizerTriangles.inc"
466
467
468//
469// void RasterTriangle_cTDfs(const RasterPos& a, const RasterPos& b, const RasterPos& c);
470//
471
472#define InitScanlineStart		InitScanlineStart_cTDfs
473#define InitScanlineDeltas		InitScanlineDeltas_cTDfs
474#define RasterTriangle			RasterTriangle_cTDfs
475
476#define HasColor	0
477#define HasTexture	1
478#define HasDepth	1
479#define HasFog		0
480#define HasStencil	0
481#define HasScissor	0
482
483#include "RasterizerTriangles.inc"
484
485
486//
487// void RasterTriangle_cTDFs(const RasterPos& a, const RasterPos& b, const RasterPos& c);
488//
489
490#define InitScanlineStart		InitScanlineStart_cTDFs
491#define InitScanlineDeltas		InitScanlineDeltas_cTDFs
492#define RasterTriangle			RasterTriangle_cTDFs
493
494#define HasColor	0
495#define HasTexture	1
496#define HasDepth	1
497#define HasFog		1
498#define HasStencil	0
499#define HasScissor	0
500
501#include "RasterizerTriangles.inc"
502
503
504//
505// void RasterTriangle_Ctdfs(const RasterPos& a, const RasterPos& b, const RasterPos& c);
506//
507
508#define InitScanlineStart		InitScanlineStart_Ctdfs
509#define InitScanlineDeltas		InitScanlineDeltas_Ctdfs
510#define RasterTriangle			RasterTriangle_Ctdfs
511
512#define HasColor	1
513#define HasTexture	0
514#define HasDepth	0
515#define HasFog		0
516#define HasStencil	0
517#define HasScissor	0
518
519#include "RasterizerTriangles.inc"
520
521
522//
523// void RasterTriangle_CtdFs(const RasterPos& a, const RasterPos& b, const RasterPos& c);
524//
525
526#define InitScanlineStart		InitScanlineStart_CtdFs
527#define InitScanlineDeltas		InitScanlineDeltas_CtdFs
528#define RasterTriangle			RasterTriangle_CtdFs
529
530#define HasColor	1
531#define HasTexture	0
532#define HasDepth	0
533#define HasFog		1
534#define HasStencil	0
535#define HasScissor	0
536
537#include "RasterizerTriangles.inc"
538
539
540//
541// void RasterTriangle_CtDfs(const RasterPos& a, const RasterPos& b, const RasterPos& c);
542//
543
544#define InitScanlineStart		InitScanlineStart_CtDfs
545#define InitScanlineDeltas		InitScanlineDeltas_CtDfs
546#define RasterTriangle			RasterTriangle_CtDfs
547
548#define HasColor	1
549#define HasTexture	0
550#define HasDepth	1
551#define HasFog		0
552#define HasStencil	0
553#define HasScissor	0
554
555#include "RasterizerTriangles.inc"
556
557
558//
559// void RasterTriangle_CtDFs(const RasterPos& a, const RasterPos& b, const RasterPos& c);
560//
561
562#define InitScanlineStart		InitScanlineStart_CtDFs
563#define InitScanlineDeltas		InitScanlineDeltas_CtDFs
564#define RasterTriangle			RasterTriangle_CtDFs
565
566#define HasColor	1
567#define HasTexture	0
568#define HasDepth	1
569#define HasFog		1
570#define HasStencil	0
571#define HasScissor	0
572
573#include "RasterizerTriangles.inc"
574
575
576//
577// void RasterTriangle_CTdfs(const RasterPos& a, const RasterPos& b, const RasterPos& c);
578//
579
580#define InitScanlineStart		InitScanlineStart_CTdfs
581#define InitScanlineDeltas		InitScanlineDeltas_CTdfs
582#define RasterTriangle			RasterTriangle_CTdfs
583
584#define HasColor	1
585#define HasTexture	1
586#define HasDepth	0
587#define HasFog		0
588#define HasStencil	0
589#define HasScissor	0
590
591#include "RasterizerTriangles.inc"
592
593
594//
595// void RasterTriangle_CTdFs(const RasterPos& a, const RasterPos& b, const RasterPos& c);
596//
597
598#define InitScanlineStart		InitScanlineStart_CTdFs
599#define InitScanlineDeltas		InitScanlineDeltas_CTdFs
600#define RasterTriangle			RasterTriangle_CTdFs
601
602#define HasColor	1
603#define HasTexture	1
604#define HasDepth	0
605#define HasFog		1
606#define HasStencil	0
607#define HasScissor	0
608
609#include "RasterizerTriangles.inc"
610
611
612//
613// void RasterTriangle_CTDfs(const RasterPos& a, const RasterPos& b, const RasterPos& c);
614//
615
616#define InitScanlineStart		InitScanlineStart_CTDfs
617#define InitScanlineDeltas		InitScanlineDeltas_CTDfs
618#define RasterTriangle			RasterTriangle_CTDfs
619
620#define HasColor	1
621#define HasTexture	1
622#define HasDepth	1
623#define HasFog		0
624#define HasStencil	0
625#define HasScissor	0
626
627#include "RasterizerTriangles.inc"
628
629
630//
631// void RasterTriangle_CTDFs(const RasterPos& a, const RasterPos& b, const RasterPos& c);
632//
633
634#define InitScanlineStart		InitScanlineStart_CTDFs
635#define InitScanlineDeltas		InitScanlineDeltas_CTDFs
636#define RasterTriangle			RasterTriangle_CTDFs
637
638#define HasColor	1
639#define HasTexture	1
640#define HasDepth	1
641#define HasFog		1
642#define HasStencil	0
643#define HasScissor	0
644
645#include "RasterizerTriangles.inc"
646
647
648//
649// void RasterTriangle_cTdfS(const RasterPos& a, const RasterPos& b, const RasterPos& c);
650//
651
652#define InitScanlineStart		InitScanlineStart_cTdfS
653#define InitScanlineDeltas		InitScanlineDeltas_cTdfS
654#define RasterTriangle			RasterTriangle_cTdfS
655
656#define HasFog		0
657#define HasDepth	0
658#define HasColor	0
659#define HasTexture	1
660#define HasScissor	1
661#define HasStencil	0
662
663#include "RasterizerTriangles.inc"
664
665
666//
667// void RasterTriangle_cTdFS(const RasterPos& a, const RasterPos& b, const RasterPos& c);
668//
669
670#define InitScanlineStart		InitScanlineStart_cTdFS
671#define InitScanlineDeltas		InitScanlineDeltas_cTdFS
672#define RasterTriangle			RasterTriangle_cTdFS
673
674#define HasFog		1
675#define HasDepth	0
676#define HasColor	0
677#define HasTexture	1
678#define HasStencil	0
679#define HasScissor	1
680
681#include "RasterizerTriangles.inc"
682
683
684//
685// void RasterTriangle_cTDfS(const RasterPos& a, const RasterPos& b, const RasterPos& c);
686//
687
688#define InitScanlineStart		InitScanlineStart_cTDfS
689#define InitScanlineDeltas		InitScanlineDeltas_cTDfS
690#define RasterTriangle			RasterTriangle_cTDfS
691
692#define HasColor	0
693#define HasTexture	1
694#define HasDepth	1
695#define HasFog		0
696#define HasStencil	0
697#define HasScissor	1
698
699#include "RasterizerTriangles.inc"
700
701
702//
703// void RasterTriangle_cTDFS(const RasterPos& a, const RasterPos& b, const RasterPos& c);
704//
705
706#define InitScanlineStart		InitScanlineStart_cTDFS
707#define InitScanlineDeltas		InitScanlineDeltas_cTDFS
708#define RasterTriangle			RasterTriangle_cTDFS
709
710#define HasColor	0
711#define HasTexture	1
712#define HasDepth	1
713#define HasFog		1
714#define HasStencil	0
715#define HasScissor	1
716
717#include "RasterizerTriangles.inc"
718
719
720//
721// void RasterTriangle_CtdfS(const RasterPos& a, const RasterPos& b, const RasterPos& c);
722//
723
724#define InitScanlineStart		InitScanlineStart_CtdfS
725#define InitScanlineDeltas		InitScanlineDeltas_CtdfS
726#define RasterTriangle			RasterTriangle_CtdfS
727
728#define HasColor	1
729#define HasTexture	0
730#define HasDepth	0
731#define HasFog		0
732#define HasStencil	0
733#define HasScissor	1
734
735#include "RasterizerTriangles.inc"
736
737
738//
739// void RasterTriangle_CtdFS(const RasterPos& a, const RasterPos& b, const RasterPos& c);
740//
741
742#define InitScanlineStart		InitScanlineStart_CtdFS
743#define InitScanlineDeltas		InitScanlineDeltas_CtdFS
744#define RasterTriangle			RasterTriangle_CtdFS
745
746#define HasColor	1
747#define HasTexture	0
748#define HasDepth	0
749#define HasFog		1
750#define HasStencil	0
751#define HasScissor	1
752
753#include "RasterizerTriangles.inc"
754
755
756//
757// void RasterTriangle_CtDfS(const RasterPos& a, const RasterPos& b, const RasterPos& c);
758//
759
760#define InitScanlineStart		InitScanlineStart_CtDfS
761#define InitScanlineDeltas		InitScanlineDeltas_CtDfS
762#define RasterTriangle			RasterTriangle_CtDfS
763
764#define HasColor	1
765#define HasTexture	0
766#define HasDepth	1
767#define HasFog		0
768#define HasStencil	0
769#define HasScissor	1
770
771#include "RasterizerTriangles.inc"
772
773
774//
775// void RasterTriangle_CtDFS(const RasterPos& a, const RasterPos& b, const RasterPos& c);
776//
777
778#define InitScanlineStart		InitScanlineStart_CtDFS
779#define InitScanlineDeltas		InitScanlineDeltas_CtDFS
780#define RasterTriangle			RasterTriangle_CtDFS
781
782#define HasColor	1
783#define HasTexture	0
784#define HasDepth	1
785#define HasFog		1
786#define HasStencil	0
787#define HasScissor	1
788
789#include "RasterizerTriangles.inc"
790
791
792//
793// void RasterTriangle_CTdfS(const RasterPos& a, const RasterPos& b, const RasterPos& c);
794//
795
796#define InitScanlineStart		InitScanlineStart_CTdfS
797#define InitScanlineDeltas		InitScanlineDeltas_CTdfS
798#define RasterTriangle			RasterTriangle_CTdfS
799
800#define HasColor	1
801#define HasTexture	1
802#define HasDepth	0
803#define HasFog		0
804#define HasStencil	0
805#define HasScissor	1
806
807#include "RasterizerTriangles.inc"
808
809
810//
811// void RasterTriangle_CTdFS(const RasterPos& a, const RasterPos& b, const RasterPos& c);
812//
813
814#define InitScanlineStart		InitScanlineStart_CTdFS
815#define InitScanlineDeltas		InitScanlineDeltas_CTdFS
816#define RasterTriangle			RasterTriangle_CTdFS
817
818#define HasColor	1
819#define HasTexture	1
820#define HasDepth	0
821#define HasFog		1
822#define HasStencil	0
823#define HasScissor	1
824
825#include "RasterizerTriangles.inc"
826
827
828//
829// void RasterTriangle_CTDfS(const RasterPos& a, const RasterPos& b, const RasterPos& c);
830//
831
832#define InitScanlineStart		InitScanlineStart_CTDfS
833#define InitScanlineDeltas		InitScanlineDeltas_CTDfS
834#define RasterTriangle			RasterTriangle_CTDfS
835
836#define HasColor	1
837#define HasTexture	1
838#define HasDepth	1
839#define HasFog		0
840#define HasStencil	0
841#define HasScissor	1
842
843#include "RasterizerTriangles.inc"
844
845
846//
847// void RasterTriangle_CTDFS(const RasterPos& a, const RasterPos& b, const RasterPos& c);
848//
849
850#define InitScanlineStart		InitScanlineStart_CTDFS
851#define InitScanlineDeltas		InitScanlineDeltas_CTDFS
852#define RasterTriangle			RasterTriangle_CTDFS
853
854#define HasColor	1
855#define HasTexture	1
856#define HasDepth	1
857#define HasFog		1
858#define HasStencil	0
859#define HasScissor	1
860
861#include "RasterizerTriangles.inc"