Skip to content

Commit e2934a1

Browse files
committed
ci(compat): build compatibility branch with focused lifetime checks
1 parent ce1fe45 commit e2934a1

7 files changed

Lines changed: 315 additions & 7 deletions

File tree

‎.github/workflows/clang-format.yml‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
name: clang-format Check
22
on: [push, pull_request]
3+
permissions:
4+
contents: read
35
jobs:
46
formatting-check:
5-
name: Formatting Check
7+
name: Formatting Check (changed lines)
68
runs-on: ubuntu-latest
79
steps:
810
- uses: actions/checkout@v4
9-
- name: Run clang-format style check for C/C++/Protobuf programs.
10-
uses: jidicula/clang-format-action@v4.15.0
1111
with:
12-
clang-format-version: '20'
13-
check-path: 'OptiScaler'
14-
exclude-regex: 'external/|OptiScaler/include/'
12+
fetch-depth: 0
13+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
14+
persist-credentials: false
15+
- uses: actions/setup-python@v5
16+
with:
17+
python-version: '3.12'
18+
- name: Install pinned formatter
19+
run: python -m pip install clang-format==20.1.8
20+
- name: Test incremental selection
21+
run: python -m unittest discover -s tests -p test_clang_format_changed.py -v
22+
- name: Check added and modified C/C++ lines
23+
run: python scripts/clang_format_changed.py

‎.github/workflows/just_build_no_signature.yml‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ name: Build Aurora (No Signing) / 构建 Aurora(未签名)
88
on:
99
workflow_dispatch:
1010
push:
11-
branches: [ "aurora" ]
11+
branches: [ "aurora", "Compatibility-fixes" ]
1212
# pull_request:
1313
# branches: [ "master" ]
1414

@@ -56,6 +56,9 @@ jobs:
5656
$date = Get-Date -Format "yyyyMMdd"
5757
$outputFileName = "OptiScaler_Aurora_${version}_${date}"
5858
59+
if ($env:GITHUB_REF_NAME -eq 'Compatibility-fixes') {
60+
$outputFileName += "_compat_" + $env:GITHUB_SHA.Substring(0,8)
61+
}
5962
Write-Output "Generated Filename: $outputFileName"
6063
"version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
6164
"filename=$outputFileName" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
@@ -119,6 +122,18 @@ jobs:
119122
Copy-Item "${{ github.workspace }}\dist\runtime_sync\runtime_sync.ps1" "${{ github.workspace }}\x64\Release\a\runtime_sync.ps1"
120123
Copy-Item "${{ github.workspace }}\dist\runtime_sync\Check_DLSS_Runtime.bat" "${{ github.workspace }}\x64\Release\a\Check_DLSS_Runtime.bat"
121124
125+
- name: Test frame and provider lifetime guards
126+
shell: powershell
127+
run: |
128+
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
129+
$vs = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
130+
$vcvars = Join-Path $vs 'VC\Auxiliary\Build\vcvars64.bat'
131+
foreach ($name in @('Aurora_DLSSG_Frame_Guard_Tests','Aurora_Provider_Handle_Tests')) {
132+
$command = 'call "' + $vcvars + '" && cl /nologo /EHsc /std:c++20 /I OptiScaler tests\' + $name + '.cpp /Fe:x64\' + $name + '.exe && x64\' + $name + '.exe'
133+
& $env:ComSpec /d /c $command
134+
if ($LASTEXITCODE) { throw "Compatibility guard test failed: $name" }
135+
}
136+
122137
- name: Package Aurora / 打包 Aurora
123138
shell: powershell
124139
run: |

‎AGENTS.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Aurora compatibility work
2+
3+
Read `docs/CODEX_HANDOFF.md` before continuing. Source repository is this directory.
4+
5+
- Active branch: `Compatibility-fixes`, based on `aurora` at `e1673a16`.
6+
- The user discontinued RC3 installer development. Preserve its historical branches; do not bring installer changes into this branch.
7+
- Focus on evidenced game compatibility and performance defects. Review upstream/fork patches before adopting them; record provenance and deferred risks.
8+
- Ordinary commits and pushes to `Compatibility-fixes` are authorized. Do not merge into `aurora`, force-push, or publish Releases.
9+
- Do not modify installed games or claim CPU tests/builds establish GPU compatibility. Preserve native Streamline 1.x, Aurora's verified 6X path, and `DualFeature=false` behavior.
10+
- Run focused checks and the full DLL build for affected C++ changes. Do not rerun unrelated legacy installer suites or produce replacement archives.
11+

‎docs/CODEX_HANDOFF.md‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Compatibility branch handoff — 2026-09-15
2+
3+
The user abandoned the RC3 one-click installer branch and authorized compatibility work, local commits, and ordinary pushes to `Compatibility-fixes`. No merge to `aurora` or Release. No replacement ZIP deliverable.
4+
5+
## Baseline and evidence
6+
7+
- `aurora` / initial `Compatibility-fixes`: `e1673a16673070401612db04cc0593ca4dc3a6f6`.
8+
- Old installer branch remains `aurora-rc3-installer-20260913`; old Witcher experiment remains `experiment/witcher-mfg-frame-sync-20260915`.
9+
- User confirmed Witcher panel and 6X worked after installer fixes, then reproduced crashes loading with saved Dynamic MFG and toggling Dynamic/manual 6X or FG. Slight rapid flicker also remains. This is not a claim that the compatibility fixes have passed in-game testing.
10+
- Existing crash evidence includes GPU DEVICE_HUNG / frame mismatch / Reflex failures, and separate CPU crashes at `witcher3.exe+0x1f1f4ea`. One fix must not be assumed to explain all signatures.
11+
- User logs and dumps remain in the Codex task workspace `work/`, not in this public repository. Never commit private dumps or full user logs.
12+
- See [compatibility audit](COMPATIBILITY_AUDIT_20260915.md) for adopted changes, sources, limitations, and validation.
13+
14+
## Continuation rules
15+
16+
Official upstream is `https://github.com/optiscaler/OptiScaler.git`; the local remote named `upstream` is instead the grim-susemi fork. Official audit cutoff is `4af2417b24d05c9ff2a2531bbffe67ec1af9e4ea`. Nine commits after the previously audited `731f3b79` were reviewed. Do not repeat the older seventeen-commit audit.
17+
18+
Current package workflow builds this branch and runs production-header frame/handle guard tests. Keep the original installer layout inherited from `aurora`; do not restore RC3 tools.
19+
20+
No new Genshin/Star Rail/ZZZ crash logs from the user were provided in this batch. An optional question about affected games, trigger, bridge, and ReShade remains unanswered. Continue source work without treating that silence as test confirmation.
21+
22+
Git network requests on this host have worked with per-command `http.proxy=http://127.0.0.1:7897`; do not alter global proxy or disable TLS verification. Push only `origin Compatibility-fixes`.
23+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Compatibility audit — 2026-09-15
2+
3+
Scope: compatibility branch based on Aurora `e1673a16`. No RC3 installer changes, no bundled runtime replacement, no game installation changes.
4+
5+
## Adopted
6+
7+
| Change | Evidence and scope |
8+
| --- | --- |
9+
| Typed DXGI export forwarding | Official [42dc02af](https://github.com/optiscaler/OptiScaler/commit/42dc02af3718b510c86a815eed8c9793cb6d95ca): replaces argument/return-losing wrappers and includes missing exports. Prerequisite for the next fix. |
10+
| Remove DXGI export logging during startup | Official [b0dd6b02](https://github.com/optiscaler/OptiScaler/commit/b0dd6b02ce00cd2197493f358b127ec61579ee84), reported Windows 11 startup crashes. |
11+
| Clear consumed GPU timing sample | Official [7168655f](https://github.com/optiscaler/OptiScaler/commit/7168655f75076c1493af0ba544a6e2832be51f5c). Corrects stale displayed costs; not an FPS improvement claim. |
12+
| Older UE runtime path search | Official [bd6407da](https://github.com/optiscaler/OptiScaler/commit/bd6407daecf9fb93cba15a92cd6fc5c358c6f7a2). Correct Binaries ancestor handling; previously audited candidate now adopted. |
13+
| Witcher-oriented captured-frame guard | Selective port of local experiment `9a7b0394`, restricted to Upscaler FG input. Match capture/dispatch/present epochs; explicitly suspend interpolation on invalid inputs while retaining resources and allowing capture to recover. Resume only after Reflex/constants succeed. Inactive/uninitialized paths are guarded. Does not change native SL1, the 6X unlock, or DualFeature policy. |
14+
| NVNGX provider handle lifetime | Existing Release deleted the wrapper while its embedded mutex was still locked, through the public handle type. Registry ownership now retains entries before locking, retires them once, and unlocks before destruction. Queued evaluations/releases cannot dereference freed entries. Failed Create remains unpublished; failed Release stays recoverable. Applies to D3D12 and Vulkan provider handles. |
15+
| Mixed DX11/DX12 GPU timing guards | [Issue 1124](https://github.com/optiscaler/OptiScaler/issues/1124) and source review identify a DX11 context being passed to a native DX12 timing implementation through void*. Guard timing calls by feature API/interop type. |
16+
| Depth-plane SRV format | Narrow port from [PR 1157](https://github.com/optiscaler/OptiScaler/pull/1157), head `7543d143`: preserve `R32_FLOAT_X8X24_TYPELESS` for the depth-plane SRV instead of translating it into a DSV-only format. Other parts of the PR are not imported. |
17+
18+
## Mihoyo findings and deferred changes
19+
20+
- **Genshin:** [issue 1122](https://github.com/optiscaler/OptiScaler/issues/1122) and the bridge author's [comparison report](https://github.com/AizawaHikaru233/genshin_fsr_brigde/blob/main/assets/optiscaler-fg-regression/REPORT.md) describe AMD 9070 XT + Genshin 7.0 + FSR Bridge 2.1: August 15 works; August 25 onward fails. The report counts 4302 vs 11 DLSSG evaluations, followed by E_ABORT, with matching configuration/runtime. `882536fb` remains a bisect candidate, not a proven cause. The handle repair addresses an independently demonstrable lifetime bug; it does not establish that this report is fixed. Bridge HEAD reviewed: `bc2044285bfcdf3b51b89e03762af4982d9151c1`. No bridge installer or anti-cheat modification imported.
21+
- **ZZZ:** [issue 1084](https://github.com/optiscaler/OptiScaler/issues/1084) reports an SL-input/FSR-FG visual regression subsequently confirmed fixed in a development build. Aurora already includes the ZZZ `IgnoreTagsWithoutHudlessForFG` quirk; no duplicate patch or speculative game-specific override added.
22+
- **Star Rail:** [issue 994](https://github.com/optiscaler/OptiScaler/issues/994) describes short battle splash-art freezes, not an established new crash fix. No unsupported claim of resolution.
23+
- **Active Streamline binding (PR 1157):** deferred. Aurora uses private bundled runtimes and disables OTA; delayed device initialization and plugin-function resolution ordering require separate validation. Its Vulkan framebuffer condition fix is already in Aurora.
24+
- **DLSSG resource-transition rewrite ([PR 1089](https://github.com/optiscaler/OptiScaler/pull/1089)):** deferred. Large lifecycle/configuration change, incomplete author testing, and maintainer concerns. Not suitable for blind cherry-pick.
25+
- **OptiInput loader-lock deadlock ([issue 1162](https://github.com/optiscaler/OptiScaler/issues/1162)):** plausible independent defect; the reported integration-lock rewrite is not a reviewed public patch. Remains follow-up work.
26+
- Upstream high-MFG freeze-threshold fix `04bf0b08` is already represented by Aurora `a8d308b0`; do not duplicate it. New Vulkan interop hook changes and unrelated game quirks were reviewed but not imported as universal fixes.
27+
28+
## Verification and limits
29+
30+
- Local Windows C++ builds run the 22 captured-frame assertions and 14 provider-lifetime checks against production headers. These exercise frame epochs, invalidation, recovery eligibility, unknown handles, failed release/create, evaluation/release overlap, and concurrent repeated release.
31+
- Full MSVC DLL compilation and both C++ tests run in `Build Aurora (No Signing)` for `Compatibility-fixes`. Artifact names include the commit prefix. Build status is reported separately after the actual run.
32+
- clang-format is pinned to 20.1.8 and checks changed applicable C/C++ lines, with selector unit tests. Historical unrelated formatting debt is not rewritten. No old installer suites are rerun.
33+
- No real GPU/game compatibility validation in this batch. Required: Witcher saved Dynamic MFG loading, Dynamic/manual 6X/FG toggles, sustained play and flicker comparison; Genshin bridge repro with unchanged runtimes; separate Star Rail/ZZZ logs if still failing.
34+
- Handle registry does not redesign provider-global shutdown/concurrent provider selection or make arbitrary reuse of an already-freed public pointer valid. Those are separate lifetime boundaries.
35+
- The Witcher CPU crash signature at `+0x1f1f4ea` is not yet explained; builds and CPU guards cannot prove it resolved.

‎scripts/clang_format_changed.py‎

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
"""Read-only clang-format check of changed lines, without historical tree-wide debt.
2+
3+
PR: merge base to head. Push: before to after. New branch: default branch merge
4+
base to head. Renames are new files; deletion-only hunks contain no new code.
5+
Format the full file, but fail only replacements touching added/modified lines.
6+
"""
7+
import argparse
8+
import bisect
9+
import json
10+
import os
11+
from pathlib import Path, PurePosixPath
12+
import re
13+
import subprocess
14+
import sys
15+
import xml.etree.ElementTree as ET
16+
17+
18+
def git(*args, data=None):
19+
return subprocess.run(["git", *args], input=data, check=True, stdout=subprocess.PIPE).stdout
20+
21+
22+
def commit(ref):
23+
return git("rev-parse", "--verify", "--end-of-options", ref + "^{commit}").decode().strip()
24+
25+
26+
def event_base(event, head):
27+
if "pull_request" in event:
28+
base = commit(event["pull_request"]["base"]["sha"])
29+
return git("merge-base", base, head).decode().strip()
30+
before = event.get("before", "")
31+
if before and before != "0" * 40:
32+
return commit(before)
33+
default = event.get("repository", {}).get("default_branch")
34+
if default:
35+
base = commit("refs/remotes/origin/" + default)
36+
return git("merge-base", base, head).decode().strip()
37+
raise ValueError("No comparison base: use --base explicitly outside GitHub Actions")
38+
39+
40+
def eligible(name):
41+
path = PurePosixPath(name)
42+
return (path.parts[0] == "OptiScaler" and "external" not in path.parts
43+
and path.parts[:2] != ("OptiScaler", "include")
44+
and path.suffix.lower() in {".c", ".cc", ".cpp", ".cxx", ".h", ".hh", ".hpp", ".hxx"})
45+
46+
47+
def changed_ranges(diff):
48+
ranges = []
49+
for line in diff.splitlines():
50+
match = re.match(rb"@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@", line)
51+
if match:
52+
start = int(match[1])
53+
count = int(match[2]) if match[2] is not None else 1
54+
if count:
55+
ranges.append((start, start + count - 1))
56+
return ranges
57+
58+
59+
def violations(source, xml, ranges):
60+
root = ET.fromstring(xml)
61+
if root.get("incomplete_format") == "true":
62+
raise ValueError("clang-format could not completely parse the file")
63+
starts = [0] + [i + 1 for i, char in enumerate(source) if char == 10]
64+
result = []
65+
for item in root.findall("replacement"):
66+
offset, length = int(item.attrib["offset"]), int(item.attrib["length"])
67+
if offset < 0 or length < 0 or offset + length > len(source):
68+
raise ValueError("Invalid formatter replacement range")
69+
first = bisect.bisect_right(starts, offset)
70+
last = bisect.bisect_right(starts, offset + max(0, length - 1))
71+
if any(first <= end and last >= start for start, end in ranges):
72+
result.append(first)
73+
return sorted(set(result))
74+
75+
76+
def check(base, head, formatter):
77+
names = git("diff", "--no-renames", "--name-only", "--diff-filter=AM", "-z", base, head, "--")
78+
failures = 0
79+
checked = 0
80+
for raw in names.split(b"\0"):
81+
if not raw:
82+
continue
83+
name = os.fsdecode(raw)
84+
if not eligible(name):
85+
continue
86+
diff = git("diff", "--no-ext-diff", "--no-textconv", "--no-renames", "--unified=0", base, head, "--", name)
87+
ranges = changed_ranges(diff)
88+
if not ranges:
89+
continue
90+
source = git("show", head + ":" + name)
91+
output = subprocess.run([formatter, "--style=file", "--fallback-style=none",
92+
"--assume-filename=" + name, "--output-replacements-xml"],
93+
input=source, check=True, stdout=subprocess.PIPE).stdout
94+
checked += 1
95+
for line in violations(source, output, ranges):
96+
# repr prevents filenames with control characters from injecting CI commands.
97+
print(f"{name!r}:{line}: formatting change required on edited lines")
98+
failures += 1
99+
print(f"Checked {checked} changed C/C++ files; {failures} edited-line violations")
100+
return 1 if failures else 0
101+
102+
103+
def main():
104+
parser = argparse.ArgumentParser(description=__doc__)
105+
parser.add_argument("--base")
106+
parser.add_argument("--head", default="HEAD")
107+
parser.add_argument("--formatter", default="clang-format")
108+
args = parser.parse_args()
109+
head = commit(args.head)
110+
if args.base:
111+
base = commit(args.base)
112+
else:
113+
event_path = os.environ.get("GITHUB_EVENT_PATH")
114+
event = json.loads(Path(event_path).read_text(encoding="utf-8")) if event_path else {}
115+
base = event_base(event, head)
116+
return check(base, head, args.formatter)
117+
118+
119+
if __name__ == "__main__":
120+
try:
121+
sys.exit(main())
122+
except (ValueError, OSError, subprocess.CalledProcessError, ET.ParseError) as error:
123+
print(f"Formatting check failed: {error}", file=sys.stderr)
124+
sys.exit(2)

0 commit comments

Comments
 (0)