Skip to content

Commit

Permalink
GPU: Display scanout resolution regardless of crop mode
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Nov 29, 2024
1 parent b059cda commit cbc16be
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion src/core/gpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,39 @@ void GPU::UpdateResolutionScale()

std::tuple<u32, u32> GPU::GetFullDisplayResolution() const
{
return std::tie(m_crtc_state.display_width, m_crtc_state.display_height);
u32 width, height;
if (IsDisplayDisabled())
{
width = 0;
height = 0;
}
else
{
s32 xmin, xmax, ymin, ymax;
if (!m_GPUSTAT.pal_mode)
{
xmin = NTSC_HORIZONTAL_ACTIVE_START;
xmax = NTSC_HORIZONTAL_ACTIVE_END;
ymin = NTSC_VERTICAL_ACTIVE_START;
ymax = NTSC_VERTICAL_ACTIVE_END;
}
else
{
xmin = PAL_HORIZONTAL_ACTIVE_START;
xmax = PAL_HORIZONTAL_ACTIVE_END;
ymin = PAL_VERTICAL_ACTIVE_START;
ymax = PAL_VERTICAL_ACTIVE_END;
}

width = static_cast<u32>(std::max<s32>(std::clamp<s32>(m_crtc_state.regs.X2, xmin, xmax) -
std::clamp<s32>(m_crtc_state.regs.X1, xmin, xmax),
0) /
m_crtc_state.dot_clock_divider);
height = static_cast<u32>(std::max<s32>(
std::clamp<s32>(m_crtc_state.regs.Y2, ymin, ymax) - std::clamp<s32>(m_crtc_state.regs.Y1, ymin, ymax), 0));
}

return std::tie(width, height);
}

void GPU::Reset(bool clear_vram)
Expand Down

2 comments on commit cbc16be

@crashGG
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could keep an option so that the actual screen resolution seen by users is consistent with the displayed resolution? In this way, when switching between different cropping methods, users can know how many pixels are cropped.

All Borders Crop: full 240 lines
Image

Only Overscan Area Crop: 224 lines
Image

@stenzek
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GPU debug window already has that information. The OSD shows the render/scanout resolution, which is independent of cropping.

Please sign in to comment.