Change RunVertices' function arguments.

This reduces some dumb state shuffling when calling the emitted vertex loaders.
This commit is contained in:
Ryan Houdek 2015-02-12 18:50:10 -06:00
parent b989c2fd8f
commit 15e41c67f8
8 changed files with 11 additions and 11 deletions

View File

@ -174,9 +174,9 @@ void SWVertexLoader::LoadVertex()
// convert the vertex from the gc format to the videocommon (hardware optimized) format
u8* old = g_video_buffer_read_ptr;
int converted_vertices = m_CurrentLoader->RunVertices(
m_primitiveType, 1,
DataReader(g_video_buffer_read_ptr, nullptr), // src
DataReader(m_LoadedVertices.data(), m_LoadedVertices.data() + m_LoadedVertices.size()) // dst
DataReader(m_LoadedVertices.data(), m_LoadedVertices.data() + m_LoadedVertices.size()), // dst
1, m_primitiveType
);
g_video_buffer_read_ptr = old + m_CurrentLoader->m_VertexSize;

View File

@ -316,7 +316,7 @@ void VertexLoader::WriteCall(TPipelineFunction func)
m_PipelineStages[m_numPipelineStages++] = func;
}
int VertexLoader::RunVertices(int primitive, int count, DataReader src, DataReader dst)
int VertexLoader::RunVertices(DataReader src, DataReader dst, int count, int primitive)
{
g_vertex_manager_write_ptr = dst.GetPointer();
g_video_buffer_read_ptr = src.GetPointer();

View File

@ -32,7 +32,7 @@ class VertexLoader : public VertexLoaderBase
public:
VertexLoader(const TVtxDesc &vtx_desc, const VAT &vtx_attr);
int RunVertices(int primitive, int count, DataReader src, DataReader dst) override;
int RunVertices(DataReader src, DataReader dst, int count, int primitive) override;
std::string GetName() const override { return "OldLoader"; }
bool IsInitialized() override { return true; } // This vertex loader supports all formats

View File

@ -159,13 +159,13 @@ public:
delete b;
}
int RunVertices(int primitive, int count, DataReader src, DataReader dst) override
int RunVertices(DataReader src, DataReader dst, int count, int primitive) 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(primitive, count, src, DataReader(buffer_a.data(), buffer_a.data()+buffer_a.size()));
int count_b = b->RunVertices(primitive, count, src, DataReader(buffer_b.data(), buffer_b.data()+buffer_b.size()));
int count_a = a->RunVertices(src, DataReader(buffer_a.data(), buffer_a.data()+buffer_a.size()), count, primitive);
int count_b = b->RunVertices(src, DataReader(buffer_b.data(), buffer_b.data()+buffer_b.size()), count, primitive);
if (count_a != count_b)
ERROR_LOG(VIDEO, "The two vertex loaders have loaded a different amount of vertices (a: %d, b: %d).", count_a, count_b);

View File

@ -74,7 +74,7 @@ public:
static VertexLoaderBase* CreateVertexLoader(const TVtxDesc &vtx_desc, const VAT &vtx_attr);
virtual ~VertexLoaderBase() {}
virtual int RunVertices(int primitive, int count, DataReader src, DataReader dst) = 0;
virtual int RunVertices(DataReader src, DataReader dst, int count, int primitive) = 0;
virtual bool IsInitialized() = 0;

View File

@ -164,7 +164,7 @@ int RunVertices(int vtx_attr_group, int primitive, int count, DataReader src, bo
DataReader dst = VertexManager::PrepareForAdditionalData(primitive, count,
loader->m_native_vtx_decl.stride, cullall);
count = loader->RunVertices(primitive, count, src, dst);
count = loader->RunVertices(src, dst, count, primitive);
IndexGenerator::AddIndices(primitive, count);

View File

@ -457,7 +457,7 @@ bool VertexLoaderX64::IsInitialized()
return cpu_info.bSSSE3;
}
int VertexLoaderX64::RunVertices(int primitive, int count, DataReader src, DataReader dst)
int VertexLoaderX64::RunVertices(DataReader src, DataReader dst, int count, int primitive)
{
m_numLoadedVertices += count;
return ((int (*)(u8* src, u8* dst, int count))region)(src.GetPointer(), dst.GetPointer(), count);

View File

@ -9,7 +9,7 @@ public:
protected:
std::string GetName() const override { return "VertexLoaderX64"; }
bool IsInitialized() override;
int RunVertices(int primitive, int count, DataReader src, DataReader dst) override;
int RunVertices(DataReader src, DataReader dst, int count, int primitive) override;
private:
u32 m_src_ofs = 0;