VertexLoader: Use Common::SmallVector

This commit is contained in:
Pokechu22 2023-11-25 17:33:44 -08:00
parent 4116344785
commit 69cf8b3470
2 changed files with 9 additions and 8 deletions

View File

@ -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");
}

View File

@ -9,6 +9,7 @@
#include <string>
#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<TPipelineFunction, 30> m_PipelineStages;
void CompileVertexTranslator();