[CmdletBinding()] param( [string]$GodotPath, [string]$Output = "user://render_baseline", [string]$CacheState = "existing", [double]$WaitSeconds = 8.0, [double]$MeasureSeconds = 3.0, [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") $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 Write-Host "Renderer baseline completed. Report: $Output/report.json" } finally { Pop-Location }