VertexLoader: Eliminate use of DataReader

DataReader is generally jank - it has a start and end pointer, but the end pointer is generally not used, and all of the vertex loaders mostly bypassed it anyways.

Wrapper code (the vertex loaer test, as well as Fifo.cpp and OpcodeDecoding.cpp) still uses it, as does the software vertex loader (which is not a subclass of VertexLoader). These can probably be eliminated later.
This commit is contained in:
Pokechu22
2022-11-22 16:54:05 -08:00
parent 8ac8d5afb6
commit 0bcd3c79bb
16 changed files with 36 additions and 69 deletions

View File

@ -17,7 +17,6 @@
#include "Common/Logging/Log.h"
#include "Common/MsgHandler.h"
#include "VideoCommon/DataReader.h"
#include "VideoCommon/VertexLoader.h"
#include "VideoCommon/VertexLoader_Color.h"
#include "VideoCommon/VertexLoader_Normal.h"
@ -57,15 +56,13 @@ public:
b->m_vertex_size, b->m_native_components, b->m_native_vtx_decl.stride);
}
}
int RunVertices(DataReader src, DataReader dst, int count) override
int RunVertices(const u8* src, u8* dst, int count) override
{
buffer_a.resize(count * a->m_native_vtx_decl.stride + 4);
buffer_b.resize(count * b->m_native_vtx_decl.stride + 4);
int count_a =
a->RunVertices(src, DataReader(buffer_a.data(), buffer_a.data() + buffer_a.size()), count);
int count_b =
b->RunVertices(src, DataReader(buffer_b.data(), buffer_b.data() + buffer_b.size()), count);
int count_a = a->RunVertices(src, buffer_a.data(), count);
int count_b = b->RunVertices(src, buffer_b.data(), count);
if (count_a != count_b)
{
@ -84,7 +81,7 @@ public:
m_VtxDesc, m_VtxAttr);
}
memcpy(dst.GetPointer(), buffer_a.data(), count_a * m_native_vtx_decl.stride);
memcpy(dst, buffer_a.data(), count_a * m_native_vtx_decl.stride);
m_numLoadedVertices += count;
return count_a;
}
@ -162,7 +159,7 @@ std::unique_ptr<VertexLoaderBase> VertexLoaderBase::CreateVertexLoader(const TVt
{
std::unique_ptr<VertexLoaderBase> loader = nullptr;
//#define COMPARE_VERTEXLOADERS
// #define COMPARE_VERTEXLOADERS
#if defined(_M_X86_64)
loader = std::make_unique<VertexLoaderX64>(vtx_desc, vtx_attr);