diff --git a/runtime/src/gpu.c b/runtime/src/gpu.c index 459a0a59..47d063b8 100644 --- a/runtime/src/gpu.c +++ b/runtime/src/gpu.c @@ -5602,11 +5602,13 @@ static void ws_ui_prepass_add(const uint32_t *words, uint32_t word_count, int32_t width = max_x - min_x, height = max_y - min_y; int32_t X = ws_disp_x(), W = ws_disp_w(), H = ws_disp_h(); - /* Anything spanning the whole display width is a full-width overlay -- - * letterbox bars, fade strips, subtitle bands -- not a widget: it widens - * with the image. Squashed as UI, a cutscene's bars left the revealed - * margins showing whatever the frame cleared to (Spider-Man). */ - if ((min_x <= X && max_x >= X + W) || + /* Anything spanning the display width (to within W/64 of each edge) is a + * full-width overlay -- letterbox bars, fade strips, menu band rules -- + * not a widget: it widens with the image. Squashed as UI, a cutscene's + * bars left the revealed margins showing whatever the frame cleared to, + * and the pause menu's rules (x 2..510 of 512) stopped short of the band + * they frame (Spider-Man). */ + if ((min_x <= X + W / 64 && max_x >= X + W - W / 64) || (width > W / 2 && height > H / 4)) { ws_ui_reject.too_big++; return; diff --git a/runtime/tests/test_ws_auto_ui_untextured_exec.c b/runtime/tests/test_ws_auto_ui_untextured_exec.c index 7b2c012a..f22bc5d2 100644 --- a/runtime/tests/test_ws_auto_ui_untextured_exec.c +++ b/runtime/tests/test_ws_auto_ui_untextured_exec.c @@ -259,6 +259,15 @@ int main(void) { gpu_ws_prepass_linked_list(OT_HEAD); assert(ws_ui_prepass_count == 2); /* frame + gouraud fill only */ assert(ws_ui_reject.too_big == 1); + /* A rule stopping two pixels short of each edge is full width too. */ + const uint32_t rule[5] = { + 0x28000000u, pack_vertex((int16_t)(bx0 + 2), 40), pack_vertex((int16_t)(bx1 - 2), 40), + pack_vertex((int16_t)(bx0 + 2), 44), pack_vertex((int16_t)(bx1 - 2), 44), + }; + put_node(NODE_FLAT, 0xFFFFFFu, rule, 5); + gpu_ws_prepass_linked_list(OT_HEAD); + assert(ws_ui_prepass_count == 2 && ws_ui_reject.too_big == 1); + put_node(NODE_FLAT, 0xFFFFFFu, bar, 5); gpu_exec_reset_triangles(); load_packet(NODE_FLAT, 5); gp0_exec_mono_quad();