2010-10-03 02:20:24 -06:00
|
|
|
|
|
|
|
#ifndef _VERTEXMANAGERBASE_H
|
|
|
|
#define _VERTEXMANAGERBASE_H
|
|
|
|
|
2010-11-26 02:25:08 -07:00
|
|
|
class NativeVertexFormat;
|
|
|
|
|
2010-10-03 02:20:24 -06:00
|
|
|
class VertexManager
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2011-02-13 19:18:03 -07:00
|
|
|
// values from OGL backend
|
2010-10-03 02:20:24 -06:00
|
|
|
//MAXVBUFFERSIZE = 0x1FFFF,
|
|
|
|
//MAXIBUFFERSIZE = 0xFFFF,
|
|
|
|
|
2011-02-13 19:18:03 -07:00
|
|
|
// values from DX9 backend
|
2010-10-03 02:20:24 -06:00
|
|
|
//MAXVBUFFERSIZE = 0x50000,
|
|
|
|
//MAXIBUFFERSIZE = 0xFFFF,
|
|
|
|
|
2011-02-13 19:18:03 -07:00
|
|
|
// values from DX11 backend
|
2010-10-03 02:20:24 -06:00
|
|
|
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();
|
|
|
|
|
2010-11-26 02:25:08 -07:00
|
|
|
virtual ::NativeVertexFormat* CreateNativeVertexFormat() = 0;
|
|
|
|
|
2010-11-29 09:16:48 -07:00
|
|
|
static u16* GetTriangleIndexBuffer() { return TIBuffer; }
|
|
|
|
static u16* GetLineIndexBuffer() { return LIBuffer; }
|
|
|
|
static u16* GetPointIndexBuffer() { return PIBuffer; }
|
|
|
|
static u8* GetVertexBuffer() { return LocalVBuffer; }
|
|
|
|
|
2010-10-03 02:20:24 -06:00
|
|
|
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);
|
2010-10-19 16:24:27 -06:00
|
|
|
//virtual void Draw(u32 stride, bool alphapass) = 0;
|
|
|
|
// temp
|
2010-10-03 02:20:24 -06:00
|
|
|
virtual void vFlush() = 0;
|
2010-10-19 16:24:27 -06:00
|
|
|
|
2010-10-03 02:20:24 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
extern VertexManager *g_vertex_manager;
|
|
|
|
|
|
|
|
#endif
|