From 1ff681a41284a757db9dfaa23b93c03aeb2c88f7 Mon Sep 17 00:00:00 2001 From: degasus Date: Thu, 23 Jan 2014 15:27:18 +0100 Subject: [PATCH] D3D: move streaming buffer fallback into D3D backend Neith OGL nor VideoCommon doen't use it, so there is no need to have it in VideoCommon. --- Source/Core/VideoBackends/D3D/VertexManager.cpp | 12 ++++++++++++ Source/Core/VideoBackends/D3D/VertexManager.h | 7 +++++++ Source/Core/VideoCommon/VertexManagerBase.cpp | 12 ------------ Source/Core/VideoCommon/VertexManagerBase.h | 8 +------- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/Source/Core/VideoBackends/D3D/VertexManager.cpp b/Source/Core/VideoBackends/D3D/VertexManager.cpp index 75ca01a264..f8274ee283 100644 --- a/Source/Core/VideoBackends/D3D/VertexManager.cpp +++ b/Source/Core/VideoBackends/D3D/VertexManager.cpp @@ -77,6 +77,12 @@ void VertexManager::DestroyDeviceObjects() VertexManager::VertexManager() { + LocalVBuffer.resize(MAXVBUFFERSIZE); + s_pCurBufferPointer = s_pBaseBufferPointer = &LocalVBuffer[0]; + s_pEndBufferPointer = s_pBaseBufferPointer + LocalVBuffer.size(); + + LocalIBuffer.resize(MAXIBUFFERSIZE); + CreateDeviceObjects(); } @@ -222,4 +228,10 @@ void VertexManager::vFlush() g_renderer->RestoreState(); } +void VertexManager::ResetBuffer(u32 stride) +{ + s_pCurBufferPointer = s_pBaseBufferPointer; + IndexGenerator::Start(GetIndexBuffer()); +} + } // namespace diff --git a/Source/Core/VideoBackends/D3D/VertexManager.h b/Source/Core/VideoBackends/D3D/VertexManager.h index 9440c737b2..644d13ae3f 100644 --- a/Source/Core/VideoBackends/D3D/VertexManager.h +++ b/Source/Core/VideoBackends/D3D/VertexManager.h @@ -22,6 +22,10 @@ public: void CreateDeviceObjects(); void DestroyDeviceObjects(); +protected: + virtual void ResetBuffer(u32 stride); + u16* GetIndexBuffer() { return &LocalIBuffer[0]; } + private: void PrepareDrawBuffers(); @@ -41,6 +45,9 @@ private: LineGeometryShader m_lineShader; PointGeometryShader m_pointShader; + + std::vector LocalVBuffer; + std::vector LocalIBuffer; }; } // namespace diff --git a/Source/Core/VideoCommon/VertexManagerBase.cpp b/Source/Core/VideoCommon/VertexManagerBase.cpp index aac64cdcf3..96d0ce3431 100644 --- a/Source/Core/VideoCommon/VertexManagerBase.cpp +++ b/Source/Core/VideoCommon/VertexManagerBase.cpp @@ -39,12 +39,6 @@ static const PrimitiveType primitive_from_gx[8] = { VertexManager::VertexManager() { - LocalVBuffer.resize(MAXVBUFFERSIZE); - s_pCurBufferPointer = s_pBaseBufferPointer = &LocalVBuffer[0]; - s_pEndBufferPointer = s_pBaseBufferPointer + LocalVBuffer.size(); - - LocalIBuffer.resize(MAXIBUFFERSIZE); - IsFlushed = true; } @@ -52,12 +46,6 @@ VertexManager::~VertexManager() { } -void VertexManager::ResetBuffer(u32 stride) -{ - s_pCurBufferPointer = s_pBaseBufferPointer; - IndexGenerator::Start(GetIndexBuffer()); -} - u32 VertexManager::GetRemainingSize() { return (u32)(s_pEndBufferPointer - s_pCurBufferPointer); diff --git a/Source/Core/VideoCommon/VertexManagerBase.h b/Source/Core/VideoCommon/VertexManagerBase.h index 1540da7f88..1acbfefdf1 100644 --- a/Source/Core/VideoCommon/VertexManagerBase.h +++ b/Source/Core/VideoCommon/VertexManagerBase.h @@ -51,14 +51,11 @@ public: virtual void DestroyDeviceObjects(){}; protected: - u16* GetIndexBuffer() { return &LocalIBuffer[0]; } - u8* GetVertexBuffer() { return &s_pBaseBufferPointer[0]; } - virtual void vDoState(PointerWrap& p) { } static PrimitiveType current_primitive_type; - virtual void ResetBuffer(u32 stride); + virtual void ResetBuffer(u32 stride) = 0; private: static bool IsFlushed; @@ -66,9 +63,6 @@ private: //virtual void Draw(u32 stride, bool alphapass) = 0; // temp virtual void vFlush() = 0; - - std::vector LocalVBuffer; - std::vector LocalIBuffer; }; extern VertexManager *g_vertex_manager;