From bc23737e20524572504f8c15f83e4092f0c9283c Mon Sep 17 00:00:00 2001 From: notaz Date: Thu, 12 Mar 2026 02:00:41 +0200 Subject: [PATCH] gpulib: fix intersect check as openbios triggered this, something else may easily do --- plugins/gpulib/gpu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/gpulib/gpu.c b/plugins/gpulib/gpu.c index b6f35656..f2a0b478 100644 --- a/plugins/gpulib/gpu.c +++ b/plugins/gpulib/gpu.c @@ -242,11 +242,11 @@ static noinline void decide_frameskip(struct psx_gpu *gpu, uint32_t flip_delay) static noinline void check_draw_to_display(struct psx_gpu *gpu) { uint32_t cmd_e3 = gpu->ex_regs[3]; - uint32_t x = cmd_e3 & 0x3ff; - uint32_t y = (cmd_e3 >> 10) & 0x3ff; + uint32_t x1 = cmd_e3 & 0x3ff, y1 = (cmd_e3 >> 10) & 0x3ff; + uint32_t x2 = gpu->screen.src_x, y2 = gpu->screen.src_y; + uint32_t w = gpu->screen.w, h = gpu->screen.h; uint32_t no_intersect = - (uint32_t)(x - gpu->screen.src_x) >= (uint32_t)gpu->screen.w || - (uint32_t)(y - gpu->screen.src_y) >= (uint32_t)gpu->screen.h; + x1 + w <= x2 || x2 + w <= x1 || y1 + h <= y2 || y2 + h <= y1; gpu->state.draw_display_intersect = !no_intersect; // no frameskip if it decides to draw to display area, // but not for interlace since it'll most likely always do that @@ -886,7 +886,7 @@ static noinline int do_cmd_buffer(struct psx_gpu *gpu, uint32_t *data, int count } // this is here because the renderer doesn't tell us if it saw e3 - if (unlikely(gpu->frameskip.set && old_e3 != gpu->ex_regs[3])) + if (unlikely(old_e3 != gpu->ex_regs[3])) check_draw_to_display(gpu); gpu->state.fb_dirty_display_area |= vram_dirty & gpu->state.draw_display_intersect; -- 2.47.3