mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 06:15:38 +00:00
GPU: Wrap display VRAM coordinates properly
This commit is contained in:
parent
866cbdca4b
commit
1c8a896a55
|
@ -641,14 +641,14 @@ void GPU::UpdateCRTCDisplayParameters()
|
||||||
if (horizontal_display_start >= cs.horizontal_visible_start)
|
if (horizontal_display_start >= cs.horizontal_visible_start)
|
||||||
{
|
{
|
||||||
cs.display_origin_left = (horizontal_display_start - cs.horizontal_visible_start) / cs.dot_clock_divider;
|
cs.display_origin_left = (horizontal_display_start - cs.horizontal_visible_start) / cs.dot_clock_divider;
|
||||||
cs.display_vram_left = std::min<u16>(cs.regs.X, VRAM_WIDTH - 1);
|
cs.display_vram_left = cs.regs.X;
|
||||||
horizontal_skip_pixels = 0;
|
horizontal_skip_pixels = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
horizontal_skip_pixels = (cs.horizontal_visible_start - horizontal_display_start) / cs.dot_clock_divider;
|
horizontal_skip_pixels = (cs.horizontal_visible_start - horizontal_display_start) / cs.dot_clock_divider;
|
||||||
cs.display_origin_left = 0;
|
cs.display_origin_left = 0;
|
||||||
cs.display_vram_left = std::min<u16>(cs.regs.X + horizontal_skip_pixels, VRAM_WIDTH - 1);
|
cs.display_vram_left = (cs.regs.X + horizontal_skip_pixels) % VRAM_WIDTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply the crop from the start (usually overscan)
|
// apply the crop from the start (usually overscan)
|
||||||
|
@ -665,7 +665,7 @@ void GPU::UpdateCRTCDisplayParameters()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cs.display_origin_top = 0;
|
cs.display_origin_top = 0;
|
||||||
cs.display_vram_top = cs.regs.Y + ((cs.vertical_visible_start - vertical_display_start) << y_shift);
|
cs.display_vram_top = (cs.regs.Y + ((cs.vertical_visible_start - vertical_display_start) << y_shift)) % VRAM_HEIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vertical_display_end <= cs.vertical_visible_end)
|
if (vertical_display_end <= cs.vertical_visible_end)
|
||||||
|
|
Loading…
Reference in a new issue