mirror of https://github.com/PCSX2/pcsx2.git
GS: Only allocate valid page array when needed
This commit is contained in:
parent
b3a2d3c1e4
commit
b389c6e103
|
@ -760,9 +760,9 @@ void GSTextureCache::InvalidateVideoMem(const GSOffset& off, const GSVector4i& r
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
u32* RESTRICT valid = s->m_valid;
|
u32* RESTRICT valid = s->m_valid.get();
|
||||||
|
|
||||||
if (!s->CanPreload())
|
if (valid && !s->CanPreload())
|
||||||
{
|
{
|
||||||
// Invalidate data of input texture
|
// Invalidate data of input texture
|
||||||
if (s->m_repeating)
|
if (s->m_repeating)
|
||||||
|
@ -1729,8 +1729,6 @@ GSTextureCache::Source::Source(GSRenderer* r, const GIFRegTEX0& TEX0, const GIFR
|
||||||
memset(m_layer_TEX0, 0, sizeof(m_layer_TEX0));
|
memset(m_layer_TEX0, 0, sizeof(m_layer_TEX0));
|
||||||
memset(m_layer_hash, 0, sizeof(m_layer_hash));
|
memset(m_layer_hash, 0, sizeof(m_layer_hash));
|
||||||
|
|
||||||
memset(m_valid, 0, sizeof(m_valid));
|
|
||||||
|
|
||||||
m_write.rect = (GSVector4i*)_aligned_malloc(3 * sizeof(GSVector4i), 32);
|
m_write.rect = (GSVector4i*)_aligned_malloc(3 * sizeof(GSVector4i), 32);
|
||||||
m_write.count = 0;
|
m_write.count = 0;
|
||||||
|
|
||||||
|
@ -1776,6 +1774,9 @@ void GSTextureCache::Source::Update(const GSVector4i& rect, int level)
|
||||||
|
|
||||||
u32 blocks = 0;
|
u32 blocks = 0;
|
||||||
|
|
||||||
|
if (!m_valid)
|
||||||
|
m_valid = std::make_unique<u32[]>(MAX_PAGES);
|
||||||
|
|
||||||
if (m_repeating)
|
if (m_repeating)
|
||||||
{
|
{
|
||||||
for (int y = r.top; y < r.bottom; y += bs.y, bn.nextBlockY())
|
for (int y = r.top; y < r.bottom; y += bs.y, bn.nextBlockY())
|
||||||
|
|
|
@ -153,8 +153,8 @@ public:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<Palette> m_palette_obj;
|
std::shared_ptr<Palette> m_palette_obj;
|
||||||
|
std::unique_ptr<u32[]> m_valid;// each u32 bits map to the 32 blocks of that page
|
||||||
GSTexture* m_palette;
|
GSTexture* m_palette;
|
||||||
u32 m_valid[MAX_PAGES]; // each u32 bits map to the 32 blocks of that page
|
|
||||||
GSVector4i m_valid_rect;
|
GSVector4i m_valid_rect;
|
||||||
u8 m_valid_hashes = 0;
|
u8 m_valid_hashes = 0;
|
||||||
u8 m_complete_layers = 0;
|
u8 m_complete_layers = 0;
|
||||||
|
|
Loading…
Reference in New Issue