summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/rdpspn16.h
blob: 051289cd481bfe6c591b7b630cc42db07ab8374e (plain) (blame)
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
#ifndef _VIDEO_RDPSPAN_H_
#define _VIDEO_RDPSPAN_H_

#include "emu.h"

namespace N64
{

namespace RDP
{

#define RDP_CVG_SPAN_MAX    1024

class OtherModes;
class MiscState;
class Processor;

class SpanParam
{
	public:
		union
		{
			UINT32 w;
#ifdef LSB_FIRST
			struct { UINT16 l; INT16 h; } h;
#else
			struct { INT16 h; UINT16 l; } h;
#endif
		};
};

class Span
{
	public:
		Span() { }

		void	Dump();
		void	SetMachine(running_machine& machine);

		void	Draw1Cycle(int index, int tilenum, bool flip);
		void	Draw2Cycle(int index, int tilenum, bool flip);
		void	DrawCopy(int index, int tilenum, bool flip);
		void	DrawFill(int index, int tilenum, bool flip);

		running_machine &machine() const { assert(m_machine != NULL); return *m_machine; }

	public:
		int m_lx;
		int m_rx;
		int m_unscissored_rx;

		SpanParam m_s;
		SpanParam m_t;
		SpanParam m_w;
		SpanParam m_r;
		SpanParam m_g;
		SpanParam m_b;
		SpanParam m_a;
		SpanParam m_z;

		UINT16 m_cvg[RDP_CVG_SPAN_MAX];

	private:
		void RGBAZClip(int sr, int sg, int sb, int sa, int *sz);
		void RGBAZCorrectTriangle(INT32 offx, INT32 offy, INT32* r, INT32* g, INT32* b, INT32* a, INT32* z);

		running_machine* m_machine;
		Processor* m_rdp;
		MiscState* m_misc_state;
		OtherModes* m_other_modes;
};

} // namespace RDP

} // namespace N64

#endif // _VIDEO_RDPSPAN_H_