feat(setup): expanded cache step + GPU encoding step (#153, #154)#198
Merged
Conversation
Restructures the setup wizard from 4 steps to 4 steps with new shape:
- Step 3 (Cache Configuration): absorbs the old "system config" step.
Now prompts for cache directory, disk cache size, DDS disk ratio,
memory cache size, and I/O profile in one place. Defaults derive
from detected hardware:
- Disk cache: 25% of available space, floored to 10 GB (min 10 GB)
- Memory cache: RAM / 12, clamped to [500 MB, RAM / 4]
- DDS ratio: 0.6
- I/O profile: detected (NVMe / SSD / HDD), user can override
Memory cache formula replaces the previous tiered brackets
(8 GB cache @ 16 GB RAM was too large for an absorber-style cache).
Disk formula replaces a fixed 40 GB recommendation that ignored
free space.
- Step 4 (DDS Encoding): NEW. Enumerates GPU adapters via wgpu and:
- Skips silently when 0 or 1 adapter is present (keeps ISPC default).
- Presents ISPC + each detected GPU when 2+ adapters exist, with a
warning against picking X-Plane's render GPU.
- Maps the user's choice to texture.compressor + texture.gpu_device.
The selector keyword "integrated"/"discrete" is preferred when
the kind is unique; falls back to adapter name substring otherwise.
- Shows a spinner during the 10-30s wgpu probe.
Supporting changes:
- New `xearthlayer::system::gpu` module wraps wgpu enumeration with a
plain GpuAdapter type and config_value mapping. Used by the wizard;
available to other consumers (diagnostics report, future GTK UI).
- New `MIN_MEMORY_CACHE_BYTES` and `MIN_DISK_CACHE_BYTES` constants
in the recommendations module.
- `SystemInfo` now carries `cache_path_available_bytes` (statvfs at
detect time, walks up to existing ancestor when the cache dir
doesn't exist yet).
- `RecommendedSettings::for_system` signature gains `available_disk: u64`.
- Promote `KB / MB / GB` from inline private constants (5 redeclarations)
to public `xearthlayer::config::{KB, MB, GB}` SSOT.
- Updated tests reflecting the new formulas.
- docs/configuration.md describes the new four-step wizard flow.
Fixes #153
Fixes #154
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pull all wgpu enumeration and selection logic into system::gpu so the wizard (writes config), encoder (reads config), and diagnostics report (prints adapters) share one implementation. Changes: - system::gpu gains enumerate_raw() returning live wgpu::Adapter handles, find_adapter() returning a selected adapter by gpu_device string, and GpuSelectError as the typed error. - GpuAdapter::from_wgpu factories the metadata-only record from a live wgpu::Adapter; enumerate() now delegates to enumerate_raw().mapped. - New pure select_index() function operates on metadata-only [GpuAdapter] so the selection logic is testable without a real GPU. - New round-trip test asserts that for every adapter in five realistic enumeration shapes, GpuAdapter::config_value(all) round-trips back to the same adapter via select_index(all, value). This locks the inverse- function relationship between the wizard's adapter→config-string mapping and the encoder's config-string→adapter mapping. - dds/compressor.rs::create_gpu_resources now delegates enumeration and selection to system::gpu, dropping the duplicated wgpu instance setup and the now-dead select_adapter helper. - diagnostics/report.rs renders "## GPU Compute Adapters" via the shared system::gpu::enumerate(), eliminating the third copy of the wgpu instance/enumerate boilerplate. Format shifts from "(DiscreteGpu, Vulkan)" to "(Discrete, vulkan)" — slightly cleaner human-readable output. Net: -57 LOC of duplication removed, +95 LOC added in system::gpu (mostly the 5-scenario round-trip test). Two duplicate wgpu instance setups collapsed into one. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Owner
Author
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Restructures the
xearthlayer setupwizard to expand the cache configuration step (#154) and add a new DDS encoding / GPU selection step (#153). Both issues touch the same module so they ship together.Step 3 — Cache Configuration (expanded, #154)
Absorbs the old "system config" step. Now prompts in one place for:
~/.xearthlayer/cacheThe new memory formula matches the documented intent of the memory cache as a small request absorber rather than a working set holder (the on-disk DDS cache is the working set).
Step 4 — DDS Encoding (new, #153)
texture.compressorandtexture.gpu_device, preferring the kind keyword (integrated/discrete) when unique, falling back to adapter name substring otherwise (handles dual-discrete setups).Supporting refactors
xearthlayer::system::gpumodule wraps wgpu enumeration with a plainGpuAdaptertype. Reusable by diagnostics report and future GUI consumers.MIN_MEMORY_CACHE_BYTES(500 MB) andMIN_DISK_CACHE_BYTES(10 GB) constants.SystemInfonow carriescache_path_available_bytes(statvfs at detect time, walks up to existing ancestor when the cache dir doesn't exist yet).RecommendedSettings::for_systemsignature gainsavailable_disk: u64.KB / MB / GBfrom 5 inline private re-declarations to publicxearthlayer::config::{KB, MB, GB}. SSOT for size constants.system::recommendations, 5 new insystem::gpu).docs/configuration.mddescribes the new four-step wizard flow.Test plan
cargo test— 2415 unit tests + 63 doctests passmake pre-commit— fmt + clippy + tests cleanFixes #153
Fixes #154
🤖 Generated with Claude Code