From d039b1bc0dfaba2a88036468b6d971bb1d7e463d Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Thu, 13 May 2021 16:05:31 -0700 Subject: VideoCommon: Move VertexLoaderManager logic out of CPState --- Source/Core/VideoCommon/VertexLoaderManager.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'Source/Core/VideoCommon/VertexLoaderManager.cpp') 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 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. -- cgit v1.2.3