fix(play): NVIDIA's shader cache on its Driver Default (1 GB) is raised and offered, not taken for a driver without the setting #264

Merged
HumanBean merged 1 commit from Mone/LongshotLauncher:fix/nvidia-cache-default into main 2026-11-25 15:16:38 +00:00
Contributor

On a PC that never changed NVIDIA's Shader Cache Size, the launcher's 10 GB raise (#243) and the home's card never happened: the driver's Driver Default was read as "this driver does not know the setting". That is the most common case, and it left the game building tens of thousands of pipelines again before its title.

What changed

  • NvApiProfiles.ShaderCache reads NVAPI_SETTING_NOT_FOUND (-160) for a setting the driver knows (NvAPI_DRS_GetSettingNameFromId names it) as its Driver Default: the cache on, and its size DriverSettings.DriverDefaultCacheMb (1 GB, the 1025 MB caches players' logs show). Only a setting the driver does not name stays "unknown" (null), as before.
  • The logic is in DriverSettings.SettingOrDefault, testable without a driver.
  • Nothing else changes: ShaderCacheShort, RaiseShaderCache, the 4 GB threshold and the 10 GB raise are as they were, and now reach these players.

How it was found

RTX 4050 Laptop GPU (with Intel Iris Xe), Windows 11, Shader Cache Size never touched. The game's log at a start after a rebuild: driver shader cache at the start: 0 MB, driver shader cache: NVIDIA's limit not known, the driver's shader cache has 0 of 44 noted pipelines asked: it lost them, then 40,749 noted pipelines built before the title (~9 minutes). An earlier start had 1025 MB at the start; after this one the cache folder was at 1026.6 MB again: held at 1 GB.

A read-only probe of the driver: PS_SHADERDISKCACHE_MAX_SIZE (0x00AC8497) and PS_SHADERDISKCACHE (0x00198FFF) are both in NvAPI_DRS_EnumAvailableSettingIds, and NvAPI_DRS_GetSetting on the global profile answers -160 for both.

Testing

Tested

  • dotnet build LongshotLauncher.slnx -c Release: 0 warnings, 0 errors; the app tests (tests/launcher_app) pass.
  • NvidiaCacheChecks (extended): a set size read as it is; Driver Default read as 1 GB; a setting the driver does not know stays none; Driver Default's 1 GB is offered and raised to 10 GB. Its real-driver read-only check passes on this PC.
  • The fixed code against this PC's driver (read only): before, size null and no offer; now 1024 MB, ShaderCacheShort = 1024.

Still to test

  • The home's card and the raise before Play on a PC on Driver Default, end to end (#265 set this PC's cache through Settings instead).
  • Other drivers whose Driver Default is larger than 1 GB, if any: they would be offered 10 GB once.
  • On this Windows PC the core suite stops at SavesChecks, and scripts/translations.py reports catalog texts left over: both on main as it is too (clean checkout of 6887d57), not from this change.
On a PC that never changed NVIDIA's Shader Cache Size, the launcher's 10 GB raise (#243) and the home's card never happened: the driver's Driver Default was read as "this driver does not know the setting". That is the most common case, and it left the game building tens of thousands of pipelines again before its title. ## What changed - `NvApiProfiles.ShaderCache` reads `NVAPI_SETTING_NOT_FOUND` (-160) for a setting the driver knows (`NvAPI_DRS_GetSettingNameFromId` names it) as its **Driver Default**: the cache on, and its size `DriverSettings.DriverDefaultCacheMb` (1 GB, the 1025 MB caches players' logs show). Only a setting the driver does not name stays "unknown" (null), as before. - The logic is in `DriverSettings.SettingOrDefault`, testable without a driver. - Nothing else changes: `ShaderCacheShort`, `RaiseShaderCache`, the 4 GB threshold and the 10 GB raise are as they were, and now reach these players. ## How it was found RTX 4050 Laptop GPU (with Intel Iris Xe), Windows 11, Shader Cache Size never touched. The game's log at a start after a rebuild: `driver shader cache at the start: 0 MB`, `driver shader cache: NVIDIA's limit not known`, `the driver's shader cache has 0 of 44 noted pipelines asked: it lost them`, then 40,749 noted pipelines built before the title (~9 minutes). An earlier start had `1025 MB` at the start; after this one the cache folder was at 1026.6 MB again: held at 1 GB. A read-only probe of the driver: `PS_SHADERDISKCACHE_MAX_SIZE` (0x00AC8497) and `PS_SHADERDISKCACHE` (0x00198FFF) are both in `NvAPI_DRS_EnumAvailableSettingIds`, and `NvAPI_DRS_GetSetting` on the global profile answers -160 for both. ## Testing **Tested** - `dotnet build LongshotLauncher.slnx -c Release`: 0 warnings, 0 errors; the app tests (`tests/launcher_app`) pass. - `NvidiaCacheChecks` (extended): a set size read as it is; Driver Default read as 1 GB; a setting the driver does not know stays none; Driver Default's 1 GB is offered and raised to 10 GB. Its real-driver read-only check passes on this PC. - The fixed code against this PC's driver (read only): before, size null and no offer; now 1024 MB, `ShaderCacheShort` = 1024. **Still to test** - The home's card and the raise before Play on a PC on Driver Default, end to end (#265 set this PC's cache through Settings instead). - Other drivers whose Driver Default is larger than 1 GB, if any: they would be offered 10 GB once. - On this Windows PC the core suite stops at `SavesChecks`, and `scripts/translations.py` reports catalog texts left over: both on `main` as it is too (clean checkout of 6887d57), not from this change.
fix(play): NVIDIA's shader cache on its Driver Default (1 GB) is raised and offered, not taken for a driver without the setting
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Compile and test (pull_request) Blocked by required conditions
a20f2fcc9b
A player who never changed Shader Cache Size has no such setting in the driver's global profile: NvAPI_DRS_GetSetting answers
NVAPI_SETTING_NOT_FOUND (-160), which the launcher read as "this driver does not know the setting". So the 10 GB raise before
Play and builds, and the home's card that asks for an administrator, never happened for them, the most common case.

Now -160 for a setting the driver knows (NvAPI_DRS_GetSettingNameFromId names it) is its Driver Default: on for the cache,
1 GB for its size (DriverSettings.DriverDefaultCacheMb, the 1025 MB caches players' logs show). On an RTX 4050 Laptop the
cache stayed at 1025 MB, and after a rebuild the game built its 40,749 noted pipelines again before the title (~9 minutes):
the launcher now reads 1024 MB there and offers 10 GB.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HumanBean deleted branch fix/nvidia-cache-default 2026-11-25 15:16:38 +00:00
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Compile and test (pull_request) Blocked by required conditions
Some workflows are waiting to be reviewed.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/LongshotLauncher!264
No description provided.