Skip to content

Commit

Permalink
GS/PCRTC: Avoid trying to lookup bad framebuffers
Browse files Browse the repository at this point in the history
  • Loading branch information
refractionpcsx2 committed Sep 13, 2023
1 parent 8c65d4e commit 357a90d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions pcsx2/GS/Renderers/HW/GSRendererHW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ GSTexture* GSRendererHW::GetOutput(int i, float& scale, int& y_offset)
GSPCRTCRegs::PCRTCDisplay& curFramebuffer = PCRTCDisplays.PCRTCDisplays[index];
const GSVector2i framebufferSize(PCRTCDisplays.GetFramebufferSize(i));

if (curFramebuffer.framebufferRect.rempty() || curFramebuffer.FBW == 0)
return nullptr;

PCRTCDisplays.RemoveFramebufferOffset(i);
// TRACE(_T("[%d] GetOutput %d %05x (%d)\n"), (int)m_perfmon.GetFrame(), i, (int)TEX0.TBP0, (int)TEX0.PSM);

Expand Down
9 changes: 7 additions & 2 deletions pcsx2/GS/Renderers/SW/GSRendererSW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,13 @@ GSTexture* GSRendererSW::GetOutput(int i, float& scale, int& y_offset)
GSPCRTCRegs::PCRTCDisplay& curFramebuffer = PCRTCDisplays.PCRTCDisplays[index];
GSVector2i framebufferSize = PCRTCDisplays.GetFramebufferSize(i);
GSVector4i framebufferRect = PCRTCDisplays.GetFramebufferRect(i);
int w = curFramebuffer.FBW * 64;
int h = framebufferSize.y;

// Try to avoid broken/incomplete setups which are probably ingnored on console, but can cause us problems.
if (framebufferRect.rempty() || curFramebuffer.FBW == 0)
return nullptr;

const int w = curFramebuffer.FBW * 64;
const int h = framebufferSize.y;

if (g_gs_device->ResizeRenderTarget(&m_texture[index], w, h, false, false))
{
Expand Down

0 comments on commit 357a90d

Please sign in to comment.