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

Method InitReadFIFO

pcsx2/GS/GSState.cpp:2950–2988  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2948}
2949
2950void GSState::InitReadFIFO(u8* mem, int len)
2951{
2952 // No size or already a transfer in progress.
2953 if (len <= 0 || m_tr.total != 0)
2954 return;
2955
2956 if (m_env.TRXDIR.XDIR == 3)
2957 return;
2958
2959 const int w = m_env.TRXREG.RRW;
2960 const int h = m_env.TRXREG.RRH;
2961
2962 const u16 bpp = GSLocalMemory::m_psm[m_env.BITBLTBUF.SPSM].trbpp;
2963
2964 CheckWriteOverlap(false, true);
2965
2966 if (!m_tr.Update(w, h, bpp, len))
2967 return;
2968
2969 const int sx = m_env.TRXPOS.SSAX;
2970 const int sy = m_env.TRXPOS.SSAY;
2971 const GSVector4i r(sx, sy, sx + w, sy + h);
2972
2973 if (m_tr.x == sx && m_tr.y == sy)
2974 InvalidateLocalMem(m_env.BITBLTBUF, r);
2975
2976 // Read the image all in one go.
2977 m_mem.ReadImageX(m_tr.x, m_tr.y, m_tr.buff, m_tr.total, m_env.BITBLTBUF, m_env.TRXPOS, m_env.TRXREG);
2978
2979 if (GSConfig.SaveRT && GSConfig.ShouldDump(s_n, g_perfmon.GetFrame()))
2980 {
2981 const std::string s(GetDrawDumpPath(
2982 "%05lld_read_%05x_%d_%s_%d_%d_%d_%d.bmp",
2983 s_n, (int)m_env.BITBLTBUF.SBP, (int)m_env.BITBLTBUF.SBW, GSUtil::GetPSMName(m_env.BITBLTBUF.SPSM),
2984 r.left, r.top, r.right, r.bottom));
2985
2986 m_mem.SaveBMP(s, m_env.BITBLTBUF.SBP, m_env.BITBLTBUF.SBW, m_env.BITBLTBUF.SPSM, r.right, r.bottom);
2987 }
2988}
2989
2990// NOTE: called from outside MTGS
2991void GSState::Read(u8* mem, int len)

Callers 1

GSInitAndReadFIFOFunction · 0.80

Calls 5

ShouldDumpMethod · 0.80
GetFrameMethod · 0.80
SaveBMPMethod · 0.80
UpdateMethod · 0.45
ReadImageXMethod · 0.45

Tested by

no test coverage detected