mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 09:18:37 +00:00
Default to full D3D12 shader and pipeline precompilation
This commit is contained in:
@ -117,8 +117,9 @@ Useful switches of `scripts\play-d3d12.ps1` (the launcher's Settings page has th
|
||||
| `-SeriesS` | the lighter Series S profile (720p rendered, DLSS to 1080p) |
|
||||
| `-RayTracing` | the game's real ray tracing: slower, shaders build for minutes the first time, not with frame generation |
|
||||
| `-HardwareRT` | a trial, in place of `-RayTracing`: the game's rays on the card's ray-tracing hardware (DXR 1.1). Not with frame generation ([details](d3d12/docs/fork-ray-tracing.md)) |
|
||||
| `-NoPrecompile` | start at once, without translating the shaders first |
|
||||
| `-PrecompileAll` | before the start, compile every pipeline the game has created in earlier runs into the driver's cache, not only those drawn with (an hour or more the first time; set NVIDIA's Shader Cache Size to Unlimited) |
|
||||
| `-NoPrecompile` | skip shader translation and pipeline warming before starting |
|
||||
| `-PrecompileAll` | the default. Translate all shaders and warm every pipeline recorded in earlier runs. The first full warm-up can take an hour or more. On NVIDIA, set Shader Cache Size to Unlimited. |
|
||||
| `-PrecompileUsed` | translate all shaders and warm only pipelines used to draw in earlier runs |
|
||||
| `-Capture` | F9 in the game saves that frame |
|
||||
| `-Log` | the runtime's log goes to `%LOCALAPPDATA%\Leonida\logs` |
|
||||
| `-DryRun` | print the settings a start would use, and stop |
|
||||
|
||||
@ -68,17 +68,16 @@ measurements and what is still wrong in the picture are in the [top-level README
|
||||
|
||||
## Shaders and pipelines are made before the title starts
|
||||
|
||||
`scripts/play-d3d12.ps1` (through `d3d12/scripts/play-nvidia.ps1`) precompiles before it starts the title, as
|
||||
Hookshot's release builds do; `-NoPrecompile` skips it. `-PrecompileAll` makes every pipeline the title has created in
|
||||
earlier runs, not only those drawn with; those never drawn with go into the driver's cache only, not the pipeline
|
||||
library.
|
||||
`scripts/play-d3d12.ps1` (through `d3d12/scripts/play-nvidia.ps1`) defaults to full precompilation before starting
|
||||
the title. `-PrecompileUsed` limits the warm-up to pipelines earlier runs drew with. `-NoPrecompile` skips both
|
||||
stages. The first full warm-up can take an hour or more. On NVIDIA, set Shader Cache Size to Unlimited.
|
||||
|
||||
1. `leonida shaders <the title's shaders.rpf>` translates every shader into the cache with the settings of this
|
||||
start. That takes minutes the first time and after a change of the translator or of a setting a translation
|
||||
depends on (`crates/leonida-gpu/src/shader_cache.rs` lists them); later starts find every shader there.
|
||||
2. `leonida warm --used` makes the host pipelines earlier runs drew with, in processes of their own, so that the
|
||||
driver's cache on disk has them (`crates/leonida-gpu/src/pipeline/known.rs`). Runs write the title's pipelines
|
||||
down for it (`LEONIDA_PIPELINE_BOOK=1`, set by the launcher), so the first session in a place still makes that
|
||||
2. `leonida warm` makes every host pipeline recorded in earlier runs in separate processes. Pipelines that have yet
|
||||
to be drawn go into the driver's disk cache only (`crates/leonida-gpu/src/pipeline/known.rs`). The launcher sets
|
||||
`LEONIDA_PIPELINE_BOOK=1` to record the title's pipelines, so the first session in a place still makes that
|
||||
place's pipelines as it meets them; from the next start on they are made ahead.
|
||||
|
||||
---
|
||||
|
||||
@ -50,12 +50,10 @@
|
||||
# -Build target\diag (the default, the build all measurements are of) or target\release
|
||||
# -DlssDir the folder with nvngx_dlss.dll, if not nvidia-sdk\DLSS\lib\Windows_x86_64\rel
|
||||
# -StreamlineDir the folder with sl.interposer.dll (frame generation), if not nvidia-sdk\Streamline\bin\x64
|
||||
# -NoPrecompile start at once. By default every shader of the title is translated into the cache and the
|
||||
# pipelines earlier runs drew with are made before the title starts (minutes the first time
|
||||
# and after a change of the layer, seconds otherwise), so that the world does not come up
|
||||
# half drawn or stall while they are made.
|
||||
# -PrecompileAll every pipeline the title has created in earlier runs, not only those drawn with (as foxhound's
|
||||
# launcher): fewer stalls in new places; an hour or more and gigabytes the first time.
|
||||
# -NoPrecompile skip shader translation and pipeline warming before starting
|
||||
# -PrecompileUsed translate all shaders and warm only the pipelines earlier runs drew with
|
||||
# -PrecompileAll translate all shaders and warm every pipeline recorded in earlier runs (the default).
|
||||
# The first full warm-up can take an hour or more and use gigabytes of driver cache.
|
||||
# -Log the layer's log goes to a file in %LOCALAPPDATA%\Leonida\logs instead of this window
|
||||
# -Capture F9 in the game saves that frame and the pictures it drew, in %LOCALAPPDATA%\Leonida\captures
|
||||
# -WindowsBarMB maximum MiB of title memory windows in CPU-mapped VRAM, which needs resizable BAR (by default
|
||||
@ -101,7 +99,8 @@ param(
|
||||
# own (scripts\play-d3d12.ps1's Series X default): they win over the F1 menu's saved values. Unset: this start's.
|
||||
[string[]]$Typed,
|
||||
# Set by the F1 menu's SAVE AND RESTART: the switches are the last start's again, so the menu's values win.
|
||||
[switch]$MenuRestart
|
||||
[switch]$MenuRestart,
|
||||
[switch]$PrecompileUsed
|
||||
)
|
||||
$root = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
|
||||
if (-not (Test-Path $Exe)) { Write-Host "No $Exe."; return }
|
||||
@ -726,10 +725,12 @@ $settings.LEONIDA_MENU_SMOOTH_MOTION = if ($smooth) { '1' } else { '0' }
|
||||
$settings.LEONIDA_MENU_CONSOLE = $console
|
||||
$settings.LEONIDA_MENU_FILE = $menuFile
|
||||
$settings.LEONIDA_MENU_PLAY = $MyInvocation.MyCommand.Path
|
||||
$precompileUsedOnly = if ($PSBoundParameters.ContainsKey('PrecompileAll')) { -not $PrecompileAll } else { $PrecompileUsed }
|
||||
$again = @("-Exe '$($Exe -replace "'", "''")'", "-Build $Build")
|
||||
foreach ($s in 'NoSmoothMotion', 'MotionBlur', 'NoDlss', 'NoFrameGen', 'SeriesX', 'Quality', 'RayTracing', 'HardwareRT', 'FsrFrameGen', 'NoPrecompile', 'PrecompileAll', 'Log', 'Capture', 'Fullscreen') {
|
||||
foreach ($s in 'NoSmoothMotion', 'MotionBlur', 'NoDlss', 'NoFrameGen', 'SeriesX', 'Quality', 'RayTracing', 'HardwareRT', 'FsrFrameGen', 'NoPrecompile', 'Log', 'Capture', 'Fullscreen') {
|
||||
if ($PSBoundParameters[$s]) { $again += "-$s" }
|
||||
}
|
||||
if ($precompileUsedOnly) { $again += '-PrecompileUsed' }
|
||||
foreach ($s in 'Resolution', 'Lowest', 'Dlss', 'FrameGen', 'Aspect', 'PresentScale', 'Adapter', 'DlssDir', 'StreamlineDir', 'FidelityFxDir') {
|
||||
if ($PSBoundParameters[$s]) { $again += "-$s '$($PSBoundParameters[$s] -replace "'", "''")'" }
|
||||
}
|
||||
@ -873,8 +874,7 @@ if (-not $env:LEONIDA_CACHE_DIR -and -not ((Test-Path $toml) -and (Select-String
|
||||
# Leonida: shaders and pipelines are made before the title starts, not while it plays (as Hookshot's release
|
||||
# builds do). Every shader of the title's shader archive is translated into the cache with the settings of this
|
||||
# start: once per change of the translator or of a setting a translation depends on; a later start finds them all
|
||||
# there. Then the host pipelines earlier runs drew with are made in processes of their own, so that the driver's
|
||||
# cache on disk has them: after a change of the layer or of the driver, and for places first seen in the last run.
|
||||
# there. Then the recorded host pipelines are made in processes of their own to populate the driver's disk cache.
|
||||
if (-not $NoPrecompile) {
|
||||
$archive = Join-Path (Split-Path $Exe) 'shaders.rpf'
|
||||
$from = if (Test-Path $archive) { $archive } else { Split-Path $Exe }
|
||||
@ -887,7 +887,6 @@ if (-not $NoPrecompile) {
|
||||
Write-Host 'Precompiling shaders (minutes the first time, seconds after; -NoPrecompile skips it) ...'
|
||||
& $leonida shaders $from | Where-Object { $_ -match 'shaders in the cache|do not translate' } |
|
||||
ForEach-Object { Write-Host " $_" }
|
||||
Write-Host 'Precompiling the pipelines earlier runs drew with ...'
|
||||
# The driver keeps what these processes compile in its own files, of at most its "Shader Cache Size" each
|
||||
# (4 GB unless raised). A full one keeps nothing new: every start then compiles in the game again, at a
|
||||
# frame every few seconds and with draws missing (2026-11-27, twice in a day of translator changes).
|
||||
@ -908,16 +907,14 @@ if (-not $NoPrecompile) {
|
||||
}
|
||||
$pipelineDir = if ($cacheRoot) { Join-Path $cacheRoot 'pipelines' } else { $null }
|
||||
$dxNoted = if ($pipelineDir) { Join-Path $pipelineDir 'driver-cache-files.txt' } else { $null }
|
||||
# Leonida: -PrecompileAll makes every pipeline the title has created in any earlier run
|
||||
# (known-pipelines.bin), as foxhound's launcher does, not only those drawn with: places and effects not yet
|
||||
# drawn in then find theirs in the driver's cache instead of compiling while the game waits. Those never drawn
|
||||
# with go into the driver's cache only, not the pipeline library (warm.rs). Some 88,000 against 4,000: an hour
|
||||
# or more the first time, and more than the driver's default 4 GB cache (the warning below).
|
||||
# Pipelines recorded in known-pipelines.bin that have yet to be drawn go into the driver's cache only.
|
||||
$warmArgs = @('warm')
|
||||
if (-not $PrecompileAll) { $warmArgs += '--used' }
|
||||
else {
|
||||
Write-Host ' -PrecompileAll: every pipeline the title has created, into the driver''s cache. An hour or more the'
|
||||
Write-Host ' first time; set NVIDIA''s Shader Cache Size to Unlimited, or what does not fit is compiled in the game.'
|
||||
if ($precompileUsedOnly) {
|
||||
$warmArgs += '--used'
|
||||
Write-Host 'Precompiling the pipelines earlier runs drew with ...'
|
||||
} else {
|
||||
Write-Host 'Precompiling every pipeline recorded in earlier runs ...'
|
||||
Write-Host ' The first full warm-up can take an hour or more. On NVIDIA, set Shader Cache Size to Unlimited.'
|
||||
}
|
||||
$gone = @()
|
||||
if ($dxNoted -and (Test-Path $dxNoted)) {
|
||||
|
||||
@ -23,7 +23,9 @@ Standard library only (`tools/leonida_launcher.py`).
|
||||
confirmation, ends the process and everything it started (`taskkill /T /F`; on Linux the process group).
|
||||
- **Settings**: the game folder (a picker, and a check that `game_scarlett_master.exe` is in it), the data folder
|
||||
(empty = the script's default), the mods folder, and the options of `play-d3d12.ps1`: DLSS (off is `-NoDlss`),
|
||||
`-RayTracing`, `-SmoothMotion`, shader preparation (off is `-NoPrecompile`), precompiling every pipeline (`-PrecompileAll`, which needs the shader preparation on: its box ticks it), `-SeriesX`, `-Quality`, `-Resolution`
|
||||
`-RayTracing`, `-SmoothMotion`, shader preparation (off is `-NoPrecompile`), and full pipeline precompilation.
|
||||
Fresh settings enable both. Unchecking full pipeline precompilation with shader preparation still on uses
|
||||
`-PrecompileUsed`. The other options include `-SeriesX`, `-Quality`, `-Resolution`
|
||||
(default = none), `-Capture`, `-Log`. On Linux only the game folder and Series X are used.
|
||||
- **Mods**: the `mods\*\mod.json` of the mods folder (this repository's `mods` unless changed), with the enabled flag
|
||||
written back as the mod manager does it (`tools/leonida_mods.py`); a button opens that manager.
|
||||
|
||||
@ -421,7 +421,7 @@ for (const img of document.querySelectorAll("img[data-logo]")) {
|
||||
// each: `console` (series_s, series_x) and `upscale` (dlss, off = -NoDlss, and dlss_mode, -Dlss <mode>).
|
||||
const DEFAULTS = { game_dir: "", data_dir: "", mods_dir: "", background: "", series_s: false, series_x: false, dlss: true, dlss_mode: "", resolution: "",
|
||||
frame_gen: 0, smooth_motion: false, aspect: "", present_scale: "", ray_tracing: false, quality: false, adapter: "", precompile: true,
|
||||
capture: false, log: false };
|
||||
precompile_all: true, capture: false, log: false };
|
||||
const GROUPS = [
|
||||
{ title: "Folders", fields: [
|
||||
{ key: "game_dir", kind: "path", label: "Game folder", check: "game",
|
||||
@ -452,7 +452,9 @@ const GROUPS = [
|
||||
help: "On a PC with more than one: part of its name (5060) or its index (#1)." } ] },
|
||||
{ title: "Start", fields: [
|
||||
{ key: "precompile", kind: "switch", label: "Prepare shaders first", windows: true,
|
||||
help: "Every shader is translated and the pipelines of earlier runs are made before the game starts: minutes the first time, seconds after. Off starts at once, and the world can come up half drawn." },
|
||||
help: "Translate every shader and warm pipelines before starting." },
|
||||
{ key: "precompile_all", kind: "switch", label: "Warm every recorded pipeline", windows: true, when: s => s.precompile,
|
||||
help: "Off warms only pipelines used to draw in earlier runs. The first full warm-up can take an hour or more." },
|
||||
{ key: "capture", kind: "switch", label: "Capture key", windows: true, help: "F9 in the game saves that frame to %LOCALAPPDATA%\\Leonida\\captures." },
|
||||
{ key: "log", kind: "switch", label: "Write a log file", windows: true, help: "The runtime's log goes to %LOCALAPPDATA%\\Leonida\\logs." } ] },
|
||||
{ title: "Launcher", fields: [
|
||||
@ -481,6 +483,7 @@ function switchArgs(s) {
|
||||
if (s.ray_tracing) a.push("-RayTracing");
|
||||
if (s.smooth_motion) a.push("-SmoothMotion");
|
||||
if (!s.precompile) a.push("-NoPrecompile");
|
||||
else if (!s.precompile_all) a.push("-PrecompileUsed");
|
||||
if (s.series_x && !s.series_s) a.push("-SeriesX");
|
||||
if (s.quality) a.push("-Quality");
|
||||
if (s.resolution && !(s.dlss && s.dlss_mode)) a.push("-Resolution", s.resolution);
|
||||
@ -505,7 +508,8 @@ function facts(s) {
|
||||
: lighter ? "720p to 1080p" : "1440 lines, game's upscaler";
|
||||
const frames = (s.frame_gen ? "Frame generation " + s.frame_gen + "x" : "No generated frames") + (s.smooth_motion ? ", Smooth Motion" : "");
|
||||
const shape = s.aspect ? (s.aspect === "auto" ? "The screen's shape" : s.aspect) + (s.present_scale === "stretch" ? ", stretched" : ", black bars") : "16:9";
|
||||
const start = s.precompile ? "Shaders prepared first" : "Starts at once";
|
||||
const start = S?.platform === "linux" || !s.precompile ? "Starts without precompiling"
|
||||
: s.precompile_all ? "Shaders and all recorded pipelines prepared first" : "Shaders and used pipelines prepared first";
|
||||
return [["Profile", lighter ? "Series S" : "Series X"], ["Picture", picture + (s.ray_tracing ? ", ray tracing" : "")], ["Frames", frames],
|
||||
["Window", shape], ["Start", start + (s.capture ? ", F9 captures" : "") + (s.log ? ", log file" : "")]];
|
||||
}
|
||||
@ -643,6 +647,7 @@ let saveTimer = 0;
|
||||
function change(patch) {
|
||||
Object.assign(S.settings, patch);
|
||||
if (S.settings.series_s) S.settings.series_x = false;
|
||||
if (!S.settings.precompile) S.settings.precompile_all = false;
|
||||
render();
|
||||
if (S.sample) return;
|
||||
clearTimeout(saveTimer);
|
||||
|
||||
@ -36,10 +36,10 @@
|
||||
# -RayTracing the title's real ray tracing (slower; shaders build for minutes the first time)
|
||||
# -HardwareRT a trial: the title's rays on the card's ray-tracing cores (DXR 1.1), in place of -RayTracing
|
||||
# -Capture F9 in the game saves that frame and the pictures it drew
|
||||
# -NoPrecompile start at once: by default every shader is translated and the pipelines earlier runs drew with are
|
||||
# made before the title starts (minutes the first time, seconds after)
|
||||
# -PrecompileAll every pipeline the title has created in earlier runs, not only those drawn with (as foxhound):
|
||||
# fewer stalls in new places; an hour or more and gigabytes the first time
|
||||
# -NoPrecompile skip shader translation and pipeline warming before starting
|
||||
# -PrecompileUsed translate all shaders and warm only the pipelines earlier runs drew with
|
||||
# -PrecompileAll translate all shaders and warm every pipeline recorded in earlier runs (the default).
|
||||
# The first full warm-up can take an hour or more and use gigabytes of driver cache.
|
||||
# -Log the runtime's log goes to a file under %LOCALAPPDATA%\Leonida\logs
|
||||
# -DryRun prints the settings this start would run with and stops: nothing is built or started
|
||||
# -PcGlyphs a folder of your own pictures for the keyboard-and-mouse button prompts instead of the built-in key
|
||||
@ -80,7 +80,8 @@ param(
|
||||
[string]$PcGlyphs = '',
|
||||
# Launcher.bat: the switches of this start whose value changed since its last PLAY, comma-separated (`none`).
|
||||
# Only those count as typed for the F1 menu: the launcher passes every option at every start.
|
||||
[string]$Chosen
|
||||
[string]$Chosen,
|
||||
[switch]$PrecompileUsed
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
@ -113,9 +114,10 @@ if ($Dlss) { $launch.Dlss = $Dlss }
|
||||
if ($FrameGen) { $launch.FrameGen = $FrameGen }
|
||||
if ($Aspect) { $launch.Aspect = $Aspect }
|
||||
if ($PresentScale) { $launch.PresentScale = $PresentScale }
|
||||
foreach ($switch in 'Quality', 'NoDlss', 'NoFrameGen', 'MotionBlur', 'RayTracing', 'HardwareRT', 'Capture', 'NoPrecompile', 'PrecompileAll', 'Log', 'DryRun', 'FsrFrameGen', 'Fullscreen') {
|
||||
foreach ($switch in 'Quality', 'NoDlss', 'NoFrameGen', 'MotionBlur', 'RayTracing', 'HardwareRT', 'Capture', 'NoPrecompile', 'PrecompileUsed', 'Log', 'DryRun', 'FsrFrameGen', 'Fullscreen') {
|
||||
if ($PSBoundParameters[$switch]) { $launch[$switch] = $true }
|
||||
}
|
||||
if ($PSBoundParameters.ContainsKey('PrecompileAll')) { $launch.PrecompileAll = $PrecompileAll }
|
||||
if ($Resolution) { $launch.Resolution = $Resolution }
|
||||
if ($Lowest) { $launch.Lowest = $Lowest }
|
||||
if ($Adapter) { $launch.Adapter = $Adapter }
|
||||
|
||||
@ -130,11 +130,14 @@ class CommandTests(unittest.TestCase):
|
||||
self.assertIn("$Data", text)
|
||||
|
||||
def test_precompile_all_only_with_the_precompile(self):
|
||||
self.assertIn("-PrecompileAll", launcher.switch_args(settings(precompile_all=True)))
|
||||
off = launcher.switch_args(settings(precompile=False, precompile_all=True))
|
||||
self.assertIn("-NoPrecompile", off)
|
||||
self.assertNotIn("-PrecompileAll", off)
|
||||
self.assertNotIn("-PrecompileAll", launcher.switch_args(settings()))
|
||||
defaults = launcher.normalise({})
|
||||
self.assertTrue(defaults["precompile_all"])
|
||||
self.assertEqual(launcher.switch_args(defaults), [])
|
||||
saved = launcher.normalise({"precompile_all": False})
|
||||
self.assertEqual(launcher.switch_args(saved), ["-PrecompileUsed"])
|
||||
off = launcher.normalise({"precompile": False})
|
||||
self.assertFalse(off["precompile_all"])
|
||||
self.assertEqual(launcher.switch_args(off), ["-NoPrecompile"])
|
||||
|
||||
def test_linux_command(self):
|
||||
command = launcher.play_command(settings(game_dir="/g", series_x=True, dlss=False), repo="/r",
|
||||
|
||||
@ -39,6 +39,62 @@ public class FakePython {
|
||||
|
||||
|
||||
class WinLaunchersTests(unittest.TestCase):
|
||||
@unittest.skipUnless(os.name == "nt" and shutil.which("powershell.exe"), "requires Windows PowerShell")
|
||||
def test_d3d12_precompile_modes(self) -> None:
|
||||
command = r"""
|
||||
$ErrorActionPreference = 'Stop'
|
||||
Add-Type -OutputAssembly $env:TEST_RUNTIME -OutputType ConsoleApplication -TypeDefinition @'
|
||||
using System;
|
||||
public class FakeRuntime {
|
||||
public static void Main(string[] args) {
|
||||
string prefix = args[0] == "shaders" ? "shaders in the cache" : "pipelines known";
|
||||
Console.WriteLine(prefix + ": " + string.Join(" ", args));
|
||||
}
|
||||
}
|
||||
'@
|
||||
function Get-CimInstance {
|
||||
param([string]$ClassName)
|
||||
if ($ClassName -eq 'Win32_OperatingSystem') { [pscustomobject]@{ BuildNumber = '26100' } }
|
||||
}
|
||||
function Start-Process { 'title launch' }
|
||||
$options = @{ Game = $env:TEST_GAME; Data = $env:TEST_DATA; NoDlss = $true }
|
||||
$launcher = $env:TEST_LAUNCHER
|
||||
& $launcher @options
|
||||
& $launcher @options -PrecompileUsed
|
||||
& $launcher @options -NoPrecompile -PrecompileUsed
|
||||
& $launcher @options -PrecompileAll
|
||||
& $launcher @options -PrecompileAll:$false
|
||||
& $launcher @options -DryRun -PrecompileUsed | Where-Object { $_ -like 'LEONIDA_MENU_ARGS=*' }
|
||||
"""
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
root = Path(td)
|
||||
launcher = root / "scripts" / "play-d3d12.ps1"
|
||||
nvidia = root / "d3d12" / "scripts" / NVIDIA_LAUNCHER.name
|
||||
runtime = root / "d3d12" / "target" / "diag" / "leonida.exe"
|
||||
game = root / "synthetic title"
|
||||
for folder in (launcher.parent, nvidia.parent, runtime.parent, game):
|
||||
folder.mkdir(parents=True)
|
||||
shutil.copyfile(ROOT / "scripts" / launcher.name, launcher)
|
||||
shutil.copyfile(NVIDIA_LAUNCHER, nvidia)
|
||||
(game / "game_scarlett_master.exe").touch()
|
||||
env = {name: value for name, value in os.environ.items() if not name.upper().startswith("LEONIDA_")}
|
||||
env.update(TEST_RUNTIME=str(runtime), TEST_GAME=str(game), TEST_DATA=str(root / "data"),
|
||||
TEST_LAUNCHER=str(launcher), LOCALAPPDATA=str(root))
|
||||
result = subprocess.run(
|
||||
["powershell.exe", "-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-Command", command],
|
||||
env=env, capture_output=True, text=True, timeout=60,
|
||||
)
|
||||
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
|
||||
calls = [line.strip() for line in result.stdout.splitlines()
|
||||
if line.strip().startswith(("shaders in the cache:", "pipelines known:", "title launch"))]
|
||||
shaders = f"shaders in the cache: shaders {game}"
|
||||
self.assertEqual(calls, [shaders, "pipelines known: warm", "title launch",
|
||||
shaders, "pipelines known: warm --used", "title launch",
|
||||
"title launch", shaders, "pipelines known: warm", "title launch",
|
||||
shaders, "pipelines known: warm --used", "title launch"])
|
||||
restart, = [line for line in result.stdout.splitlines() if line.startswith("LEONIDA_MENU_ARGS=")]
|
||||
self.assertIn(" -PrecompileUsed ", restart)
|
||||
|
||||
@unittest.skipUnless(POWERSHELL, "requires PowerShell")
|
||||
def test_nvidia_menu_restart_preserves_motion_blur_switch(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
|
||||
@ -54,7 +54,7 @@ DEFAULTS: dict = {
|
||||
"hardware_rt": False, # -HardwareRT (a trial, in place of -RayTracing)
|
||||
"smooth_motion": False, # -SmoothMotion
|
||||
"precompile": True, # off = -NoPrecompile
|
||||
"precompile_all": False, # -PrecompileAll
|
||||
"precompile_all": True, # off = -PrecompileUsed
|
||||
"series_x": False, # -SeriesX
|
||||
"quality": False, # -Quality
|
||||
"resolution": "", # -Resolution <height>, empty = the default path
|
||||
@ -107,6 +107,8 @@ def normalise(data: object) -> dict:
|
||||
settings[key] = value if isinstance(value, str) else default
|
||||
if settings["series_s"]:
|
||||
settings["series_x"] = False
|
||||
if not settings["precompile"]:
|
||||
settings["precompile_all"] = False
|
||||
return settings
|
||||
|
||||
|
||||
@ -155,8 +157,8 @@ def switch_args(settings: dict) -> list[str]:
|
||||
args.append("-SmoothMotion")
|
||||
if not settings["precompile"]:
|
||||
args.append("-NoPrecompile")
|
||||
elif settings["precompile_all"]:
|
||||
args.append("-PrecompileAll")
|
||||
elif not settings["precompile_all"]:
|
||||
args.append("-PrecompileUsed")
|
||||
if settings["series_x"] and not settings["series_s"]:
|
||||
args.append("-SeriesX")
|
||||
if settings["quality"]:
|
||||
@ -876,8 +878,7 @@ def run_gui() -> int:
|
||||
self.vars[key] = var
|
||||
ttk.Checkbutton(options, text=text, variable=var).grid(row=index // 2, column=index % 2,
|
||||
sticky="w", pady=3)
|
||||
# -PrecompileAll is only passed with the shader preparation on (switch_args): ticking it ticks that
|
||||
# too, and turning the preparation off turns it off, so the two boxes never say what does not run.
|
||||
# Selecting a full warm-up enables shader preparation. Disabling preparation clears both boxes.
|
||||
def precompile_all_ticked(*_):
|
||||
if self.vars["precompile_all"].get():
|
||||
self.vars["precompile"].set(True)
|
||||
|
||||
Reference in New Issue
Block a user