Preserve field masks in wide flat overlay geometry

This commit is contained in:
Alexandros Mandravillis
2026-09-06 14:16:53 +03:00
parent 5aee9c831a
commit 6fcfb8adbd
5 changed files with 45 additions and 19 deletions
+13 -1
View File
@@ -198,8 +198,20 @@ void gr_draw_shaded_textured_triangle(int x0, int y0, int u0, int v0, uint32_t c
GR_TRIANGLE_ROWS(gr_min(y0, gr_min(y1, y2)), gr_max(y0, gr_max(y1, y2)), g_b->draw_shaded_textured_triangle(x0, y0, u0, v0, c0, x1, y1, u1, v1, c1,
x2, y2, u2, v2, c2, clut_x, clut_y, texpage, raw));
}
/* Wide flat-overlay backends intentionally replace the clip with a full
* surface scissor. Submit row-height geometry too, so the field mask survives
* that path while ordinary full-screen overlays keep their existing policy. */
static void gr_draw_flat_rect_row(int x, int w, uint16_t c) {
int x1, y1, x2, y2;
g_b->get_draw_area(&x1, &y1, &x2, &y2);
g_b->draw_flat_rect(x, y1, w, 1, c);
}
void gr_draw_flat_rect(int x, int y, int w, int h, uint16_t c) {
GR_RASTER_ROWS(y, y + h - 1, g_b->draw_flat_rect(x, y, w, h, c));
if (gpu_raster_skipped_row() < 0) {
g_b->draw_flat_rect(x, y, w, h, c);
return;
}
GR_RASTER_ROWS(y, y + h - 1, gr_draw_flat_rect_row(x, w, c));
}
void gr_draw_textured_rect(int x, int y, int w, int h, int u, int v,
uint16_t clut_x, uint16_t clut_y, uint16_t texpage) {
+6 -3
View File
@@ -2790,8 +2790,8 @@ static void vkb_draw_gouraud_triangle(int x0,int y0,uint16_t c0,int x1,int y1,ui
/* Full-screen-overlay wide pass (pause gray-filter / load fade): draw a flat
* rect covering the FULL wide width [0, wide_w) x [y, y+h) directly into the
* active wide surface (positions already wide-space, u_xoff = 0). Mirrors GL's
* wide_flat_rect_direct: full-width scissor (the overlay must dim the
* revealed margins too), while preserving the draw-area Y band. The 6 verts are consumed privately (s_vbase bumped)
* wide_flat_rect_direct: full-surface scissor (the overlay must dim the
* revealed margins too). The 6 verts are consumed privately (s_vbase bumped)
* so they never join a canonical batch. */
static void wide_overlay_rect(int y, int h, uint16_t c, int semi) {
if (s_wide_cur < 0 || !s_ready) return;
@@ -2803,9 +2803,12 @@ static void wide_overlay_rect(int y, int h, uint16_t c, int semi) {
push_vert(x0, fy0, col); push_vert(x1, fy1, col); push_vert(x0, fy1, col);
s_vbase += s_vcount; s_vcount = 0; /* consume privately */
int blend = (semi < 0) ? 0 : (semi + 1);
int S = s_scale;
VkCommandBuffer cb = begin_oneshot();
/* Keep the full width and current Y clip, including interlaced row clips. */
wide_pass_begin(cb);
/* Overlay covers the whole surface: override the band scissor. */
VkRect2D sc = { { 0, 0 }, { (uint32_t)(s_wide_w * S), (uint32_t)(VRAM_H * S) } };
p_vkCmdSetScissor(cb, 0, 1, &sc);
bind_masked(cb, 0, 0, blend, s_mask_check, s_mask_set);
GeoPush gp = { px_shift(), 0.0f, (float)s_wide_w / 2.0f };
p_vkCmdPushConstants(cb, s_pl_geo, VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof gp, &gp);