fix(@projects/@magic-civilization): 🐛 adjust gpu flush timing in arc proof test

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Natalie 2026-05-10 05:33:27 -07:00
parent 2c1212c4e7
commit 1529b878c3

View file

@ -223,18 +223,15 @@ func _ready() -> void:
func _capture_step(label: String, mode: String, focus: Vector2i = Vector2i.ZERO) -> void:
_sync_renderers()
if mode == "focus":
_focus_camera(focus, 5.0 * 384.0)
else:
_setup_camera_fit()
# Wait two real frames-rendered to flush the GPU composite. process_frame
# fires before draw; frame_post_draw fires AFTER GPU composite, which is
# what `get_viewport().get_texture()` actually reads.
for _i: int in range(3):
await get_tree().process_frame
for _j: int in range(2):
await RenderingServer.frame_post_draw
_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
var image: Image = get_viewport().get_texture().get_image()
if image == null:
push_error("gameplay_arc: viewport image null at %s" % label)