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

@ -10,7 +10,6 @@
#include "Common/EnumMap.h"
#include "Common/Swap.h"
#include "VideoCommon/DataReader.h"
#include "VideoCommon/VertexLoader.h"
#include "VideoCommon/VertexLoaderManager.h"
#include "VideoCommon/VertexLoaderUtils.h"
@ -35,19 +34,15 @@ void Pos_ReadDirect(VertexLoader* loader)
{
static_assert(N <= 3, "N > 3 is not sane!");
const auto scale = loader->m_posScale;
DataReader dst(g_vertex_manager_write_ptr, nullptr);
DataReader src(g_video_buffer_read_ptr, nullptr);
for (int i = 0; i < N; ++i)
{
const float value = PosScale(src.Read<T>(), scale);
const float value = PosScale(DataRead<T>(), scale);
if (loader->m_remaining < 3)
VertexLoaderManager::position_cache[loader->m_remaining][i] = value;
dst.Write(value);
DataWrite(value);
}
g_vertex_manager_write_ptr = dst.GetPointer();
g_video_buffer_read_ptr = src.GetPointer();
LOG_VTX();
}
@ -63,17 +58,15 @@ void Pos_ReadIndex(VertexLoader* loader)
reinterpret_cast<const T*>(VertexLoaderManager::cached_arraybases[CPArray::Position] +
(index * g_main_cp_state.array_strides[CPArray::Position]));
const auto scale = loader->m_posScale;
DataReader dst(g_vertex_manager_write_ptr, nullptr);
for (int i = 0; i < N; ++i)
{
const float value = PosScale(Common::FromBigEndian(data[i]), scale);
if (loader->m_remaining < 3)
VertexLoaderManager::position_cache[loader->m_remaining][i] = value;
dst.Write(value);
DataWrite(value);
}
g_vertex_manager_write_ptr = dst.GetPointer();
LOG_VTX();
}