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++
phase-1 work: P1.1 fail-closed phase1 gate + nr-default profile + SDK staged, negative run exit 1
Veyra Goal Agent09ffaed76e4b
diff --git a/config/nr-default.json b/config/nr-default.jsonnew file mode 100644index 00000000..49fa636f--- /dev/null+++ b/config/nr-default.json@@ -0,0 +1,13 @@+{+ "schema": 1,+ "nr": {+ "preset": 0,+ "style": 0,+ "intensity": 1.0,+ "localToneStrength": 1.0,+ "localStructureStrength": 1.0,+ "skinStructureStrength": -1.0,+ "useAutoMask": false,+ "uiCorrection": false+ }+}diff --git a/loop/BACKLOG.md b/loop/BACKLOG.mdindex 5b62c02b..b1930cc5 100644--- a/loop/BACKLOG.md+++ b/loop/BACKLOG.md@@ -19,7 +19,7 @@ Phase 0 gate:以 Playbook 第 16 节 Phase 0 为准。未完成 P0.9 禁止开## Phase 1 — Feature 18 native harness(锁定)- [x] P1.0a(Reviewer P2 加固项,不降低任何门槛): 在接入 Evaluate 循环前把 ID3D12Fence 时间线计数器收敛为单一 owner(ring 从 device context 派生 fence 值或明确所有权注释),避免 Phase 1 起重复/非单调 fence 值。(2026-09-02:移除 context 冗余计数器,ring 为唯一 signaler,双 preset+device-info 回归通过。)-- [ ] P1.1 先建立 phase1 gate 和确定性 RGBA8 测试帧/输出统计。+- [x] P1.1 先建立 phase1 gate 和确定性 RGBA8 测试帧/输出统计。(2026-09-02:phase1.ps1 fail-closed 建立并负向验证 exit 1;JSON 契约含输出统计/变体 hash/防陈旧字段;nr-default.json 就位;NGX SDK 310.7 已 staging。)- [ ] P1.2 封装 NGX Core、parameter block、DLSSNR runtime 和严格逆序 RAII。- [ ] P1.3 实现受隔离、可关闭的 caller-name 兼容层;禁止 patch DLL。- [ ] P1.4 严格按 Playbook 参数名与类型 Create Feature 18。diff --git a/loop/JOURNAL.md b/loop/JOURNAL.mdindex 4147647f..0ad81299 100644--- a/loop/JOURNAL.md+++ b/loop/JOURNAL.md@@ -304,6 +304,31 @@ Result:---+## Cycle 011 — P1.1 phase1 gate 与测试帧契约++### Before++- Phase: 1+- 唯一任务: 创建 fail-closed 的 scripts/gates/phase1.ps1,编码 Playbook §16 Phase 1 全部门槛(Init_Ext/Create 成功、300/300 Evaluate、输出非黑非恒定无 NaN、两组 Style/Intensity 变体 hash 不同、GPU timestamp 非 0、Release/Shutdown 干净、Debug run 需 debug layer 开启且无 state error、capture 存在、runId/exeSha256 防陈旧、git ignore),并写 config/nr-default.json;验证当前无 harness 时 exit 1。+- 可证伪假设: 若 gate 在 tools/nr_harness/shaders 不存在时 exit 0,则为假 gate;预期现在 exit 1。+- 预计修改文件: scripts/gates/phase1.ps1、config/nr-default.json、loop/{JOURNAL,STATE,BACKLOG}。+- 快速检查命令: `loop-gate.ps1 -Gate phase1` → 预期 exit 1(缺失 harness 输入)。+- 预期新增证据: gate 存在、AST-clean、负向 exit 1、harness JSON 契约定稿。+- 附注: NGX SDK 310.7 已从官方 GitHub clone 并按 Playbook 契约整理到 third_party_local/nvidia/DLSS_SDK_310.7.0/(include 16 头、x64/nvsdk_ngx_s.lib=36EAB292…、rel/nvngx_dlss.dll=BE6E434A…、nvngx_dlssg.dll=135EAF07…);全部 ignored。++### After++- 实际修改: 新增 scripts/gates/phase1.ps1(约 240 行,编码 §16 Phase 1 全部门槛)与 config/nr-default.json(Playbook 9.4 nr 段固定默认值)。+- 实际命令与 exit code: AST → AST-CLEAN;`loop-gate.ps1 -Gate phase1` → exit 1(input:GenerateTestPattern.hlsl、tools/nr_harness/main.cpp、src/ngx/NgxCoreHost.cpp、src/ngx/DlssNrRuntimeAdapter.cpp 四项缺失)。+- 新证据/日志路径: harness JSON 契约定稿(gate 内解析字段:probe/runId/exeSha256/initExt/createFeature/evaluate{attempted,succeeded,failed}/output{meanLuma,minLuma,maxLuma,sha256,nanCount,allZero,constant}/variants[].sha256(≥2 个互异且异于 baseline)/gpu.timestampNonZero/release/deviceRemoved/debugLayer;capture frame0000_proxy.png+frame0000_raw.png)。+- 失败 fingerprint: 预期 fail-closed,非缺陷。+- 是否有进展,依据: 是——Phase 1 验收从文字变为机器检查并证明当前无法通过。+- 附加: NGX SDK 310.7 整理完成(见 Before 附注)。+- STATE/BACKLOG 更新: cycle.completed=11;BACKLOG P1.1 → DONE。+- 下一唯一动作: P1.2 实现 veyra_ngx:NgxCoreHost(Init with ProjectID/参数块生命周期)、NgxParameters 强类型封装、DlssNrParameters 常量、DlssNrRuntimeAdapter(Feature 18 常量/受限加载/exports/caller-name 兼容层骨架)与严格逆序 RAII。++---+复制下面模板开始每个新 cycle。必须先填 Before,再改代码;完成后填 After。## Cycle NNN — 简短任务名diff --git a/loop/STATE.json b/loop/STATE.jsonindex 909bda33..7a489b75 100644--- a/loop/STATE.json+++ b/loop/STATE.json@@ -76,14 +76,14 @@}],"cycle": {- "completed": 10,+ "completed": 11,"maximum": 80,"sameFailureAttempts": 0,"maximumSameFailureAttempts": 3,"noProgressCycles": 0,"maximumNoProgressCycles": 5},- "currentTask": "P1.1: create fail-closed scripts/gates/phase1.ps1 encoding the Phase 1 thresholds (Create success, 300/300 evaluates, non-black/non-constant output, parameter-hash variation, release/shutdown stability) plus the deterministic RGBA8 test-frame contract; NGX SDK 310.7 downloading in background.",+ "currentTask": "P1.2: implement veyra_ngx (NgxCoreHost single-init lifecycle, typed parameter wrapper, DlssNrParameters constants, DlssNrRuntimeAdapter with Feature 18 constants + restricted load + exports + caller-name compatibility layer skeleton) with strict reverse-order RAII.","lastGate": {"name": "phase0","status": "passed",diff --git a/scripts/gates/phase1.ps1 b/scripts/gates/phase1.ps1new file mode 100644index 00000000..04672b5e--- /dev/null+++ b/scripts/gates/phase1.ps1@@ -0,0 +1,254 @@+[CmdletBinding()]+param([Parameter(Mandatory = $true)][string]$Root)++# Veyra Phase 1 gate: Feature 18 native harness (Playbook section 16 Phase 1).+# Encodes every completion threshold:+# - Debug and Release build through the tracked wrapper;+# - staged DLSSNR runtime identity (shared constants with phase0);+# - NGX SDK 310.7 files present (headers + nvsdk_ngx_s.lib + rel runtime);+# - Release run (300 frames): Init_Ext success, Feature 18 handle non-null,+# 300/300 Evaluate success, output non-black/non-constant/NaN-free,+# at least two Style/Intensity variants with distinct output hashes,+# GPU timestamps non-zero, clean Release/Shutdown, no device removal,+# proxy+raw captures exist;+# - Debug run (10 frames): D3D12 debug layer actually enabled and its log+# free of resource-state/descriptor-lifetime errors;+# - every JSON carries runId + exeSha256 so stale artifacts fail;+# - proprietary paths remain ignored.+# Fail-closed: any 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 1 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 1 gate run-id: {0}" -f $runId)+Write-Host ("Root: {0}" -f $Root)++$expectedDllSize = [long]165840496+$expectedDllSha256 = "E16BCF15E16E13F527491CDF7845B2FE6521A738D8F7C9C721866A8496E1FC8E"++# ---------------------------------------------------------------------------+# 1. Required project inputs+# ---------------------------------------------------------------------------+$requiredInputs = @(+ "CMakeLists.txt",+ "scripts\build.ps1",+ "shaders\GenerateTestPattern.hlsl",+ "tools\nr_harness\main.cpp",+ "src\ngx\NgxCoreHost.cpp",+ "src\ngx\DlssNrRuntimeAdapter.cpp",+ "config\nr-default.json"+)+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. NGX SDK 310.7 staged under the ignored local tree+# ---------------------------------------------------------------------------+$sdkRoot = Join-Path $Root "third_party_local\nvidia\DLSS_SDK_310.7.0"+$sdkFiles = @(+ "include\nvsdk_ngx.h",+ "include\nvsdk_ngx_defs.h",+ "include\nvsdk_ngx_helpers.h",+ "include\nvsdk_ngx_helpers_dlssg.h",+ "include\nvsdk_ngx_params.h",+ "include\nvsdk_ngx_params_dlssg.h",+ "lib\Windows_x86_64\x64\nvsdk_ngx_s.lib",+ "lib\Windows_x86_64\rel\nvngx_dlss.dll",+ "lib\Windows_x86_64\rel\nvngx_dlssg.dll"+)+foreach ($relative in $sdkFiles) {+ $path = Join-Path $sdkRoot $relative+ Add-GateCheck ("sdk:{0}" -f $relative) (Test-Path -LiteralPath $path -PathType Leaf) "present"+}+Test-GateEnd++# ---------------------------------------------------------------------------+# 3. Staged DLSSNR runtime identity (same pinned contract as phase0)+# ---------------------------------------------------------------------------+$runtimeDir = Join-Path $Root "runtime_local\nvidia"+$stagedDll = Join-Path $runtimeDir "nvngx_dlssnr.dll"+$dllStaged = Test-Path -LiteralPath $stagedDll -PathType Leaf+Add-GateCheck "runtime:staged-dll" $dllStaged ("path={0}" -f $stagedDll)+if ($dllStaged) {+ $item = Get-Item -LiteralPath $stagedDll+ Add-GateCheck "runtime:size" ($item.Length -eq $expectedDllSize) ("actual={0}" -f $item.Length)+ $dllHash = (Get-FileHash -LiteralPath $stagedDll -Algorithm SHA256).Hash.ToUpperInvariant()+ Add-GateCheck "runtime:sha256" ($dllHash -eq $expectedDllSha256) ("actual={0}" -f $dllHash)+ $sig = Get-AuthenticodeSignature -LiteralPath $stagedDll+ Add-GateCheck "runtime:signature" ([string]$sig.Status -eq "Valid") ("actual={0}" -f [string]$sig.Status)+}+Test-GateEnd++# ---------------------------------------------------------------------------+# 4. 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+$debugBuildExit = $LASTEXITCODE+Add-GateCheck "build:x64-debug" ($debugBuildExit -eq 0) ("exitCode={0}" -f $debugBuildExit)++& $shell -NoProfile -ExecutionPolicy Bypass -File $buildScript -Root $Root -Preset x64-release+$releaseBuildExit = $LASTEXITCODE+Add-GateCheck "build:x64-release" ($releaseBuildExit -eq 0) ("exitCode={0}" -f $releaseBuildExit)+Test-GateEnd++# ---------------------------------------------------------------------------+# 5. Harness executables + run-id + exe hashes+# ---------------------------------------------------------------------------+$harnessDebugExe = Join-Path $Root "out\build\x64-debug\veyra_nr_harness.exe"+$harnessReleaseExe = Join-Path $Root "out\build\x64-release\veyra_nr_harness.exe"+Add-GateCheck "harness:exe-debug" (Test-Path -LiteralPath $harnessDebugExe -PathType Leaf) ("path={0}" -f $harnessDebugExe)+Add-GateCheck "harness:exe-release" (Test-Path -LiteralPath $harnessReleaseExe -PathType Leaf) ("path={0}" -f $harnessReleaseExe)+Test-GateEnd++$debugExeHash = (Get-FileHash -LiteralPath $harnessDebugExe -Algorithm SHA256).Hash.ToUpperInvariant()+$releaseExeHash = (Get-FileHash -LiteralPath $harnessReleaseExe -Algorithm SHA256).Hash.ToUpperInvariant()+Write-Host ("harness exe sha256 (debug) : {0}" -f $debugExeHash)+Write-Host ("harness exe sha256 (release): {0}" -f $releaseExeHash)++$logDir = Join-Path $Root ("logs\phase1\" + $runId)+New-Item -ItemType Directory -Force -Path $logDir | Out-Null+$captureDir = Join-Path $Root ("captures\phase1\" + $runId)+New-Item -ItemType Directory -Force -Path $captureDir | Out-Null+$profilePath = Join-Path $Root "config\nr-default.json"++# ---------------------------------------------------------------------------+# 6. Release run: 300 frames with parameter variants+# ---------------------------------------------------------------------------+$releaseLog = Join-Path $logDir "harness-release.log"+$releaseJson = Join-Path $logDir "harness-release.json"+& $harnessReleaseExe --runtime-dir $runtimeDir --width 1920 --height 1080 --frames 300 --guidance zero --profile $profilePath --capture-frame 0 --capture-dir $captureDir --run-id $runId --log-file $releaseLog --json-file $releaseJson+$releaseExit = $LASTEXITCODE+Add-GateCheck "harness:run-release" ($releaseExit -eq 0) ("exitCode={0}" -f $releaseExit)+Add-GateCheck "harness:json-release-exists" (Test-Path -LiteralPath $releaseJson -PathType Leaf) ("path={0}" -f $releaseJson)+Test-GateEnd++$summary = $null+try {+ $summary = Get-Content -Raw -Encoding UTF8 -LiteralPath $releaseJson | ConvertFrom-Json+}+catch {+ Add-GateCheck "harness:json-parse" $false $_.Exception.Message+ Test-GateEnd+}++Add-GateCheck "json:probe-name" ([string]$summary.probe -eq "veyra_nr_harness") ("actual={0}" -f $summary.probe)+Add-GateCheck "json:run-id" ([string]$summary.runId -eq $runId) ("actual={0}" -f $summary.runId)+Add-GateCheck "json:exe-sha256" ([string]$summary.exeSha256 -ceq $releaseExeHash) ("actual={0}" -f $summary.exeSha256)+Add-GateCheck "json:init-ext-success" ([bool]$summary.initExt.success -eq $true) ("result=0x{0:X}" -f [uint64]$summary.initExt.result)+Add-GateCheck "json:create-feature-success" (([bool]$summary.createFeature.success) -and ([bool]$summary.createFeature.handleNonNull)) ("result=0x{0:X} handleNonNull={1}" -f [uint64]$summary.createFeature.result, $summary.createFeature.handleNonNull)++$attempted = [int]$summary.evaluate.attempted+$succeeded = [int]$summary.evaluate.succeeded+$failed = [int]$summary.evaluate.failed+Add-GateCheck "json:evaluate-300-of-300" (($attempted -eq 300) -and ($succeeded -eq 300) -and ($failed -eq 0)) ("attempted={0} succeeded={1} failed={2}" -f $attempted, $succeeded, $failed)++$nanCount = [int64]$summary.output.nanCount+$allZero = [bool]$summary.output.allZero+$constant = [bool]$summary.output.constant+$meanLuma = [double]$summary.output.meanLuma+$minLuma = [double]$summary.output.minLuma+$maxLuma = [double]$summary.output.maxLuma+$outputOk = ($nanCount -eq 0) -and (-not $allZero) -and (-not $constant) -and ($meanLuma -gt 0.0005) -and (($maxLuma - $minLuma) -gt 0.01)+Add-GateCheck "json:output-not-black-not-constant-no-nan" $outputOk ("nan={0} allZero={1} constant={2} meanLuma={3:N5} minLuma={4:N5} maxLuma={5:N5}" -f $nanCount, $allZero, $constant, $meanLuma, $minLuma, $maxLuma)++$variantHashes = @($summary.variants | ForEach-Object { [string]$_.sha256 })+$baselineHash = [string]$summary.output.sha256+$distinctVariantHashes = @($variantHashes | Sort-Object -Unique)+$variantsDiffer = ($variantHashes.Count -ge 2) -and ($distinctVariantHashes.Count -eq $variantHashes.Count) -and+ ($variantHashes -notcontains $baselineHash)+Add-GateCheck "json:variant-hashes-distinct" $variantsDiffer ("baseline={0} variants={1}" -f $baselineHash, ($variantHashes -join ","))++Add-GateCheck "json:gpu-timestamps-nonzero" ([bool]$summary.gpu.timestampNonZero -eq $true) ("avgMs={0}" -f $summary.gpu.avgMs)+Add-GateCheck "json:release-shutdown-clean" (([bool]$summary.release.featureReleased) -and ([bool]$summary.release.cleanExit)) ("shutdownResult=0x{0:X}" -f [uint64]$summary.release.shutdownResult)+Add-GateCheck "json:no-device-removal" ([bool]$summary.deviceRemoved -eq $false) ("reason=0x{0:X}" -f [uint64]$summary.deviceRemovedReason)++$proxyCapture = Join-Path $captureDir "frame0000_proxy.png"+$rawCapture = Join-Path $captureDir "frame0000_raw.png"+Add-GateCheck "capture:proxy-png" (Test-Path -LiteralPath $proxyCapture -PathType Leaf) ("path={0}" -f $proxyCapture)+Add-GateCheck "capture:raw-png" (Test-Path -LiteralPath $rawCapture -PathType Leaf) ("path={0}" -f $rawCapture)+if ((Test-Path -LiteralPath $proxyCapture -PathType Leaf) -and (Test-Path -LiteralPath $rawCapture -PathType Leaf)) {+ $proxyLen = (Get-Item -LiteralPath $proxyCapture).Length+ $rawLen = (Get-Item -LiteralPath $rawCapture).Length+ Add-GateCheck "capture:nonempty" (($proxyLen -gt 1000) -and ($rawLen -gt 1000)) ("proxy={0}B raw={1}B" -f $proxyLen, $rawLen)+}+Test-GateEnd++# ---------------------------------------------------------------------------+# 7. Debug run: 10 frames; debug layer must be active and error-free+# ---------------------------------------------------------------------------+$debugLog = Join-Path $logDir "harness-debug.log"+$debugJson = Join-Path $logDir "harness-debug.json"+$debugCaptureDir = Join-Path $captureDir "debug"+New-Item -ItemType Directory -Force -Path $debugCaptureDir | Out-Null+& $harnessDebugExe --runtime-dir $runtimeDir --width 1920 --height 1080 --frames 10 --guidance zero --profile $profilePath --capture-frame 0 --capture-dir $debugCaptureDir --run-id $runId --log-file $debugLog --json-file $debugJson+$debugExit = $LASTEXITCODE+Add-GateCheck "harness:run-debug" ($debugExit -eq 0) ("exitCode={0}" -f $debugExit)+Add-GateCheck "harness:json-debug-exists" (Test-Path -LiteralPath $debugJson -PathType Leaf) ("path={0}" -f $debugJson)+Test-GateEnd++$debugSummary = Get-Content -Raw -Encoding UTF8 -LiteralPath $debugJson | ConvertFrom-Json+Add-GateCheck "json-debug:run-id" ([string]$debugSummary.runId -eq $runId) ("actual={0}" -f $debugSummary.runId)+Add-GateCheck "json-debug:exe-sha256" ([string]$debugSummary.exeSha256 -ceq $debugExeHash) ("actual={0}" -f $debugSummary.exeSha256)+Add-GateCheck "json-debug:evaluate-10-of-10" (([int]$debugSummary.evaluate.succeeded -eq 10) -and ([int]$debugSummary.evaluate.failed -eq 0)) ("succeeded={0}" -f $debugSummary.evaluate.succeeded)+Add-GateCheck "json-debug:debug-layer-enabled" ([bool]$debugSummary.debugLayer -eq $true) ("debugLayer={0} (install Windows 'Graphics Tools' if false; see loop/INBOX.md)" -f $debugSummary.debugLayer)++$stateErrorLines = @(Get-Content -LiteralPath $debugLog -ErrorAction SilentlyContinue | Select-String -Pattern "D3D12 ERROR|STATE ERROR|descriptor heap|ID3D12Resource state|resource state" )+Add-GateCheck "json-debug:no-state-errors" ($stateErrorLines.Count -eq 0) ("matching lines={0}" -f $stateErrorLines.Count)++# ---------------------------------------------------------------------------+# 8. Proprietary paths remain ignored+# ---------------------------------------------------------------------------+$ignoreTargets = @(+ "nvngx_dlssnr.dll",+ "renodx-dlss5-1.addon64",+ "runtime_local/.veyra-ignore-probe",+ "third_party_local/.veyra-ignore-probe",+ "reference_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) ("git check-ignore 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")+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 1 gate run-id {0} finished in {1:N1} s; logs: {2}" -f $runId, $elapsed, $logDir)+Test-GateEnd+Write-Host ("VEYRA PHASE 1 GATE PASSED: {0} checks (run-id {1})." -f $checkCount, $runId)+exit 0