1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// SPDX-FileCopyrightText: Copyright (c) 2026 Mike Li/Mikewolfli/Wei Li(mikewolfli@163.com)
// SPDX-License-Identifier: MIT
//! Hardware-adaptive GPU management module.
//!
//! This module provides automatic GPU adapter selection, hardware-specific
//! buffer pool configuration, and performance monitoring with dynamic
//! quality adjustment.
//!
//! # Features
//!
//! - **Automatic GPU Detection**: Automatically selects the best available GPU
//! (discrete > integrated > CPU) with fallback chain
//! - **Hardware-Adaptive Buffer Pools**: Configures buffer pool parameters
//! based on detected GPU type
//! - **Performance Monitoring**: Monitors frame times and adjusts quality
//! dynamically based on hardware capabilities
//! - **Performance Trap Detection**: Detects performance issues and provides
//! user guidance
//!
//! # Example
//!
//! ```rust,no_run
//! use rust_widgets::gpu::{GpuManager, GpuManagerBuilder, AdapterSelectionStrategy};
//!
//! async fn setup_gpu() {
//! // Auto-detect best GPU
//! let manager = GpuManager::new().await.unwrap();
//!
//! println!("Using GPU: {}", manager.adapter_info().name);
//! println!("Mode: {:?}", manager.operation_mode());
//! }
//! ```
//!
//! # Reachability
//!
//! **State:** Production callers: `src/render/gpu/mod.rs:1` (the software renderer reads the GPU capability report).
//!
//! # Relationship to `crate::performance` (G-214)
//!
//! This module owns hardware adaptation and per-stage attribution: adapter
//! selection, hardware-adaptive buffer profiles, and
//! `performance::PerformanceStats` (frame classification, pressure, traps) used
//! to adjust quality. `crate::performance::profiler` owns per-section frame
//! timing (`FrameProfiler`/`Profiler`). The boundary is deliberate — the two
//! answer different questions — and each metric has exactly one statistics
//! endpoint: adaptive decisions read `performance::PerformanceStats`, never a
//! second frame table built here.
//!
//! # One backend answer (G-211)
//!
//! Adapter selection lives in `backend_ladder`; `GpuManager` publishes its
//! result (including `GpuBackendTier`) through
//! `publish_shared_selection`, so other GPU paths read the same answer with
//! `shared_selection` instead of running a second ladder.
/// Backend degradation ladder (`Primary` → OpenGL ES → software).
///
/// Gated on `gpu` because the module names `wgpu` types directly; builds without
/// that feature inherit no GPU path at all, so there is nothing to select.
// Re-export main types
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use TextureAtlas;