mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Tweak Vertex/Index buffer handling a bit.
This commit is contained in:
@ -2,6 +2,8 @@
|
||||
#ifndef _VERTEXMANAGERBASE_H
|
||||
#define _VERTEXMANAGERBASE_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
class NativeVertexFormat;
|
||||
class PointerWrap;
|
||||
|
||||
@ -15,16 +17,10 @@ private:
|
||||
static const u32 MAX_PRIMITIVES_PER_COMMAND = (u16)-1;
|
||||
|
||||
public:
|
||||
// values from OGL backend
|
||||
//static const u32 MAXVBUFFERSIZE = 0x1FFFF;
|
||||
|
||||
// values from DX9/11 backend
|
||||
static const u32 MAXVBUFFERSIZE = MAX_PRIMITIVES_PER_COMMAND * LARGEST_POSSIBLE_VERTEX;
|
||||
|
||||
// We may convert triangle-fans to triangle-lists, almost 3x as many indices.
|
||||
// Watching for a full index buffer would probably be smarter than this calculation.
|
||||
static const u32 MAXIBUFFERSIZE = MAXVBUFFERSIZE * 3 / SMALLEST_POSSIBLE_VERTEX;
|
||||
//static const u32 MAXIBUFFERSIZE = MAX_PRIMITIVES_PER_COMMAND * 3;
|
||||
static const u32 MAXIBUFFERSIZE = MAX_PRIMITIVES_PER_COMMAND * 3;
|
||||
|
||||
VertexManager();
|
||||
// needs to be virtual for DX11's dtor
|
||||
@ -36,29 +32,23 @@ public:
|
||||
static u8 *s_pBaseBufferPointer;
|
||||
static u8 *s_pEndBufferPointer;
|
||||
|
||||
static int GetRemainingSize();
|
||||
|
||||
//int GetRemainingVertices(int primitive);
|
||||
static u32 GetRemainingSize();
|
||||
static void PrepareForAdditionalData(int primitive, u32 count, u32 stride);
|
||||
static u32 GetRemainingIndices(int primitive);
|
||||
|
||||
static void Flush();
|
||||
|
||||
virtual ::NativeVertexFormat* CreateNativeVertexFormat() = 0;
|
||||
|
||||
// TODO: use these instead of TIBuffer, etc
|
||||
|
||||
// u16* GetTriangleIndexBuffer() { return TIBuffer; }
|
||||
// u16* GetLineIndexBuffer() { return LIBuffer; }
|
||||
// u16* GetPointIndexBuffer() { return PIBuffer; }
|
||||
// u8* GetVertexBuffer() { return s_pBaseBufferPointer; }
|
||||
|
||||
static void DoState(PointerWrap& p);
|
||||
virtual void CreateDeviceObjects(){};
|
||||
virtual void DestroyDeviceObjects(){};
|
||||
|
||||
protected:
|
||||
u16* TIBuffer;
|
||||
u16* LIBuffer;
|
||||
u16* PIBuffer;
|
||||
u16* GetTriangleIndexBuffer() { return &TIBuffer[0]; }
|
||||
u16* GetLineIndexBuffer() { return &LIBuffer[0]; }
|
||||
u16* GetPointIndexBuffer() { return &PIBuffer[0]; }
|
||||
u8* GetVertexBuffer() { return &s_pBaseBufferPointer[0]; }
|
||||
|
||||
virtual void vDoState(PointerWrap& p) { DoStateShared(p); }
|
||||
void DoStateShared(PointerWrap& p);
|
||||
@ -72,7 +62,10 @@ private:
|
||||
// temp
|
||||
virtual void vFlush() = 0;
|
||||
|
||||
u8* LocalVBuffer;
|
||||
std::vector<u8> LocalVBuffer;
|
||||
std::vector<u16> TIBuffer;
|
||||
std::vector<u16> LIBuffer;
|
||||
std::vector<u16> PIBuffer;
|
||||
};
|
||||
|
||||
extern VertexManager *g_vertex_manager;
|
||||
|
Reference in New Issue
Block a user