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

Method CheckCLUTValidity

pcsx2/GS/GSState.cpp:5399–5428  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5397}
5398
5399__forceinline void GSState::CheckCLUTValidity(u32 prim)
5400{
5401 if (m_mem.m_clut.IsInvalid() & 2)
5402 return;
5403
5404 u32 n = NumIndicesForPrim(prim);
5405
5406 for (int i = 0; i < m_used_buffers_idx; i++)
5407 {
5408 GSDrawingEnvironment& buffered_env = m_env_buffers[i].m_env;
5409 const GSDrawingContext& ctx = buffered_env.CTXT[buffered_env.PRIM.CTXT];
5410 if ((m_index_buffers[i].tail > 0 || (m_vertex_buffers[i].tail == n - 1)) && (GSLocalMemory::m_psm[ctx.TEX0.PSM].pal == 0 || !buffered_env.PRIM.TME))
5411 {
5412 const GSLocalMemory::psm_t& fpsm = GSLocalMemory::m_psm[ctx.FRAME.PSM];
5413 const bool frame_needed = !(ctx.TEST.ATE && ctx.TEST.ATST == 0 && ctx.TEST.AFAIL == 2) && ((ctx.FRAME.FBMSK & fpsm.fmsk) != fpsm.fmsk);
5414 if (frame_needed && GSLocalMemory::m_psm[m_mem.m_clut.GetCLUTCPSM()].bpp == fpsm.bpp)
5415 {
5416 const u32 startbp = fpsm.info.bn(temp_draw_rect.x, temp_draw_rect.y, ctx.FRAME.Block(), ctx.FRAME.FBW);
5417
5418 // If it's a point, then we only have one coord, so the address for start and end will be the same, which is bad for the following check.
5419 u32 endbp = startbp;
5420 // otherwise calculate the end.
5421 if (prim != GS_POINTLIST || (m_index_buffers[i].tail > 1))
5422 endbp = fpsm.info.bn(temp_draw_rect.z - 1, temp_draw_rect.w - 1, ctx.FRAME.Block(), ctx.FRAME.FBW);
5423
5424 m_mem.m_clut.InvalidateRange(startbp, endbp, true);
5425 }
5426 }
5427 }
5428}
5429
5430template<u32 prim>
5431__forceinline void GSState::HandleAutoFlush()

Callers

nothing calls this directly

Calls 6

NumIndicesForPrimFunction · 0.85
GetCLUTCPSMMethod · 0.80
InvalidateRangeMethod · 0.80
IsInvalidMethod · 0.45
bnMethod · 0.45
BlockMethod · 0.45

Tested by

no test coverage detected