From ee569aa965ea8858b58bf22e639102fe5583fe88 Mon Sep 17 00:00:00 2001 From: buffi Date: Thu, 1 Jun 2023 08:04:08 +0200 Subject: [PATCH] video/epic12.cpp: Apply clipping to Blitter calculations as well. (#11295) * Fixes excessive blitter delays when games do large over-draws. * The fog in stage 1 of Mushihimesama Futari 1.5 is a good example of this. --- src/devices/video/epic12.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/devices/video/epic12.cpp b/src/devices/video/epic12.cpp index 97401c7a38e..15a2fc69792 100644 --- a/src/devices/video/epic12.cpp +++ b/src/devices/video/epic12.cpp @@ -436,6 +436,18 @@ inline void epic12_device::gfx_draw_shadow_copy(address_space &space, offs_t *ad return; } + // Clip the blitter operations, to have the calculations only respect the area being written. + // It's not 100% clear this is how this is performed, but it is clear that there should be some amount of clipping + // applied here to match the hardware. This way seems most likely, and maps well to the delays seen on hardware. + // One example of this being utilized heavily is the transparent fog in Mushihimesama Futari Stage 1. This is drawn as + // 256x256 sprites, with large parts clipped away. + dst_x_start = std::max(dst_x_start, (u16)m_clip.min_x); + dst_y_start = std::max(dst_y_start, (u16)m_clip.min_y); + dst_x_end = std::min(dst_x_end, (u16)m_clip.max_x); + dst_y_end = std::min(dst_y_end, (u16)m_clip.max_y); + src_dimx = dst_x_end - dst_x_start + 1; + src_dimy = dst_y_end - dst_y_start + 1; + m_blit_idle_op_bytes = 0; // Blitter no longer idle. // VRAM data is laid out in 32x32 pixel rows. Calculate amount of rows accessed.