consistently usage of buffer pointers

This commit is contained in:
degasus
2013-02-21 12:36:29 +01:00
parent a849bb5242
commit 76e6085e31
5 changed files with 22 additions and 18 deletions

View File

@ -16,8 +16,9 @@
VertexManager *g_vertex_manager;
u8 *VertexManager::s_pCurBufferPointer;
u8 *VertexManager::s_pBaseBufferPointer;
u8 *VertexManager::s_pCurBufferPointer;
u8 *VertexManager::s_pEndBufferPointer;
u8 *VertexManager::LocalVBuffer;
u16 *VertexManager::TIBuffer;
@ -32,6 +33,7 @@ VertexManager::VertexManager()
LocalVBuffer = new u8[MAXVBUFFERSIZE];
s_pCurBufferPointer = s_pBaseBufferPointer = LocalVBuffer;
s_pEndBufferPointer = s_pBaseBufferPointer + MAXVBUFFERSIZE;
TIBuffer = new u16[MAXIBUFFERSIZE];
LIBuffer = new u16[MAXIBUFFERSIZE];
@ -42,7 +44,7 @@ VertexManager::VertexManager()
void VertexManager::ResetBuffer()
{
s_pCurBufferPointer = LocalVBuffer;
s_pCurBufferPointer = s_pBaseBufferPointer;
}
VertexManager::~VertexManager()
@ -87,7 +89,7 @@ void VertexManager::AddIndices(int primitive, int numVertices)
int VertexManager::GetRemainingSize()
{
return MAXVBUFFERSIZE - (int)(s_pCurBufferPointer - LocalVBuffer);
return (int)(s_pEndBufferPointer - s_pCurBufferPointer);
}
int VertexManager::GetRemainingVertices(int primitive)
@ -170,7 +172,7 @@ void VertexManager::Flush()
#if (0)
void VertexManager::Flush()
{
if (LocalVBuffer == s_pCurBufferPointer || Flushed)
if (s_pBaseBufferPointer == s_pCurBufferPointer || Flushed)
return;
Flushed = true;

View File

@ -30,8 +30,9 @@ public:
static void AddVertices(int _primitive, int _numVertices);
// TODO: protected?
static u8 *s_pCurBufferPointer;
static u8 *s_pBaseBufferPointer;
static u8 *s_pCurBufferPointer;
static u8 *s_pEndBufferPointer;
static int GetRemainingSize();
static int GetRemainingVertices(int primitive);
@ -43,7 +44,7 @@ public:
static u16* GetTriangleIndexBuffer() { return TIBuffer; }
static u16* GetLineIndexBuffer() { return LIBuffer; }
static u16* GetPointIndexBuffer() { return PIBuffer; }
static u8* GetVertexBuffer() { return LocalVBuffer; }
static u8* GetVertexBuffer() { return s_pBaseBufferPointer; }
static void DoState(PointerWrap& p);
virtual void CreateDeviceObjects(){};
@ -52,7 +53,6 @@ protected:
// TODO: make private after Flush() is merged
static void ResetBuffer();
static u8 *LocalVBuffer;
static u16 *TIBuffer;
static u16 *LIBuffer;
static u16 *PIBuffer;
@ -67,6 +67,8 @@ private:
//virtual void Draw(u32 stride, bool alphapass) = 0;
// temp
virtual void vFlush() = 0;
static u8 *LocalVBuffer;
};