mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 21:39:58 -04:00
Let the upscaler stand-in's scratch images make room for a new size instead of refusing it.
The cache kept the first eight sizes and formats for the whole run and refused every other one, so after a few window, resolution or DLSS mode changes the stand-in's blit of a new size was left out, while the old sizes' images stayed. A new size now takes a free entry or the one used longest ago, whose image goes through the deferred destruction after the tonemap pass drops its views of it (vk_tonemap_forget), before another image can take its handle. tests/scratch_lru_check.py checks the choice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
40
tests/scratch_lru_check.py
Normal file
40
tests/scratch_lru_check.py
Normal file
@@ -0,0 +1,40 @@
|
||||
"""Build and run tests/scratch_lru_check.c: runtime/vk_scratch_lru.h, which entry of the upscaler stand-in's scratch
|
||||
image cache serves a new size (vk_exec_draw.c fallback_scratch): a free one, else the one used longest ago.
|
||||
|
||||
No GPU, no game files, any Python.
|
||||
|
||||
Usage: scratch_lru_check.py
|
||||
"""
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
MSYS_BIN = Path(r'C:\msys64\ucrt64\bin')
|
||||
|
||||
|
||||
def compiler():
|
||||
"""$CC, else MSYS2 UCRT64's clang, else clang on PATH (as tests/diff/common.py picks it, without its Unicorn)."""
|
||||
if os.environ.get('CC'):
|
||||
return os.environ['CC']
|
||||
if os.name == 'nt' and (MSYS_BIN / 'clang.exe').exists():
|
||||
return str(MSYS_BIN / 'clang.exe')
|
||||
return shutil.which('clang') or 'clang'
|
||||
|
||||
|
||||
def main():
|
||||
work = ROOT / 'build' / 'test' / 'scratch_lru'
|
||||
work.mkdir(parents=True, exist_ok=True)
|
||||
exe = work / ('scratch_lru_check.exe' if os.name == 'nt' else 'scratch_lru_check')
|
||||
env = dict(os.environ)
|
||||
if os.name == 'nt' and MSYS_BIN.exists():
|
||||
env['PATH'] = str(MSYS_BIN) + os.pathsep + env.get('PATH', '')
|
||||
subprocess.check_call([compiler(), '-std=gnu11', '-O1', '-Wall', '-Werror', '-I', str(ROOT / 'runtime'),
|
||||
str(ROOT / 'tests' / 'scratch_lru_check.c'), '-o', str(exe)], env=env)
|
||||
return subprocess.run([str(exe)], env=env).returncode
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user