diff options
| author | Scott Mansell <phiren@gmail.com> | 2015-05-30 00:42:45 +1200 |
|---|---|---|
| committer | Scott Mansell <phiren@gmail.com> | 2015-05-30 04:09:27 +1200 |
| commit | f57517f1a05db1790f853bf43d6093c19478b4ce (patch) | |
| tree | 4874138fabc5e0c892013d6151e6d19dd2b2c1ba /Source/Core/VideoCommon/VertexLoaderManager.cpp | |
| parent | 6d916762fb52a85aa086ef0cb6516cc63fbe775b (diff) | |
Clean up cached_arraybases. Update VideoSW to new scheme.
Move ownership of cached_arraybases from CPMemory to VertexLoaderManager
to better match it usage.
Diffstat (limited to 'Source/Core/VideoCommon/VertexLoaderManager.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/VertexLoaderManager.cpp | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/Source/Core/VideoCommon/VertexLoaderManager.cpp b/Source/Core/VideoCommon/VertexLoaderManager.cpp index 8d2acecc66..4ebb07788b 100644 --- a/Source/Core/VideoCommon/VertexLoaderManager.cpp +++ b/Source/Core/VideoCommon/VertexLoaderManager.cpp @@ -35,6 +35,8 @@ static std::mutex s_vertex_loader_map_lock; static VertexLoaderMap s_vertex_loader_map; // TODO - change into array of pointers. Keep a map of all seen so far. +u8 *cached_arraybases[12]; + void Init() { MarkAllDirty(); @@ -52,6 +54,21 @@ void Shutdown() s_native_vertex_map.clear(); } +void UpdateVertexArrayPointers() +{ + // Some games such as Burnout 2 can put invalid addresses into + // the array base registers. (see issue 8591) + // But the vertex arrays with invalid addresses aren't actually enabled. + // Note: Only array bases 0 through 11 are used by the Vertex loaders. + // 12 through 15 are used for loading data into xfmem. + for (int i = 0; i < 12; i++) + { + // Only update the array base if the vertex description states we are going to use it. + if (g_main_cp_state.vtx_desc.GetVertexArrayStatus(i) >= 0x2) + cached_arraybases[i] = Memory::GetPointer(g_main_cp_state.array_bases[i]); + } +} + namespace { struct entry @@ -138,7 +155,7 @@ static VertexLoaderBase* RefreshLoader(int vtx_attr_group, bool preprocess = fal // Lookup pointers for any vertex arrays. if (!preprocess) - ComputeCachedArrayBases(); + UpdateVertexArrayPointers(); return loader; } @@ -264,16 +281,3 @@ void FillCPMemoryArray(u32 *memory) memory[0xB0 + i] = g_main_cp_state.array_strides[i]; } } - -void ComputeCachedArrayBases() -{ - // Some games such as Burnout 2 can put invalid addresses into - // the array base registers. (see issue 8591) - // But the vertex arrays with invalid addresses aren't actually enabled. - for (int i = 0; i < 12; i++) - { - // Only update the array base if the vertex description states we are going to use it. - if (g_main_cp_state.vtx_desc.GetVertexArrayStatus(i) >= 0x2) - cached_arraybases[i] = Memory::GetPointer(g_main_cp_state.array_bases[i]); - } -} |
