VertexLoader: remove inlined getters

They just blow up the code.
This commit is contained in:
degasus
2014-12-13 00:23:54 +01:00
parent 6e3b2712d2
commit a71c8158d9
4 changed files with 42 additions and 50 deletions

View File

@ -102,32 +102,27 @@ public:
VertexLoader(const TVtxDesc &vtx_desc, const VAT &vtx_attr);
~VertexLoader();
int GetVertexSize() const {return m_VertexSize;}
u32 GetNativeComponents() const { return m_native_components; }
const PortableVertexDeclaration& GetNativeVertexDeclaration() const
{ return m_native_vtx_decl; }
void SetupRunVertices(int primitive, int const count);
int RunVertices(int primitive, int count, DataReader src, DataReader dst);
// For debugging / profiling
void AppendToString(std::string *dest) const;
int GetNumLoadedVerts() const { return m_numLoadedVertices; }
NativeVertexFormat* m_native_vertex_format; // used by VertexLoaderManager to cache the NativeVertexFormat objects
// per loader public state
int m_VertexSize; // number of bytes of a raw GC vertex
PortableVertexDeclaration m_native_vtx_decl;
u32 m_native_components;
// used by VertexLoaderManager
NativeVertexFormat* m_native_vertex_format;
int m_numLoadedVertices;
private:
int m_VertexSize; // number of bytes of a raw GC vertex. Computed by CompileVertexTranslator.
// GC vertex format
TVtxAttr m_VtxAttr; // VAT decoded into easy format
TVtxDesc m_VtxDesc; // Not really used currently - or well it is, but could be easily avoided.
VAT m_vat;
// PC vertex format
u32 m_native_components;
PortableVertexDeclaration m_native_vtx_decl;
#ifndef USE_VERTEX_LOADER_JIT
// Pipeline.
TPipelineFunction m_PipelineStages[64]; // TODO - figure out real max. it's lower.
@ -136,9 +131,6 @@ private:
const u8 *m_compiledCode;
int m_numLoadedVertices;
void SetVAT(const VAT& vat);
void CompileVertexTranslator();

View File

@ -75,7 +75,7 @@ void AppendListToString(std::string *dest)
{
entry e;
map_entry.second->AppendToString(&e.text);
e.num_verts = map_entry.second->GetNumLoadedVerts();
e.num_verts = map_entry.second->m_numLoadedVertices;
entries.push_back(e);
total_size += e.text.size() + 1;
}
@ -111,14 +111,14 @@ static VertexLoader* RefreshLoader(int vtx_attr_group, CPState* state)
s_vertex_loader_map[uid] = std::unique_ptr<VertexLoader>(loader);
// search for a cached native vertex format
const PortableVertexDeclaration& format = loader->GetNativeVertexDeclaration();
const PortableVertexDeclaration& format = loader->m_native_vtx_decl;
auto& native = s_native_vertex_map[format];
if (!native)
{
auto raw_pointer = g_vertex_manager->CreateNativeVertexFormat();
native = std::unique_ptr<NativeVertexFormat>(raw_pointer);
native->Initialize(format);
native->m_components = loader->GetNativeComponents();
native->m_components = loader->m_native_components;
}
loader->m_native_vertex_format = native.get();
@ -141,7 +141,7 @@ int RunVertices(int vtx_attr_group, int primitive, int count, DataReader src, bo
VertexLoader* loader = RefreshLoader(vtx_attr_group, state);
int size = count * loader->GetVertexSize();
int size = count * loader->m_VertexSize;
if ((int)src.size() < size)
return -1;
@ -157,13 +157,13 @@ int RunVertices(int vtx_attr_group, int primitive, int count, DataReader src, bo
s_current_vtx_fmt = loader->m_native_vertex_format;
DataReader dst = VertexManager::PrepareForAdditionalData(primitive, count,
loader->GetNativeVertexDeclaration().stride);
loader->m_native_vtx_decl.stride);
count = loader->RunVertices(primitive, count, src, dst);
IndexGenerator::AddIndices(primitive, count);
VertexManager::FlushData(count, loader->GetNativeVertexDeclaration().stride);
VertexManager::FlushData(count, loader->m_native_vtx_decl.stride);
ADDSTAT(stats.thisFrame.numPrims, count);
INCSTAT(stats.thisFrame.numPrimitiveJoins);
@ -172,7 +172,7 @@ int RunVertices(int vtx_attr_group, int primitive, int count, DataReader src, bo
int GetVertexSize(int vtx_attr_group, bool preprocess)
{
return RefreshLoader(vtx_attr_group, preprocess ? &g_preprocess_cp_state : &g_main_cp_state)->GetVertexSize();
return RefreshLoader(vtx_attr_group, preprocess ? &g_preprocess_cp_state : &g_main_cp_state)->m_VertexSize;
}
NativeVertexFormat* GetCurrentVertexFormat()