summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Src/VertexManagerBase.h
blob: 12dc02ae4b72a625adadeba116d58be6392609d0 (plain)
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

#ifndef _VERTEXMANAGERBASE_H
#define _VERTEXMANAGERBASE_H

class NativeVertexFormat;

class VertexManager
{
public:

	enum
	{
		// values from OGL backend
		//MAXVBUFFERSIZE = 0x1FFFF,
		//MAXIBUFFERSIZE = 0xFFFF,

		// values from DX9 backend
		//MAXVBUFFERSIZE = 0x50000,
		//MAXIBUFFERSIZE = 0xFFFF,

		// values from DX11 backend
		MAXVBUFFERSIZE = 0x50000,
		MAXIBUFFERSIZE = 0x10000,
	};

	VertexManager();
	virtual ~VertexManager();	// needs to be virtual for DX11's dtor

	static void AddVertices(int _primitive, int _numVertices);

	// TODO: protected?
	static u8 *s_pCurBufferPointer;
	static u8 *s_pBaseBufferPointer;

	static int GetRemainingSize();
	static int GetRemainingVertices(int primitive);

	static void Flush();

	virtual ::NativeVertexFormat* CreateNativeVertexFormat() = 0;

	static u16* GetTriangleIndexBuffer() { return TIBuffer; }
	static u16* GetLineIndexBuffer() { return LIBuffer; }
	static u16* GetPointIndexBuffer() { return PIBuffer; }
	static u8* GetVertexBuffer() { return LocalVBuffer; }

protected:
	// TODO: make private after Flush() is merged
	static void ResetBuffer();

	static u8 *LocalVBuffer;
	static u16 *TIBuffer;
	static u16 *LIBuffer;
	static u16 *PIBuffer;

	static bool Flushed;

private:
	static void AddIndices(int primitive, int numVertices);
	//virtual void Draw(u32 stride, bool alphapass) = 0;
	// temp
	virtual void vFlush() = 0;

};

extern VertexManager *g_vertex_manager;

#endif