summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/VertexLoaderManager.cpp
diff options
context:
space:
mode:
authorPokechu22 <Pokechu022@gmail.com>2021-05-13 16:05:31 -0700
committerPokechu22 <Pokechu022@gmail.com>2021-12-18 15:21:48 -0800
commitd039b1bc0dfaba2a88036468b6d971bb1d7e463d (patch)
treecd4d85ae6ec7f5674112ebf48e4716406663ca21 /Source/Core/VideoCommon/VertexLoaderManager.cpp
parente4605fa39955845145457aaa1f6ef227b7c6f78a (diff)
VideoCommon: Move VertexLoaderManager logic out of CPState
Diffstat (limited to 'Source/Core/VideoCommon/VertexLoaderManager.cpp')
-rw-r--r--Source/Core/VideoCommon/VertexLoaderManager.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/Source/Core/VideoCommon/VertexLoaderManager.cpp b/Source/Core/VideoCommon/VertexLoaderManager.cpp
index 901e14044f..ef1e2f7aee 100644
--- a/Source/Core/VideoCommon/VertexLoaderManager.cpp
+++ b/Source/Core/VideoCommon/VertexLoaderManager.cpp
@@ -58,9 +58,9 @@ std::array<VertexLoaderBase*, CP_NUM_VAT_REG> g_preprocess_vertex_loaders;
void Init()
{
MarkAllDirty();
- for (auto& map_entry : g_main_cp_state.vertex_loaders)
+ for (auto& map_entry : g_main_vertex_loaders)
map_entry = nullptr;
- for (auto& map_entry : g_preprocess_cp_state.vertex_loaders)
+ for (auto& map_entry : g_preprocess_vertex_loaders)
map_entry = nullptr;
SETSTAT(g_stats.num_vertex_loaders, 0);
}
@@ -75,7 +75,7 @@ void Clear()
void UpdateVertexArrayPointers()
{
// Anything to update?
- if (!g_main_cp_state.bases_dirty)
+ if (!g_bases_dirty)
return;
// Some games such as Burnout 2 can put invalid addresses into
@@ -106,7 +106,7 @@ void UpdateVertexArrayPointers()
Memory::GetPointer(g_main_cp_state.array_bases[CPArray::TexCoord0 + i]);
}
- g_main_cp_state.bases_dirty = false;
+ g_bases_dirty = false;
}
namespace
@@ -121,8 +121,8 @@ struct entry
void MarkAllDirty()
{
- g_main_cp_state.attr_dirty = BitSet32::AllTrue(8);
- g_preprocess_cp_state.attr_dirty = BitSet32::AllTrue(8);
+ g_main_vat_dirty = BitSet8::AllTrue(8);
+ g_preprocess_vat_dirty = BitSet8::AllTrue(8);
}
NativeVertexFormat* GetOrCreateMatchingFormat(const PortableVertexDeclaration& decl)
@@ -197,10 +197,12 @@ NativeVertexFormat* GetUberVertexFormat(const PortableVertexDeclaration& decl)
static VertexLoaderBase* RefreshLoader(int vtx_attr_group, bool preprocess = false)
{
CPState* state = preprocess ? &g_preprocess_cp_state : &g_main_cp_state;
- state->last_id = vtx_attr_group;
+ BitSet8& attr_dirty = preprocess ? g_preprocess_vat_dirty : g_main_vat_dirty;
+ auto& vertex_loaders = preprocess ? g_main_vertex_loaders : g_preprocess_vertex_loaders;
+ g_current_vat = vtx_attr_group;
VertexLoaderBase* loader;
- if (state->attr_dirty[vtx_attr_group])
+ if (attr_dirty[vtx_attr_group])
{
// We are not allowed to create a native vertex format on preprocessing as this is on the wrong
// thread
@@ -230,12 +232,12 @@ static VertexLoaderBase* RefreshLoader(int vtx_attr_group, bool preprocess = fal
native = g_renderer->CreateNativeVertexFormat(format);
loader->m_native_vertex_format = native.get();
}
- state->vertex_loaders[vtx_attr_group] = loader;
- state->attr_dirty[vtx_attr_group] = false;
+ vertex_loaders[vtx_attr_group] = loader;
+ attr_dirty[vtx_attr_group] = false;
}
else
{
- loader = state->vertex_loaders[vtx_attr_group];
+ loader = vertex_loaders[vtx_attr_group];
}
// Lookup pointers for any vertex arrays.