From 5fcab0382d71e4cb49e1eadefcd655572ee19b6a Mon Sep 17 00:00:00 2001 From: Natalie Date: Sun, 10 May 2026 05:36:36 -0700 Subject: [PATCH] =?UTF-8?q?fix(game):=20=F0=9F=90=9B=20ensure=20accurate?= =?UTF-8?q?=20texture=20capture=20by=20forcing=20draw=20cycles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- src/game/engine/scenes/tests/gameplay_arc_proof.gd | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/game/engine/scenes/tests/gameplay_arc_proof.gd b/src/game/engine/scenes/tests/gameplay_arc_proof.gd index 24eb5574..ac68331f 100644 --- a/src/game/engine/scenes/tests/gameplay_arc_proof.gd +++ b/src/game/engine/scenes/tests/gameplay_arc_proof.gd @@ -228,10 +228,15 @@ func _capture_step(label: String, mode: String, focus: Vector2i = Vector2i.ZERO) else: _setup_camera_fit() _sync_renderers() - # Wall-clock wait so every queued canvas redraw and the camera transform - # both flush through the GPU composite before we read the texture. - # process_frame fires BEFORE draw; only a real timer hands the GPU time. - await get_tree().create_timer(0.5).timeout + # Force a draw cycle now so the canvas-item changes + camera transform + # both make it into the framebuffer before we read it. Without this the + # captured texture is a stale snapshot of the FIRST rendered frame and + # every subsequent screenshot serialises identical bytes (verified hash + # collision across 12 frames in an earlier run). + await get_tree().process_frame + await get_tree().process_frame + RenderingServer.force_draw(false, 0.0) + await get_tree().process_frame var image: Image = get_viewport().get_texture().get_image() if image == null: push_error("gameplay_arc: viewport image null at %s" % label)