2010-10-03 08:20:24 +00:00
|
|
|
|
|
|
|
#ifndef _VERTEXMANAGERBASE_H
|
|
|
|
#define _VERTEXMANAGERBASE_H
|
|
|
|
|
2010-11-26 09:25:08 +00:00
|
|
|
class NativeVertexFormat;
|
2012-01-04 08:42:22 +00:00
|
|
|
class PointerWrap;
|
2010-11-26 09:25:08 +00:00
|
|
|
|
2010-10-03 08:20:24 +00:00
|
|
|
class VertexManager
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2011-02-14 02:18:03 +00:00
|
|
|
// values from OGL backend
|
2010-10-03 08:20:24 +00:00
|
|
|
//MAXVBUFFERSIZE = 0x1FFFF,
|
|
|
|
//MAXIBUFFERSIZE = 0xFFFF,
|
|
|
|
|
2011-02-14 02:18:03 +00:00
|
|
|
// values from DX9 backend
|
2010-10-03 08:20:24 +00:00
|
|
|
//MAXVBUFFERSIZE = 0x50000,
|
|
|
|
//MAXIBUFFERSIZE = 0xFFFF,
|
|
|
|
|
2011-02-14 02:18:03 +00:00
|
|
|
// values from DX11 backend
|
2010-10-03 08:20:24 +00:00
|
|
|
MAXVBUFFERSIZE = 0x50000,
|
2012-10-20 13:22:15 +00:00
|
|
|
MAXIBUFFERSIZE = 0xFFFF,
|
2010-10-03 08:20:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
VertexManager();
|
|
|
|
virtual ~VertexManager(); // needs to be virtual for DX11's dtor
|
|
|
|
|
2013-02-22 01:10:00 +00:00
|
|
|
static void AddVertices(int _primitive, u32 _numVertices);
|
2010-10-03 08:20:24 +00:00
|
|
|
|
|
|
|
// TODO: protected?
|
|
|
|
static u8 *s_pBaseBufferPointer;
|
2013-02-21 11:36:29 +00:00
|
|
|
static u8 *s_pCurBufferPointer;
|
|
|
|
static u8 *s_pEndBufferPointer;
|
2010-10-03 08:20:24 +00:00
|
|
|
|
|
|
|
static int GetRemainingSize();
|
|
|
|
static int GetRemainingVertices(int primitive);
|
|
|
|
|
|
|
|
static void Flush();
|
|
|
|
|
2010-11-26 09:25:08 +00:00
|
|
|
virtual ::NativeVertexFormat* CreateNativeVertexFormat() = 0;
|
|
|
|
|
2010-11-29 16:16:48 +00:00
|
|
|
static u16* GetTriangleIndexBuffer() { return TIBuffer; }
|
|
|
|
static u16* GetLineIndexBuffer() { return LIBuffer; }
|
|
|
|
static u16* GetPointIndexBuffer() { return PIBuffer; }
|
2013-02-21 11:36:29 +00:00
|
|
|
static u8* GetVertexBuffer() { return s_pBaseBufferPointer; }
|
2010-11-29 16:16:48 +00:00
|
|
|
|
2012-01-04 08:42:22 +00:00
|
|
|
static void DoState(PointerWrap& p);
|
2012-10-20 13:22:15 +00:00
|
|
|
virtual void CreateDeviceObjects(){};
|
|
|
|
virtual void DestroyDeviceObjects(){};
|
2010-10-03 08:20:24 +00:00
|
|
|
protected:
|
|
|
|
// TODO: make private after Flush() is merged
|
|
|
|
static void ResetBuffer();
|
|
|
|
|
|
|
|
static u16 *TIBuffer;
|
|
|
|
static u16 *LIBuffer;
|
|
|
|
static u16 *PIBuffer;
|
|
|
|
|
|
|
|
static bool Flushed;
|
|
|
|
|
2012-01-04 08:42:22 +00:00
|
|
|
virtual void vDoState(PointerWrap& p) { DoStateShared(p); }
|
|
|
|
void DoStateShared(PointerWrap& p);
|
|
|
|
|
2010-10-03 08:20:24 +00:00
|
|
|
private:
|
2010-10-19 22:24:27 +00:00
|
|
|
//virtual void Draw(u32 stride, bool alphapass) = 0;
|
|
|
|
// temp
|
2010-10-03 08:20:24 +00:00
|
|
|
virtual void vFlush() = 0;
|
2013-02-21 11:36:29 +00:00
|
|
|
|
|
|
|
static u8 *LocalVBuffer;
|
2010-10-19 22:24:27 +00:00
|
|
|
|
2010-10-03 08:20:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern VertexManager *g_vertex_manager;
|
|
|
|
|
|
|
|
#endif
|