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++

phase-0 work: P0.4 minimal CMake/C++20 skeleton, both presets build, runtime staged

Veyra Goal Agenta6ceb2dd6ea4
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 00000000..3ca91019
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,33 @@
+cmake_minimum_required(VERSION 3.24)
+
+project(veyra VERSION 0.1.0 LANGUAGES CXX)
+
+# ---------------------------------------------------------------------------
+# Veyra cache variables and feature switches (Playbook section 5.1).
+# Machine-specific absolute paths are resolved by scripts/build.ps1 at
+# configure time; CMakePresets.json stays free of local paths.
+# ---------------------------------------------------------------------------
+set(VEYRA_DLSS_SDK_ROOT "" CACHE PATH "NVIDIA DLSS SDK root")
+set(VEYRA_NVOF_SDK_ROOT "" CACHE PATH "NVIDIA Optical Flow SDK root")
+set(VEYRA_RUNTIME_ROOT "" CACHE PATH "Local NVIDIA runtime root")
+
+option(VEYRA_ENABLE_EXPERIMENTAL_DLSSNR
+ "Enable local-only experimental Feature 18 adapter" OFF)
+option(VEYRA_ENABLE_DLSS_SR "Enable public DLSS SR backend" OFF)
+option(VEYRA_ENABLE_DLSS_FG "Enable public DLSSG backend" OFF)
+option(VEYRA_ENABLE_NVOF "Enable NVIDIA Optical Flow guidance" OFF)
+option(VEYRA_ENABLE_D3D12_DEBUG "Enable D3D12 debug layer" ON)
+
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
+include(VeyraWarnings)
+
+# ---------------------------------------------------------------------------
+# Targets grow phase by phase; only what actually compiles is declared.
+# ---------------------------------------------------------------------------
+add_executable(veyra_runtime_probe
+ tools/runtime_probe/main.cpp
+)
+veyra_apply_warnings(veyra_runtime_probe)
+target_compile_features(veyra_runtime_probe PRIVATE cxx_std_20)
+target_compile_definitions(veyra_runtime_probe PRIVATE
+ UNICODE _UNICODE WIN32_LEAN_AND_MEAN NOMINMAX)
diff --git a/CMakePresets.json b/CMakePresets.json
new file mode 100644
index 00000000..a00aeebd
--- /dev/null
+++ b/CMakePresets.json
@@ -0,0 +1,42 @@
+{
+ "version": 3,
+ "cmakeMinimumRequired": {
+ "major": 3,
+ "minor": 24,
+ "patch": 0
+ },
+ "configurePresets": [
+ {
+ "name": "x64-debug",
+ "displayName": "Veyra x64 Debug (Ninja)",
+ "generator": "Ninja",
+ "binaryDir": "${sourceDir}/out/build/x64-debug",
+ "cacheVariables": {
+ "CMAKE_BUILD_TYPE": "Debug",
+ "CMAKE_EXPORT_COMPILE_COMMANDS": true,
+ "VEYRA_ENABLE_D3D12_DEBUG": true
+ }
+ },
+ {
+ "name": "x64-release",
+ "displayName": "Veyra x64 Release (Ninja)",
+ "generator": "Ninja",
+ "binaryDir": "${sourceDir}/out/build/x64-release",
+ "cacheVariables": {
+ "CMAKE_BUILD_TYPE": "Release",
+ "CMAKE_EXPORT_COMPILE_COMMANDS": false,
+ "VEYRA_ENABLE_D3D12_DEBUG": false
+ }
+ }
+ ],
+ "buildPresets": [
+ {
+ "name": "x64-debug",
+ "configurePreset": "x64-debug"
+ },
+ {
+ "name": "x64-release",
+ "configurePreset": "x64-release"
+ }
+ ]
+}
diff --git a/cmake/VeyraWarnings.cmake b/cmake/VeyraWarnings.cmake
new file mode 100644
index 00000000..6bb2954e
--- /dev/null
+++ b/cmake/VeyraWarnings.cmake
@@ -0,0 +1,11 @@
+# Strict warning policy for Veyra-owned targets only (Playbook section 5.3).
+# Third-party headers are never compiled through this function.
+
+function(veyra_apply_warnings target)
+ if(MSVC)
+ target_compile_options(${target} PRIVATE
+ /W4 /permissive- /Zc:__cplusplus /Zc:preprocessor /WX)
+ else()
+ message(FATAL_ERROR "Veyra V1 only supports MSVC on Windows x64")
+ endif()
+endfunction()
diff --git a/loop/BACKLOG.md b/loop/BACKLOG.md
index 828f3a93..b2b8d9f9 100644
--- a/loop/BACKLOG.md
+++ b/loop/BACKLOG.md
@@ -7,7 +7,7 @@
- [x] P0.1 运行 preflight,核对真实工作区、二进制身份、工具链和 GPU/driver;把结果写入 JOURNAL/STATE。(2026-09-02 Goal Cycle 001:preflight 54/54 exit 0;RTX 5070/616.56/12227 MiB/compute 12.0;nvofapi64 32.0.16.1656;MSVC 14.44.35207;CMake 3.31.6;Ninja 1.12.1;DXC 1.8;Git 2.53。证据:loop/JOURNAL.md Cycle 001。)
- [x] P0.2 确认 .gitignore 后按 LOOP_ENGINE 固定顺序初始化本地 Git;显式 staged allowlist、建立 baseline commit、切到 agent/veyra-v1-loop、写 baselineCommit 状态指针;验证两个二进制、runtime_local、third_party_local、reference_local、captures、logs 均未被跟踪。(2026-09-02:baseline=2086282,loop 指针提交=09abf5d,8/8 ignore 探针通过,17 文件 allowlist,Git 后 preflight 66/66。)
- [x] P0.3 先创建 fail-closed 的 scripts/gates/phase0.ps1,编码 Playbook 的 Phase 0 门槛;此时因为工程/输出不存在必须失败。(2026-09-02:gate 建立并 AST-clean;负向运行 exit 1,5 项缺失输入全报;无项目变异。)
-- [ ] P0.4 建立最小 CMake/C++20 Win32 x64 工程与 Debug/Release presets,不引入 FFmpeg/UI。
+- [x] P0.4 建立最小 CMake/C++20 Win32 x64 工程与 Debug/Release presets,不引入 FFmpeg/UI。(2026-09-02:Ninja presets 双配置构建 exit 0,stub 运行 exit 0,build.ps1 解析 vswhere/vcvars,presets 无机器路径。)
- [ ] P0.5 实现结构化 logger、HRESULT/NGX result 字符串、文件 size/hash/signature 检查。
- [ ] P0.6 实现 D3D12DeviceContext:RTX adapter、device、direct queue、debug layer、4-slot command allocator/list/fence/event ring。
- [ ] P0.7 实现 veyra_runtime_probe:受限绝对路径加载本地复制的 nvngx_dlssnr.dll,验证 required exports;不得加载 addon。
diff --git a/loop/JOURNAL.md b/loop/JOURNAL.md
index b20075da..fddc4511 100644
--- a/loop/JOURNAL.md
+++ b/loop/JOURNAL.md
@@ -114,6 +114,34 @@ Result:
---
+## Cycle 004 — P0.4 最小 CMake/C++20 工程
+
+### Before
+
+- Phase: 0
+- 唯一任务: 建立最小 CMake/C++20 Win32 x64 工程与 Debug/Release presets(Ninja 生成器、out/build 二进制目录),scripts/build.ps1(vswhere/vcvars 解析机器路径,避免提交绝对路径)与 scripts/stage-runtime.ps1(复制 DLL + 写 manifest + 持久 ngx-local.json);probe 以最小 stub main 验证可构建可运行。
+- 可证伪假设: 若 presets 含机器绝对路径、或 Debug/Release 任一配置失败、或 build.ps1 在普通 shell(无 VS env)不可用,则工程骨架不合规。
+- 预计修改文件: CMakeLists.txt、CMakePresets.json、cmake/VeyraWarnings.cmake、scripts/build.ps1、scripts/stage-runtime.ps1、tools/runtime_probe/main.cpp。
+- 快速检查命令: `powershell -File scripts/build.ps1 -Preset x64-debug` 与 `-Preset x64-release` 均 exit 0;`out/build/x64-*/veyra_runtime_probe.exe` 可运行;`scripts/stage-runtime.ps1` 后 runtime_local/nvidia DLL+manifest 就位。
+- 预期新增证据: 两 preset 构建成功 + stub 运行 exit 0 + staged runtime 与 manifest。
+
+### After
+
+- 实际修改: 新增 CMakeLists.txt(C++20、MSVC-only 校验、按阶段增长的 target)、CMakePresets.json(Ninja、binaryDir=out/build/x64-*、debug 层 debug=ON/release=OFF、无机器路径)、cmake/VeyraWarnings.cmake(/W4 /permissive- /Zc:__cplusplus /WX 仅本项目 target)、scripts/build.ps1(vswhere→vcvars64→cmake preset,批处理写在 ignored out/ 下)、scripts/stage-runtime.ps1(固定身份校验后复制 DLL、写 manifest、一次性持久 ngx-local.json GUID)、tools/runtime_probe/main.cpp(stub)。
+- 实际命令与 exit code:
+ - `scripts/stage-runtime.ps1` → exit 0:DLL 复制至 runtime_local/nvidia、runtime-manifest.json 写入、持久 ngx-local.json 创建。
+ - `scripts/build.ps1 -Preset x64-debug` → exit 0([2/2] 编译+链接 veyra_runtime_probe.exe)。
+ - `scripts/build.ps1 -Preset x64-release` → exit 0。
+ - `out/build/x64-debug/veyra_runtime_probe.exe --self-check` → exit 0(stub 输出 argc/argv)。
+- 新证据/日志路径: out/build/x64-{debug,release}/(ignored);runtime_local/nvidia/{nvngx_dlssnr.dll,runtime-manifest.json}(ignored)。
+- 失败 fingerprint: 无。
+- 本 fingerprint 第几次不同尝试: 不适用。
+- 是否有进展,依据: 是——工程从零变为 Debug/Release 双配置可构建可运行的最小骨架,且专有 runtime 已按 Playbook 4.3/4.4 staging。
+- STATE/BACKLOG 更新: cycle.completed=4、currentTask/nextAction 指向 P0.5;BACKLOG P0.4 → DONE。
+- 下一唯一动作: P0.5 实现 veyra_base:结构化 logger、HRESULT/NGX result 字符串、文件 size/hash/signature 检查,并用 probe --self-test 实测。
+
+---
+
复制下面模板开始每个新 cycle。必须先填 Before,再改代码;完成后填 After。
## Cycle NNN — 简短任务名
diff --git a/loop/STATE.json b/loop/STATE.json
index 9545237a..3916f914 100644
--- a/loop/STATE.json
+++ b/loop/STATE.json
@@ -76,14 +76,14 @@
}
],
"cycle": {
- "completed": 3,
+ "completed": 4,
"maximum": 80,
"sameFailureAttempts": 0,
"maximumSameFailureAttempts": 3,
"noProgressCycles": 0,
"maximumNoProgressCycles": 5
},
- "currentTask": "P0.4: create the minimal CMake/C++20 Win32 x64 project with Debug/Release presets (no FFmpeg, no UI): CMakeLists.txt, CMakePresets.json, scripts/build.ps1, scripts/stage-runtime.ps1, source skeleton.",
+ "currentTask": "P0.5: implement veyra_base (structured logger, HRESULT/NGX result strings, file size/hash/signature checks) and verify with a real probe self-test.",
"lastGate": {
"name": "phase0",
"status": "failed",
@@ -96,6 +96,6 @@
"lastGoodCommit": null,
"openP0P1Findings": [],
"blockers": [],
- "nextAction": "Implement P0.4 CMake skeleton (build.ps1/stage-runtime.ps1/presets/CMakeLists), then P0.5-P0.7 implementation, then P0.8 real runs.",
- "updatedAt": "2026-09-02T20:45:00+08:00"
+ "nextAction": "Implement P0.5 veyra_base, then P0.6 gfx, P0.7 probe, P0.8 gate runs.",
+ "updatedAt": "2026-09-02T21:00:00+08:00"
}
diff --git a/scripts/build.ps1 b/scripts/build.ps1
new file mode 100644
index 00000000..1e0519f7
--- /dev/null
+++ b/scripts/build.ps1
@@ -0,0 +1,77 @@
+[CmdletBinding()]
+param(
+ [Parameter(Mandatory = $true)][string]$Root,
+ [Parameter(Mandatory = $true)][ValidateSet("x64-debug", "x64-release")][string]$Preset,
+ [switch]$Clean
+)
+
+# Veyra build wrapper: resolves the MSVC environment on this machine and runs
+# the tracked CMake presets. Keeps machine-specific paths out of the presets.
+# Writes only under the gitignored out/ directory.
+
+Set-StrictMode -Version Latest
+$ErrorActionPreference = "Stop"
+
+if (-not (Test-Path -LiteralPath (Join-Path $Root "CMakePresets.json") -PathType Leaf)) {
+ Write-Host "build.ps1: CMakePresets.json not found under $Root"
+ exit 2
+}
+
+# --- Resolve Visual Studio installation (vswhere first, known path fallback)
+$vswhere = Join-Path ${env:ProgramFiles(x86)} "Microsoft Visual Studio\Installer\vswhere.exe"
+$vsRoot = ""
+if (Test-Path -LiteralPath $vswhere -PathType Leaf) {
+ $vsRoot = (& $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath) -join ""
+}
+if ([string]::IsNullOrWhiteSpace($vsRoot)) {
+ $fallback = "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools"
+ if (Test-Path -LiteralPath $fallback -PathType Container) { $vsRoot = $fallback }
+}
+if ([string]::IsNullOrWhiteSpace($vsRoot)) {
+ Write-Host "build.ps1: Visual Studio 2022 VC tools not found"
+ exit 3
+}
+
+$cmakeExe = Join-Path $vsRoot "Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe"
+if (-not (Test-Path -LiteralPath $cmakeExe -PathType Leaf)) {
+ $found = Get-Command cmake -ErrorAction SilentlyContinue
+ if ($null -ne $found) { $cmakeExe = $found.Source }
+}
+if ([string]::IsNullOrWhiteSpace($cmakeExe)) {
+ Write-Host "build.ps1: cmake not found"
+ exit 3
+}
+
+$vcvars = Join-Path $vsRoot "VC\Auxiliary\Build\vcvars64.bat"
+if (-not (Test-Path -LiteralPath $vcvars -PathType Leaf)) {
+ Write-Host "build.ps1: vcvars64.bat not found under $vsRoot"
+ exit 3
+}
+
+$buildDir = Join-Path $Root ("out\build\" + $Preset)
+if ($Clean -and (Test-Path -LiteralPath $buildDir -PathType Container)) {
+ Remove-Item -LiteralPath $buildDir -Recurse -Force
+}
+
+# --- Configure + build inside one vcvars environment, from a temp batch file
+$batchDir = Join-Path $Root "out\build"
+New-Item -ItemType Directory -Force -Path $batchDir | Out-Null
+$batchFile = Join-Path $batchDir ("veyra-build-" + $Preset + ".cmd")
+
+$batchLines = @(
+ '@echo off',
+ ('call "{0}" >nul 2>&1' -f $vcvars),
+ ('if errorlevel 1 exit /b 4' -f $null),
+ ('cd /d "{0}"' -f $Root),
+ ('"{0}" --preset {1}' -f $cmakeExe, $Preset),
+ 'if errorlevel 1 exit /b 5',
+ ('"{0}" --build --preset {1}' -f $cmakeExe, $Preset),
+ 'if errorlevel 1 exit /b 6',
+ 'exit /b 0'
+)
+Set-Content -LiteralPath $batchFile -Value $batchLines -Encoding ASCII
+
+& cmd.exe /c ('"{0}"' -f $batchFile)
+$exitCode = $LASTEXITCODE
+Write-Host ("build.ps1: preset {0} exitCode={1}" -f $Preset, $exitCode)
+exit $exitCode
diff --git a/scripts/stage-runtime.ps1 b/scripts/stage-runtime.ps1
new file mode 100644
index 00000000..52a770b4
--- /dev/null
+++ b/scripts/stage-runtime.ps1
@@ -0,0 +1,99 @@
+[CmdletBinding()]
+param(
+ [Parameter(Mandatory = $true)][string]$Root
+)
+
+# Stage the local NVIDIA DLSSNR runtime for Phase 0+ probes (Playbook 4.3/4.4).
+# - Copies (never moves) the workspace-root nvngx_dlssnr.dll into
+# runtime_local/nvidia/ after verifying its pinned identity.
+# - Writes runtime-manifest.json with the real size/hash and local-experimental
+# mode markers.
+# - Creates a persistent runtime_local/config/ngx-local.json identity exactly
+# once; reruns never regenerate the GUID.
+
+Set-StrictMode -Version Latest
+$ErrorActionPreference = "Stop"
+
+$expectedSize = [long]165840496
+$expectedSha256 = "E16BCF15E16E13F527491CDF7845B2FE6521A738D8F7C9C721866A8496E1FC8E"
+
+$sourceDll = Join-Path $Root "nvngx_dlssnr.dll"
+if (-not (Test-Path -LiteralPath $sourceDll -PathType Leaf)) {
+ Write-Host "stage-runtime.ps1: source DLL missing: $sourceDll"
+ exit 2
+}
+
+$item = Get-Item -LiteralPath $sourceDll
+if ($item.Length -ne $expectedSize) {
+ Write-Host ("stage-runtime.ps1: size mismatch actual={0} expected={1}" -f $item.Length, $expectedSize)
+ exit 3
+}
+$hash = (Get-FileHash -LiteralPath $sourceDll -Algorithm SHA256).Hash.ToUpperInvariant()
+if ($hash -ne $expectedSha256) {
+ Write-Host ("stage-runtime.ps1: sha256 mismatch actual={0}" -f $hash)
+ exit 3
+}
+$signature = Get-AuthenticodeSignature -LiteralPath $sourceDll
+if ([string]$signature.Status -ne "Valid") {
+ Write-Host ("stage-runtime.ps1: signature status {0}" -f [string]$signature.Status)
+ exit 3
+}
+
+$runtimeDir = Join-Path $Root "runtime_local\nvidia"
+New-Item -ItemType Directory -Force -Path $runtimeDir | Out-Null
+$targetDll = Join-Path $runtimeDir "nvngx_dlssnr.dll"
+
+if (-not (Test-Path -LiteralPath $targetDll -PathType Leaf)) {
+ Copy-Item -LiteralPath $sourceDll -Destination $targetDll
+ Write-Host "stage-runtime.ps1: copied nvngx_dlssnr.dll into runtime_local/nvidia"
+}
+else {
+ $stagedHash = (Get-FileHash -LiteralPath $targetDll -Algorithm SHA256).Hash.ToUpperInvariant()
+ if ($stagedHash -ne $expectedSha256) {
+ Write-Host "stage-runtime.ps1: staged DLL identity drifted; replacing from workspace root"
+ Copy-Item -LiteralPath $sourceDll -Destination $targetDll -Force
+ }
+ else {
+ Write-Host "stage-runtime.ps1: staged DLL already matches the pinned identity"
+ }
+}
+
+$manifestPath = Join-Path $runtimeDir "runtime-manifest.json"
+$manifestJson = @'
+{
+ "schema": 1,
+ "mode": "local-experimental-only",
+ "files": [
+ {
+ "name": "nvngx_dlssnr.dll",
+ "size": 165840496,
+ "sha256": "E16BCF15E16E13F527491CDF7845B2FE6521A738D8F7C9C721866A8496E1FC8E",
+ "fileVersion": "310.8.0.0",
+ "authenticode": "Valid",
+ "source": "user-provided workspace file",
+ "redistributable": false
+ }
+ ]
+}
+'@
+Set-Content -LiteralPath $manifestPath -Value $manifestJson -Encoding utf8
+Write-Host "stage-runtime.ps1: runtime-manifest.json written"
+
+$configDir = Join-Path $Root "runtime_local\config"
+New-Item -ItemType Directory -Force -Path $configDir | Out-Null
+$identityPath = Join-Path $configDir "ngx-local.json"
+if (-not (Test-Path -LiteralPath $identityPath -PathType Leaf)) {
+ $id = [guid]::NewGuid().ToString()
+ $identityJson = @{
+ ngxProjectId = $id
+ engineType = 'custom'
+ engineVersion = 'Veyra-Experimental-0.1.0'
+ } | ConvertTo-Json
+ Set-Content -LiteralPath $identityPath -Value $identityJson -Encoding utf8
+ Write-Host "stage-runtime.ps1: persistent local NGX identity created"
+}
+else {
+ Write-Host "stage-runtime.ps1: local NGX identity already present (kept)"
+}
+
+exit 0
diff --git a/tools/runtime_probe/main.cpp b/tools/runtime_probe/main.cpp
new file mode 100644
index 00000000..8bd27c2b
--- /dev/null
+++ b/tools/runtime_probe/main.cpp
@@ -0,0 +1,16 @@
+// veyra_runtime_probe - Phase 0 skeleton stub.
+// Real probe behavior (logger, file identity, D3D12 device context, runtime
+// loading, window loop) lands in P0.5-P0.7; this stub only proves that the
+// CMake/C++20 x64 skeleton configures, builds and runs.
+#include <cstdio>
+#include <string>
+
+int wmain(int argc, wchar_t** argv)
+{
+ std::wprintf(L"veyra_runtime_probe skeleton (phase 0 stub)\n");
+ std::wprintf(L"argc=%d\n", argc);
+ for (int i = 0; i < argc; ++i) {
+ std::wprintf(L"argv[%d]=%ls\n", i, argv[i]);
+ }
+ return 0;
+}