From a8c8dd0c5376626cbe45486347268e6414a7ea27 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 18 Sep 2016 12:05:10 -0400 Subject: [PATCH] SWVertexLoader: Value initialize SetupUnit instance --- .../VideoBackends/Software/SWVertexLoader.cpp | 15 +++++---------- .../Core/VideoBackends/Software/SWVertexLoader.h | 7 ++----- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/Source/Core/VideoBackends/Software/SWVertexLoader.cpp b/Source/Core/VideoBackends/Software/SWVertexLoader.cpp index 9993be1f9a..c55124430c 100644 --- a/Source/Core/VideoBackends/Software/SWVertexLoader.cpp +++ b/Source/Core/VideoBackends/Software/SWVertexLoader.cpp @@ -39,17 +39,12 @@ SWVertexLoader::CreateNativeVertexFormat(const PortableVertexDeclaration& vtx_de return new NullNativeVertexFormat(vtx_decl); } -SWVertexLoader::SWVertexLoader() +SWVertexLoader::SWVertexLoader() : LocalVBuffer(MAXVBUFFERSIZE), LocalIBuffer(MAXIBUFFERSIZE) { - LocalVBuffer.resize(MAXVBUFFERSIZE); - LocalIBuffer.resize(MAXIBUFFERSIZE); - m_SetupUnit = new SetupUnit; } SWVertexLoader::~SWVertexLoader() { - delete m_SetupUnit; - m_SetupUnit = nullptr; } void SWVertexLoader::ResetBuffer(u32 stride) @@ -78,7 +73,7 @@ void SWVertexLoader::vFlush(bool useDstAlpha) break; } - m_SetupUnit->Init(primitiveType); + m_SetupUnit.Init(primitiveType); // set all states with are stored within video sw for (int i = 0; i < 4; i++) @@ -96,7 +91,7 @@ void SWVertexLoader::vFlush(bool useDstAlpha) if (index == 0xffff) { // primitive restart - m_SetupUnit->Init(primitiveType); + m_SetupUnit.Init(primitiveType); continue; } memset(&m_Vertex, 0, sizeof(m_Vertex)); @@ -109,7 +104,7 @@ void SWVertexLoader::vFlush(bool useDstAlpha) ParseVertex(VertexLoaderManager::GetCurrentVertexFormat()->GetVertexDeclaration(), index); // transform this vertex so that it can be used for rasterization (outVertex) - OutputVertexData* outVertex = m_SetupUnit->GetVertex(); + OutputVertexData* outVertex = m_SetupUnit.GetVertex(); TransformUnit::TransformPosition(&m_Vertex, outVertex); memset(&outVertex->normal, 0, sizeof(outVertex->normal)); if (VertexLoaderManager::g_current_components & VB_HAS_NRM0) @@ -121,7 +116,7 @@ void SWVertexLoader::vFlush(bool useDstAlpha) TransformUnit::TransformTexCoord(&m_Vertex, outVertex, m_TexGenSpecialCase); // assemble and rasterize the primitive - m_SetupUnit->SetupVertex(); + m_SetupUnit.SetupVertex(); INCSTAT(stats.thisFrame.numVerticesLoaded) } diff --git a/Source/Core/VideoBackends/Software/SWVertexLoader.h b/Source/Core/VideoBackends/Software/SWVertexLoader.h index e924886d8d..6ebacda50b 100644 --- a/Source/Core/VideoBackends/Software/SWVertexLoader.h +++ b/Source/Core/VideoBackends/Software/SWVertexLoader.h @@ -4,19 +4,16 @@ #pragma once -#include -#include #include #include "Common/CommonTypes.h" #include "VideoBackends/Software/NativeVertexFormat.h" +#include "VideoBackends/Software/SetupUnit.h" #include "VideoCommon/VertexLoaderBase.h" #include "VideoCommon/VertexManagerBase.h" -class SetupUnit; - class SWVertexLoader : public VertexManagerBase { public: @@ -37,7 +34,7 @@ private: void ParseVertex(const PortableVertexDeclaration& vdec, int index); - SetupUnit* m_SetupUnit; + SetupUnit m_SetupUnit; bool m_TexGenSpecialCase;