summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/VertexLoaderManager.cpp
diff options
context:
space:
mode:
authorScott Mansell <phiren@gmail.com>2015-05-30 03:58:27 +1200
committerScott Mansell <phiren@gmail.com>2015-05-30 04:39:48 +1200
commit7df69829732745d98b843d37d68a65920d1d883b (patch)
tree25897d78db74fec776b5c679e71a3337868d50b7 /Source/Core/VideoCommon/VertexLoaderManager.cpp
parentf57517f1a05db1790f853bf43d6093c19478b4ce (diff)
Add a dirty flag for arraybases.
Only loop through and call getPointers when something has actually changed. Worth about 2-4% speedup un SMG over the previous commit.
Diffstat (limited to 'Source/Core/VideoCommon/VertexLoaderManager.cpp')
-rw-r--r--Source/Core/VideoCommon/VertexLoaderManager.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/VertexLoaderManager.cpp b/Source/Core/VideoCommon/VertexLoaderManager.cpp
index 4ebb07788b..dbb421991c 100644
--- a/Source/Core/VideoCommon/VertexLoaderManager.cpp
+++ b/Source/Core/VideoCommon/VertexLoaderManager.cpp
@@ -56,6 +56,10 @@ void Shutdown()
void UpdateVertexArrayPointers()
{
+ // Anything to update?
+ if (!g_main_cp_state.bases_dirty)
+ return;
+
// 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.
@@ -67,6 +71,8 @@ void UpdateVertexArrayPointers()
if (g_main_cp_state.vtx_desc.GetVertexArrayStatus(i) >= 0x2)
cached_arraybases[i] = Memory::GetPointer(g_main_cp_state.array_bases[i]);
}
+
+ g_main_cp_state.bases_dirty = false;
}
namespace
@@ -224,12 +230,14 @@ void LoadCPReg(u32 sub_cmd, u32 value, bool is_preprocess)
state->vtx_desc.Hex &= ~0x1FFFF; // keep the Upper bits
state->vtx_desc.Hex |= value;
state->attr_dirty = BitSet32::AllTrue(8);
+ state->bases_dirty = true;
break;
case 0x60:
state->vtx_desc.Hex &= 0x1FFFF; // keep the lower 17Bits
state->vtx_desc.Hex |= (u64)value << 17;
state->attr_dirty = BitSet32::AllTrue(8);
+ state->bases_dirty = true;
break;
case 0x70:
@@ -253,6 +261,7 @@ void LoadCPReg(u32 sub_cmd, u32 value, bool is_preprocess)
// Pointers to vertex arrays in GC RAM
case 0xA0:
state->array_bases[sub_cmd & 0xF] = value;
+ state->bases_dirty = true;
break;
case 0xB0: