RUNTIME 2360: Shader cache: no default directory makes a memory-only device, never a failed one
With no caller directory and no home (USERPROFILE on Windows, HOME elsewhere), default_directory answered Err and CacheSetup::of turned it, and any failure to open the default path, into Error::ShaderCache, so every device creation and adoption failed. Metal never fails device creation over its shader cache, and the default is the runtime's choice, not the caller's (owner rule 2). - The Windows default is %LOCALAPPDATA%\metal2vulkan (the local application data folder, read from the environment; no new dependency). XDG_CACHE_HOME and USERPROFILE are no longer read there. - default_directory takes its environment as a closure (CacheSetup::of_in), so a test feeds its own without touching the process's. - Where the caller names no directory and the default does not exist or cannot be made or written, the device keeps its cache in memory alone: the Store has no directory, every lookup is absent, every write is refused with no filesystem call, the scans do nothing, and writers ask has_directory first so nothing is encoded for it (a translated function still is: its encoded length weighs it in the memo). The device says so once as it is made, as the existing degrade notice ShaderCacheEntryNotWritten naming why; each entry it does not write counts in write_failures. The driver's pipeline cache data is not read back, and the device checks' verdicts are not encoded. - A directory the caller names that cannot be used is still Error::ShaderCache. - Device::shader_cache_directory answers Option<&Path>: None for such a device. Docs: the shader_cache module docs, ShaderCacheOptions::directory, write_failures, Error::ShaderCache, the degradation's declaration and its docs/API.md entry, the runtime README (Windows default, error table), HOWTO, create.rs's list of environment variables. api_signatures re-blessed; docs/REFUSALS.md regenerated (a refusal's site function renamed). Tests: tests::shader_cache's default-directory and no-directory-store unit tests (plain gate), and the lavapipe/GPU device test shader_cache_no_directory: a device made with an empty environment and no caller directory is made, has no directory, makes four render states with two functions translated once, writes nothing, and its notice is heard once. Verified (msi): m3-max-32796 clippy plain 0, 67/67 shader_cache and degradation tests, api_signatures 0, clippy x86_64-pc-windows-gnullvm 0; m3-max-32797 (lavapipe) clippy m2v_cpu_icd 0, 61/61 shader_cache and in_place_check, including the no-directory device test.
This commit is contained in:
1 parent
9ce951f521
commit
5ba7afd9d4
25 files changed
+690
-210
No files matched your search
+5
-1
@@ -4320,7 +4320,11 @@ bound.
|
||||
`ShaderCacheEntryNotWritten`: an entry of the device's shader cache directory was not written --
|
||||
the directory, a temporary file in it or the rename over the entry failed, on the device's cache
|
||||
thread or on the thread that handed the entry over past the queue's bound. A full or read-only
|
||||
directory, a cap no entry fits in, or a write another process won. Nothing is ended by it: the
|
||||
directory, a cap no entry fits in, or a write another process won. Or the device has no
|
||||
directory: its `ShaderCacheOptions` named none and the platform's default does not exist (the
|
||||
variable it is found by is unset or not absolute) or takes no write, so the device keeps its
|
||||
cache in memory alone (`Device::shader_cache_directory` is `None`); that is announced as the
|
||||
device is made, naming the default directory and why. Nothing is ended by it: the
|
||||
pipeline state, the translation and the compile are made regardless. Announced once per device,
|
||||
naming the directory, its cap and the largest entry it takes; later failures are counted in
|
||||
`ShaderCacheStatistics::write_failures`. Cost: what the entry would hold is made again by the
|
||||
|
||||
Reference in new issue
Block a user