Reset backdrop stretch when batching supersampled world lines

Keep line quads separate from pending backdrop batches and reset the key after earlier batches flush. Exercise both draw orders with actual GL readback. Fixes the remaining Tomba 2 fishing string offset (beads-w0mm).
This commit is contained in:
Matthew Stanley
2026-10-26 08:43:27 -07:00
parent c2648719e9
commit f4b1bb7bdf
2 changed files with 10 additions and 2 deletions
+4 -1
View File
@@ -4709,11 +4709,14 @@ static void gpu_geometry(GLenum mode, const int *xs, const int *ys,
}
line_to_quad(lv, quad);
if (s_fb_n > 0 && (s_fb_mode != GL_TRIANGLES || s_fb_semi != semi ||
s_fb_mask != (int)s_mask_set || s_fb_depth != 0))
s_fb_mask != (int)s_mask_set || s_fb_gate != 0 || s_fb_depth != 0))
flush_flat_batch();
if (s_fb_n + 6 > FLATBATCH_MAXV)
flush_flat_batch();
s_fb_mode = GL_TRIANGLES;
/* The expanded line is still world geometry. A previous backdrop
* batch may have left its stretch key set even after being flushed. */
s_fb_gate = 0;
s_fb_semi = semi;
s_fb_mask = (int)s_mask_set;
s_fb_depth = 0; /* lines are 2D: never depth-tested (G1.14) */
+6 -1
View File
@@ -1298,10 +1298,15 @@ static int backdrop_lines_main(int scale) {
g_ws_bd_stretch_on = 1;
g_ws_bd_phase_mode = 1;
g_ws_bd_stretch_pct = 0;
for (int policy = 0; policy < 2; ++policy) {
for (int policy = 0; policy < 2; ++policy) for (int order = 0; order < 3; ++order) {
glb_wide_clear(0, 0, 512, 0);
test_flat_backdrop = policy == 0;
test_backdrop_phase = policy == 1;
/* Cover both a pending backdrop batch and its key remaining after a
* flush. Supersampled lines expand to triangles, but must not join
* that backdrop batch or inherit its horizontal stretch. */
if (order) glb_draw_flat_triangle(4, 4, 20, 4, 4, 12, 0x4210);
if (order == 2) gl_renderer_sync_cpu();
glb_draw_line(64, 20, 64, 100, 0x7fff);
glb_draw_shaded_line(100, 20, 0x7fff, 100, 100, 0x7fff);
test_backdrop_phase = 0;