Files
open-wc/tools/run_render_baseline.ps1
T
sindoring 8e8ea32ba3 test(M00): add renderer coordinate calibration
Work-Package: M00-QAR-COORD-CALIBRATION-001
Agent: sindo-main-codex
Tests: coordinate probe, M00 dry-run, coordination and documentation gates
Fidelity: five build 12340 camera points round-trip within 0.000015 units
2026-07-11 19:09:46 +04:00

96 lines
3.7 KiB
PowerShell

[CmdletBinding()]
param(
[string]$GodotPath,
[string]$Output = "user://render_baseline",
[string]$CacheState = "existing",
[double]$WaitSeconds = 8.0,
[double]$MeasureSeconds = 3.0,
[string]$ReferenceCheckpointDirectory,
[string]$VisualComparisonReport = "user://render_baseline/visual_comparison.json",
[int]$VisualComparisonWidth = 2560,
[int]$VisualComparisonHeight = 1440,
[switch]$DryRun
)
$ErrorActionPreference = "Stop"
$repoRoot = Split-Path -Parent $PSScriptRoot
if (-not $GodotPath) {
$command = Get-Command godot -ErrorAction SilentlyContinue
if ($command) {
$GodotPath = $command.Source
} else {
$GodotPath = Join-Path $env:TEMP "godot-4.6.1-openwc\Godot_v4.6.1-stable_win64.exe"
}
}
if (-not (Test-Path -LiteralPath $GodotPath)) {
throw "Godot executable not found: $GodotPath"
}
$revision = (& git -C $repoRoot rev-parse --short HEAD).Trim()
if (-not $revision) {
$revision = "worktree"
}
function Invoke-GodotStep {
param([string]$Name, [string[]]$Arguments)
Write-Host "[$Name] $GodotPath $($Arguments -join ' ')"
$process = Start-Process -FilePath $GodotPath -ArgumentList $Arguments -NoNewWindow -Wait -PassThru
if ($process.ExitCode -ne 0) {
throw "$Name failed with exit code $($process.ExitCode)"
}
}
Push-Location $repoRoot
try {
Invoke-GodotStep "project-load" @("--headless", "--path", ".", "--quit")
Invoke-GodotStep "render-materials" @("--headless", "--path", ".", "--script", "res://src/tools/verify_render_materials.gd")
Invoke-GodotStep "m2-unique-dedupe" @("--headless", "--path", ".", "--script", "res://src/tools/verify_m2_unique_dedupe.gd")
Invoke-GodotStep "baseline-manifest" @("--headless", "--path", ".", "--script", "res://src/tools/verify_render_baseline_manifest.gd")
Invoke-GodotStep "coordinate-calibration" @("--headless", "--path", ".", "--script", "res://src/tools/verify_render_coordinate_calibration.gd")
$captureArgs = @(
"--path", ".",
"--script", "res://src/tools/capture_render_checkpoints.gd",
"--",
"--output", $Output,
"--cache-state", $CacheState,
"--revision", $revision,
"--wait", $WaitSeconds.ToString([Globalization.CultureInfo]::InvariantCulture),
"--measure", $MeasureSeconds.ToString([Globalization.CultureInfo]::InvariantCulture)
)
if ($DryRun) {
$captureArgs = @("--headless") + $captureArgs + @("--dry-run")
}
Invoke-GodotStep "capture" $captureArgs
if ($ReferenceCheckpointDirectory) {
if ($DryRun) {
throw "Reference checkpoint comparison requires PNG capture; remove -DryRun"
}
$visualCandidateOutput = "$Output/visual_comparison_candidates"
$visualCaptureArgs = @(
"--path", ".",
"--script", "res://src/tools/capture_render_checkpoints.gd",
"--",
"--output", $visualCandidateOutput,
"--cache-state", $CacheState,
"--revision", $revision,
"--wait", $WaitSeconds.ToString([Globalization.CultureInfo]::InvariantCulture),
"--measure", $MeasureSeconds.ToString([Globalization.CultureInfo]::InvariantCulture),
"--viewport-width", $VisualComparisonWidth.ToString(),
"--viewport-height", $VisualComparisonHeight.ToString()
)
Invoke-GodotStep "visual-capture" $visualCaptureArgs
Invoke-GodotStep "visual-comparison" @(
"--headless", "--path", ".",
"--script", "res://src/tools/compare_render_checkpoints.gd",
"--",
"--reference", $ReferenceCheckpointDirectory,
"--candidate", $visualCandidateOutput,
"--output", $VisualComparisonReport
)
}
Write-Host "Renderer baseline completed. Report: $Output/report.json"
} finally {
Pop-Location
}