MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / ReadLocalMemoryUnsync

Method ReadLocalMemoryUnsync

pcsx2/GS/GSState.cpp:3279–3315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3277}
3278
3279void GSState::ReadLocalMemoryUnsync(u8* mem, int qwc, GIFRegBITBLTBUF BITBLTBUF, GIFRegTRXPOS TRXPOS, GIFRegTRXREG TRXREG)
3280{
3281 const int w = TRXREG.RRW;
3282 const int h = TRXREG.RRH;
3283
3284 const u16 bpp = GSLocalMemory::m_psm[BITBLTBUF.SPSM].trbpp;
3285
3286 GSTransferBuffer tb;
3287
3288 if(m_tr.end >= m_tr.total || m_tr.write == true)
3289 tb.Init(TRXPOS, TRXREG, BITBLTBUF, false);
3290
3291 int len = qwc * 16;
3292 if (!tb.Update(w, h, bpp, len))
3293 return;
3294
3295 if (m_tr.start == 0)
3296 {
3297 m_mem.ReadImageX(tb.x, tb.y, m_tr.buff, m_tr.total, BITBLTBUF, TRXPOS, TRXREG);
3298 m_tr.start += m_tr.total;
3299 }
3300
3301 if ((m_tr.end + len) > m_mem.m_vmsize)
3302 {
3303 const int masked_end = m_tr.end & 0x3FFFFF; // 4mb.
3304 const int first_transfer = m_mem.m_vmsize - masked_end;
3305 const int second_transfer = len - first_transfer;
3306 memcpy(mem, &m_tr.buff[masked_end], first_transfer);
3307 memcpy(&mem[first_transfer], &m_tr.buff, second_transfer);
3308 m_tr.end += len;
3309 }
3310 else
3311 {
3312 memcpy(mem, &m_tr.buff[m_tr.end], len);
3313 m_tr.end += len;
3314 }
3315}
3316
3317void GSState::PurgeTextureCache(bool sources, bool targets, bool hash_cache)
3318{

Callers 1

GSReadLocalMemoryUnsyncFunction · 0.80

Calls 3

InitMethod · 0.45
UpdateMethod · 0.45
ReadImageXMethod · 0.45

Tested by

no test coverage detected