rnd(M03): introduce renderer facade seam
Work-Package: M03-RND-FACADE-001 Agent: sindo-main-codex Tests: facade/focus/coordinate/manifest contracts, renderer dry-run, coordination and documentation gates Fidelity: focus targets, budgets, queues, caches and visible renderer behavior remain unchanged
This commit is contained in:
@@ -64,7 +64,12 @@ func _capture_async() -> void:
|
||||
camera.far = 50000.0
|
||||
camera.position = _vector3(first.get("camera", [0.0, 0.0, 0.0]))
|
||||
(world as Node3D).add_child(camera)
|
||||
world.set("streaming_focus_source_path", NodePath("CheckpointCamera"))
|
||||
var render_facade := world.get_node_or_null("WorldRenderFacade")
|
||||
if render_facade == null:
|
||||
push_error("Streaming scene has no WorldRenderFacade")
|
||||
quit(1)
|
||||
return
|
||||
render_facade.set("streaming_focus_source_path", NodePath("../CheckpointCamera"))
|
||||
world.set("debug_streaming", true)
|
||||
world.set("runtime_stats_enabled", true)
|
||||
get_root().add_child(world)
|
||||
@@ -126,8 +131,7 @@ func _capture_async() -> void:
|
||||
if player != null:
|
||||
player.global_position = _vector3(checkpoint.get("player", checkpoint.get("target", [0.0, 0.0, 0.0])))
|
||||
_set_sky_time(world, float(checkpoint.get("time_hours", 13.0)))
|
||||
if world.has_method("refresh_streaming_focus"):
|
||||
world.call("refresh_streaming_focus", true)
|
||||
render_facade.call("refresh_streaming_focus", true)
|
||||
|
||||
if dry_run:
|
||||
print("RENDER_CHECKPOINT dry_run name=%s coverage=%s camera=%s target=%s yaw_offset=%.2f pitch_offset=%.2f time=%.2f" % [
|
||||
@@ -148,7 +152,7 @@ func _capture_async() -> void:
|
||||
var load_started := Time.get_ticks_usec()
|
||||
await create_timer(maxf(wait_seconds, 0.0)).timeout
|
||||
var load_time_ms := float(Time.get_ticks_usec() - load_started) / 1000.0
|
||||
var metrics := await _measure_frames(maxf(measure_seconds, 0.1), world)
|
||||
var metrics := await _measure_frames(maxf(measure_seconds, 0.1), render_facade)
|
||||
await RenderingServer.frame_post_draw
|
||||
|
||||
var image := get_root().get_texture().get_image()
|
||||
@@ -189,7 +193,7 @@ func _capture_async() -> void:
|
||||
quit(0)
|
||||
|
||||
|
||||
func _measure_frames(seconds: float, world: Node) -> Dictionary:
|
||||
func _measure_frames(seconds: float, render_facade: Node) -> Dictionary:
|
||||
var frame_times: Array[float] = []
|
||||
var deadline := Time.get_ticks_usec() + int(seconds * 1000000.0)
|
||||
var previous := Time.get_ticks_usec()
|
||||
@@ -200,8 +204,8 @@ func _measure_frames(seconds: float, world: Node) -> Dictionary:
|
||||
previous = now
|
||||
frame_times.sort()
|
||||
var snapshot := {}
|
||||
if world.has_method("render_baseline_snapshot"):
|
||||
snapshot = world.call("render_baseline_snapshot")
|
||||
if render_facade.has_method("renderer_metrics_snapshot"):
|
||||
snapshot = render_facade.call("renderer_metrics_snapshot")
|
||||
return {
|
||||
"frames": frame_times.size(),
|
||||
"frame_ms_p50": _percentile(frame_times, 0.50),
|
||||
|
||||
Reference in New Issue
Block a user