Skip to content

Bring PS5 GTA6 to 120FPS with DLSS 5. An advanced Windows video player and capture enhancement tool featuring real-time preview for videos, images, and capture card sources. Combine AI-powered Super Resolution, DLSS5 image enhancement, and Frame Generation to deliver a next-generation visual experience.

C++
10.6 KB
Raw Blame
[CmdletBinding()]
param([Parameter(Mandatory = $true)][string]$Root)

# Veyra Phase 3 gate: minimal video pipeline (Playbook section 16 Phase 3).
# Encodes every completion threshold:
#   - vcpkg FFmpeg 9.0.1 dependency present at the pinned install root;
#   - veyra_media builds and a software-decode baseline run (H.264) succeeds
#     with PTS-monotonic statistics from a real JSON summary;
#   - D3D12VA run reports the shared Veyra device and AV_PIX_FMT_D3D12;
#   - normal path performs zero GPU->CPU pixel readbacks (counter in JSON);
#   - seek storm (10 seeks) leaves no stale history (reset counters, hashes);
#   - bounded queues (max depths in JSON within limits);
#   - proprietary paths remain ignored.
# Fail-closed: missing command/file/field/threshold breach fails.

Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"

$failures = New-Object System.Collections.Generic.List[string]
$checkCount = 0

function Add-GateCheck {
    param([string]$Name, [bool]$Passed, [string]$Detail)
    $script:checkCount = $script:checkCount + 1
    $tag = "FAIL"
    if ($Passed) { $tag = "PASS" }
    Write-Host ("[{0}] {1} :: {2}" -f $tag, $Name, $Detail)
    if (-not $Passed) {
        $script:failures.Add($Name) | Out-Null
    }
}

function Test-GateEnd {
    if ($script:failures.Count -gt 0) {
        Write-Host ("VEYRA PHASE 3 GATE FAILED: {0} of {1} checks failed." -f $script:failures.Count, $script:checkCount)
        Write-Host ("Failed checks: {0}" -f ($script:failures -join ", "))
        exit 1
    }
}

$runId = [guid]::NewGuid().ToString("N")
$gateStart = Get-Date
Write-Host ("Phase 3 gate run-id: {0}" -f $runId)

# FFmpeg cannot build under a path containing spaces, so the dependency tree
# lives at C:\veyra-deps (pinned vcpkg baseline; see JOURNAL).
$installedRoot = "C:\veyra-deps\installed\x64-windows"

# ---------------------------------------------------------------------------
# 1. Required project inputs
# ---------------------------------------------------------------------------
$requiredInputs = @(
    "src\media\FFmpegDemuxer.cpp",
    "src\media\FFmpegVideoDecoder.cpp",
    "tools\media_probe\main.cpp",
    "shaders\YuvToLinearRgb.hlsl",
    "vcpkg.json",
    "scripts\build.ps1"
)
foreach ($relative in $requiredInputs) {
    $path = Join-Path $Root $relative
    Add-GateCheck ("input:{0}" -f $relative) (Test-Path -LiteralPath $path -PathType Leaf) "present"
}
Test-GateEnd

# ---------------------------------------------------------------------------
# 2. Dependency presence (FFmpeg 9.0.1 via pinned vcpkg)
# ---------------------------------------------------------------------------
$ffmpegDlls = @(
    @{ Lib = "avcodec"; Dll = "avcodec-63.dll" },
    @{ Lib = "avformat"; Dll = "avformat-63.dll" },
    @{ Lib = "swscale"; Dll = "swscale-10.dll" },
    @{ Lib = "swresample"; Dll = "swresample-7.dll" }
)
foreach ($entry in $ffmpegDlls) {
    $dll = Join-Path $installedRoot ("bin\" + $entry.Dll)
    Add-GateCheck ("ffmpeg:{0}-dll" -f $entry.Lib) (Test-Path -LiteralPath $dll -PathType Leaf) ("path={0}" -f $dll)
}
Test-GateEnd

# ---------------------------------------------------------------------------
# 3. Build both configurations
# ---------------------------------------------------------------------------
$buildScript = Join-Path $Root "scripts\build.ps1"
$shell = (Get-Process -Id $PID).Path
& $shell -NoProfile -ExecutionPolicy Bypass -File $buildScript -Root $Root -Preset x64-debug
Add-GateCheck "build:x64-debug" ($LASTEXITCODE -eq 0) ("exitCode={0}" -f $LASTEXITCODE)
& $shell -NoProfile -ExecutionPolicy Bypass -File $buildScript -Root $Root -Preset x64-release
Add-GateCheck "build:x64-release" ($LASTEXITCODE -eq 0) ("exitCode={0}" -f $LASTEXITCODE)
Test-GateEnd

# ---------------------------------------------------------------------------
# 4. Test clip presence (H.264) - generated by the media tooling (P3.2)
# ---------------------------------------------------------------------------
$testClip = Join-Path $Root "validation\fixed_clips\test_h264_1080p.mp4"
Add-GateCheck "clip:test-h264" (Test-Path -LiteralPath $testClip -PathType Leaf) ("path={0}" -f $testClip)
Test-GateEnd

$logDir = Join-Path $Root ("logs\phase3\" + $runId)
New-Item -ItemType Directory -Force -Path $logDir | Out-Null

# FFmpeg DLLs live in the external dependency root; prepend them to PATH for
# every probe invocation in this gate session.
$env:PATH = "$installedRoot\bin;" + $env:PATH

# ---------------------------------------------------------------------------
# 5. Software-decode baseline run (PTS/VFR handling; Playbook 3A)
# ---------------------------------------------------------------------------
$probeDebug = Join-Path $Root "out\build\x64-debug\veyra_media_probe.exe"
$probeRelease = Join-Path $Root "out\build\x64-release\veyra_media_probe.exe"
Add-GateCheck "probe:exe-debug" (Test-Path -LiteralPath $probeDebug -PathType Leaf) "present"
Add-GateCheck "probe:exe-release" (Test-Path -LiteralPath $probeRelease -PathType Leaf) "present"
Test-GateEnd

$swLog = Join-Path $logDir "software-decode.log"
$swJson = Join-Path $logDir "software-decode.json"
& $probeRelease --input $testClip --frames 300 --mode software --run-id $runId --log-file $swLog --json-file $swJson
Add-GateCheck "probe:run-software" ($LASTEXITCODE -eq 0) ("exitCode={0}" -f $LASTEXITCODE)
Add-GateCheck "probe:json-software" (Test-Path -LiteralPath $swJson -PathType Leaf) "present"
Test-GateEnd

$sw = $null
try { $sw = Get-Content -Raw -Encoding UTF8 -LiteralPath $swJson | ConvertFrom-Json }
catch {
    Add-GateCheck "probe:json-parse" $false $_.Exception.Message
    Test-GateEnd
}
Add-GateCheck "json:run-id" ([string]$sw.runId -eq $runId) ("actual={0}" -f $sw.runId)
Add-GateCheck "json:frames-decoded" (([int64]$sw.decode.framesDecoded) -ge 300) ("frames={0}" -f $sw.decode.framesDecoded)
Add-GateCheck "json:pts-monotonic" ([int64]$sw.decode.ptsNonMonotonicCount -eq 0) ("violations={0}" -f $sw.decode.ptsNonMonotonicCount)
Add-GateCheck "json:no-pixel-readback" ([int64]$sw.pipeline.gpuReadbackCount -eq 0) ("readbacks={0}" -f $sw.pipeline.gpuReadbackCount)
Add-GateCheck "json:bounded-queues" (([int64]$sw.pipeline.maxDecodeQueueDepth -le 4) -and ([int64]$sw.pipeline.maxProcessQueueDepth -le 4)) ("decodeMax={0} processMax={1}" -f $sw.pipeline.maxDecodeQueueDepth, $sw.pipeline.maxProcessQueueDepth)
Test-GateEnd

# ---------------------------------------------------------------------------
# 6. D3D12VA run (shared device identity; Playbook 3B)
# ---------------------------------------------------------------------------
$hwLog = Join-Path $logDir "d3d12va.log"
$hwJson = Join-Path $logDir "d3d12va.json"
& $probeRelease --input $testClip --frames 300 --mode d3d12va --run-id $runId --log-file $hwLog --json-file $hwJson
Add-GateCheck "probe:run-d3d12va" ($LASTEXITCODE -eq 0) ("exitCode={0}" -f $LASTEXITCODE)
Test-GateEnd

$hw = Get-Content -Raw -Encoding UTF8 -LiteralPath $hwJson | ConvertFrom-Json
Add-GateCheck "json:hw-shared-device" ([bool]$hw.hwaccel.sharedVeyraDevice -eq $true) ("shared={0} pixFmt={1}" -f $hw.hwaccel.sharedVeyraDevice, $hw.hwaccel.pixelFormat)
Add-GateCheck "json:hw-pixfmt-d3d12" ([string]$hw.hwaccel.pixelFormat -eq "AV_PIX_FMT_D3D12") ("actual={0}" -f $hw.hwaccel.pixelFormat)
Add-GateCheck "json:hw-no-readback" ([int64]$hw.pipeline.gpuReadbackCount -eq 0) ("readbacks={0}" -f $hw.pipeline.gpuReadbackCount)
$nrCount = [int64]$hw.pipeline.nrEvaluateCount
Add-GateCheck "json:nr-per-frame" ($nrCount -ge 300) ("nrEvaluateCount={0}" -f $nrCount)
Test-GateEnd

# ---------------------------------------------------------------------------
# 7. Seek storm (10 seeks; no stale history)
# ---------------------------------------------------------------------------
$seekLog = Join-Path $logDir "seek-storm.log"
$seekJson = Join-Path $logDir "seek-storm.json"
& $probeRelease --input $testClip --mode seek-storm --seeks 10 --run-id $runId --log-file $seekLog --json-file $seekJson
Add-GateCheck "probe:run-seek-storm" ($LASTEXITCODE -eq 0) ("exitCode={0}" -f $LASTEXITCODE)
Test-GateEnd

$seek = Get-Content -Raw -Encoding UTF8 -LiteralPath $seekJson | ConvertFrom-Json
Add-GateCheck "json:seek-count" ([int64]$seek.seek.seeksExecuted -eq 10) ("executed={0}" -f $seek.seek.seeksExecuted)
Add-GateCheck "json:seek-resets" ([int64]$seek.seek.historyResets -ge 10) ("resets={0}" -f $seek.seek.historyResets)
Add-GateCheck "json:seek-no-stale" ([bool]$seek.seek.staleHistoryDetected -eq $false) ("stale={0}" -f $seek.seek.staleHistoryDetected)
Test-GateEnd

# ---------------------------------------------------------------------------
# 8. Debug-run observability (info queue captured, zero errors)
# ---------------------------------------------------------------------------
$dbgLog = Join-Path $logDir "debug-run.log"
$dbgJson = Join-Path $logDir "debug-run.json"
& $probeDebug --input $testClip --frames 60 --mode software --run-id $runId --log-file $dbgLog --json-file $dbgJson
Add-GateCheck "probe:run-debug" ($LASTEXITCODE -eq 0) ("exitCode={0}" -f $LASTEXITCODE)
Test-GateEnd
$dbg = Get-Content -Raw -Encoding UTF8 -LiteralPath $dbgJson | ConvertFrom-Json
Add-GateCheck "json:debug-infoqueue-active" ([bool]$dbg.debugInfoQueue.active -eq $true) ("active={0}" -f $dbg.debugInfoQueue.active)
Add-GateCheck "json:debug-no-errors" ([uint64]$dbg.debugInfoQueue.errorMessages -eq 0) ("errors={0}" -f $dbg.debugInfoQueue.errorMessages)
Test-GateEnd

# ---------------------------------------------------------------------------
# 9. Proprietary paths remain ignored (external deps dir is outside the repo)
# ---------------------------------------------------------------------------
$ignoreTargets = @(
    "nvngx_dlssnr.dll",
    "renodx-dlss5-1.addon64",
    "runtime_local/.veyra-ignore-probe",
    "third_party_local/.veyra-ignore-probe",
    "captures/.veyra-ignore-probe",
    "logs/.veyra-ignore-probe"
)
foreach ($target in $ignoreTargets) {
    & git -C $Root check-ignore -q --no-index -- $target
    Add-GateCheck ("git-ignore:{0}" -f $target) ($LASTEXITCODE -eq 0) ("exitCode={0}" -f $LASTEXITCODE)
}
$trackedSensitive = @(& git -C $Root ls-files -- "nvngx_dlssnr.dll" "renodx-dlss5-1.addon64" "runtime_local" "third_party_local" "reference_local" "captures" "logs" "vcpkg_installed")
Add-GateCheck "git-sensitive-untracked" ($trackedSensitive.Count -eq 0) $(if ($trackedSensitive.Count -eq 0) { "none tracked" } else { $trackedSensitive -join ", " })

# ---------------------------------------------------------------------------
# Result
# ---------------------------------------------------------------------------
$elapsed = ((Get-Date) - $gateStart).TotalSeconds
Write-Host ("Phase 3 gate run-id {0} finished in {1:N1} s; logs: {2}" -f $runId, $elapsed, $logDir)
Test-GateEnd
Write-Host ("VEYRA PHASE 3 GATE PASSED: {0} checks (run-id {1})." -f $checkCount, $runId)
exit 0