From 69cf8b3470d4c7009b8f1bfc2014d2b853e08be0 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sat, 25 Nov 2023 17:33:44 -0800 Subject: [PATCH] VertexLoader: Use Common::SmallVector --- Source/Core/VideoCommon/VertexLoader.cpp | 9 +++------ Source/Core/VideoCommon/VertexLoader.h | 8 ++++++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Source/Core/VideoCommon/VertexLoader.cpp b/Source/Core/VideoCommon/VertexLoader.cpp index 1d8a1f8e88..402a5efaf8 100644 --- a/Source/Core/VideoCommon/VertexLoader.cpp +++ b/Source/Core/VideoCommon/VertexLoader.cpp @@ -77,9 +77,6 @@ VertexLoader::VertexLoader(const TVtxDesc& vtx_desc, const VAT& vtx_attr) void VertexLoader::CompileVertexTranslator() { - // Reset pipeline - m_numPipelineStages = 0; - // Position in pc vertex format. int nat_offset = 0; @@ -253,7 +250,7 @@ void VertexLoader::CompileVertexTranslator() void VertexLoader::WriteCall(TPipelineFunction func) { - m_PipelineStages[m_numPipelineStages++] = func; + m_PipelineStages.push_back(func); } int VertexLoader::RunVertices(const u8* src, u8* dst, int count) @@ -269,8 +266,8 @@ int VertexLoader::RunVertices(const u8* src, u8* dst, int count) m_tcIndex = 0; m_colIndex = 0; m_texmtxwrite = m_texmtxread = 0; - for (int i = 0; i < m_numPipelineStages; i++) - m_PipelineStages[i](this); + for (TPipelineFunction& func : m_PipelineStages) + func(this); PRIM_LOG("\n"); } diff --git a/Source/Core/VideoCommon/VertexLoader.h b/Source/Core/VideoCommon/VertexLoader.h index d1417401a4..478b186bc8 100644 --- a/Source/Core/VideoCommon/VertexLoader.h +++ b/Source/Core/VideoCommon/VertexLoader.h @@ -9,6 +9,7 @@ #include #include "Common/CommonTypes.h" +#include "Common/SmallVector.h" #include "VideoCommon/VertexLoaderBase.h" class VertexLoader; @@ -38,8 +39,11 @@ public: private: // Pipeline. - TPipelineFunction m_PipelineStages[64]; // TODO - figure out real max. it's lower. - int m_numPipelineStages; + // 1 pos matrix + 8 texture matrices + 1 position + 1 normal or normal/binormal/tangent + // + 2 colors + 8 texture coordinates or dummy texture coordinates + 8 texture matrices + // merged into texture coordinates + 1 skip gives a maximum of 30 + // (Tested by VertexLoaderTest.LargeFloatVertexSpeed) + Common::SmallVector m_PipelineStages; void CompileVertexTranslator();