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.
This commit is contained in:
parent
f57517f1a0
commit
7df6982973
|
@ -23,11 +23,13 @@ void SWLoadCPReg(u32 sub_cmd, u32 value)
|
||||||
case 0x50:
|
case 0x50:
|
||||||
g_main_cp_state.vtx_desc.Hex &= ~0x1FFFF; // keep the Upper bits
|
g_main_cp_state.vtx_desc.Hex &= ~0x1FFFF; // keep the Upper bits
|
||||||
g_main_cp_state.vtx_desc.Hex |= value;
|
g_main_cp_state.vtx_desc.Hex |= value;
|
||||||
|
g_main_cp_state.bases_dirty = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x60:
|
case 0x60:
|
||||||
g_main_cp_state.vtx_desc.Hex &= 0x1FFFF; // keep the lower 17Bits
|
g_main_cp_state.vtx_desc.Hex &= 0x1FFFF; // keep the lower 17Bits
|
||||||
g_main_cp_state.vtx_desc.Hex |= (u64)value << 17;
|
g_main_cp_state.vtx_desc.Hex |= (u64)value << 17;
|
||||||
|
g_main_cp_state.bases_dirty = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x70:
|
case 0x70:
|
||||||
|
@ -48,6 +50,7 @@ void SWLoadCPReg(u32 sub_cmd, u32 value)
|
||||||
// Pointers to vertex arrays in GC RAM
|
// Pointers to vertex arrays in GC RAM
|
||||||
case 0xA0:
|
case 0xA0:
|
||||||
g_main_cp_state.array_bases[sub_cmd & 0xF] = value;
|
g_main_cp_state.array_bases[sub_cmd & 0xF] = value;
|
||||||
|
g_main_cp_state.bases_dirty = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0xB0:
|
case 0xB0:
|
||||||
|
|
|
@ -22,7 +22,10 @@ void DoCPState(PointerWrap& p)
|
||||||
p.DoArray(g_main_cp_state.vtx_attr, 8);
|
p.DoArray(g_main_cp_state.vtx_attr, 8);
|
||||||
p.DoMarker("CP Memory");
|
p.DoMarker("CP Memory");
|
||||||
if (p.mode == PointerWrap::MODE_READ)
|
if (p.mode == PointerWrap::MODE_READ)
|
||||||
|
{
|
||||||
CopyPreprocessCPStateFromMain();
|
CopyPreprocessCPStateFromMain();
|
||||||
|
g_main_cp_state.bases_dirty = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CopyPreprocessCPStateFromMain()
|
void CopyPreprocessCPStateFromMain()
|
||||||
|
|
|
@ -255,6 +255,7 @@ struct CPState final
|
||||||
|
|
||||||
// Attributes that actually belong to VertexLoaderManager:
|
// Attributes that actually belong to VertexLoaderManager:
|
||||||
BitSet32 attr_dirty;
|
BitSet32 attr_dirty;
|
||||||
|
bool bases_dirty;
|
||||||
VertexLoaderBase* vertex_loaders[8];
|
VertexLoaderBase* vertex_loaders[8];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,10 @@ void Shutdown()
|
||||||
|
|
||||||
void UpdateVertexArrayPointers()
|
void UpdateVertexArrayPointers()
|
||||||
{
|
{
|
||||||
|
// Anything to update?
|
||||||
|
if (!g_main_cp_state.bases_dirty)
|
||||||
|
return;
|
||||||
|
|
||||||
// Some games such as Burnout 2 can put invalid addresses into
|
// Some games such as Burnout 2 can put invalid addresses into
|
||||||
// the array base registers. (see issue 8591)
|
// the array base registers. (see issue 8591)
|
||||||
// But the vertex arrays with invalid addresses aren't actually enabled.
|
// 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)
|
if (g_main_cp_state.vtx_desc.GetVertexArrayStatus(i) >= 0x2)
|
||||||
cached_arraybases[i] = Memory::GetPointer(g_main_cp_state.array_bases[i]);
|
cached_arraybases[i] = Memory::GetPointer(g_main_cp_state.array_bases[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_main_cp_state.bases_dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
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 &= ~0x1FFFF; // keep the Upper bits
|
||||||
state->vtx_desc.Hex |= value;
|
state->vtx_desc.Hex |= value;
|
||||||
state->attr_dirty = BitSet32::AllTrue(8);
|
state->attr_dirty = BitSet32::AllTrue(8);
|
||||||
|
state->bases_dirty = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x60:
|
case 0x60:
|
||||||
state->vtx_desc.Hex &= 0x1FFFF; // keep the lower 17Bits
|
state->vtx_desc.Hex &= 0x1FFFF; // keep the lower 17Bits
|
||||||
state->vtx_desc.Hex |= (u64)value << 17;
|
state->vtx_desc.Hex |= (u64)value << 17;
|
||||||
state->attr_dirty = BitSet32::AllTrue(8);
|
state->attr_dirty = BitSet32::AllTrue(8);
|
||||||
|
state->bases_dirty = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x70:
|
case 0x70:
|
||||||
|
@ -253,6 +261,7 @@ void LoadCPReg(u32 sub_cmd, u32 value, bool is_preprocess)
|
||||||
// Pointers to vertex arrays in GC RAM
|
// Pointers to vertex arrays in GC RAM
|
||||||
case 0xA0:
|
case 0xA0:
|
||||||
state->array_bases[sub_cmd & 0xF] = value;
|
state->array_bases[sub_cmd & 0xF] = value;
|
||||||
|
state->bases_dirty = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0xB0:
|
case 0xB0:
|
||||||
|
|
Loading…
Reference in New Issue