ajout material et pipeline_cache
This commit is contained in:
+16
-10
@@ -1,7 +1,13 @@
|
||||
//! # Error Module
|
||||
//!
|
||||
//! Defines `WsgError`, the application-level error type for all WGPU operations.
|
||||
//! Every variant maps a specific failure mode to a user-friendly message via `thiserror`.
|
||||
//! Defines `WsgError`, the application-level error type for all WGPU operations in Context and Renderer methods.
|
||||
//! Every variant maps a specific failure mode to a user-friendly message via `thiserror`. Errors propagate up through
|
||||
//! Context's GPU initialization/rendering flow back to the orchestrator (main.rs), which handles them by skipping frames,
|
||||
//! reconfiguring surfaces, or crashing gracefully.
|
||||
//!
|
||||
//! ## Interaction with Other Modules
|
||||
//! - **context** uses WsgError as return types for `new()`, `configure()`, and `begin_frame()`.
|
||||
//! - **renderer** does not use errors directly (render panics on invalid state rather than returning Result).
|
||||
|
||||
use thiserror::Error;
|
||||
|
||||
@@ -34,8 +40,8 @@ pub enum WsgError {
|
||||
ShaderError(String),
|
||||
|
||||
/// An internal WGPU error propagated from a device request failure.
|
||||
/// Automatically converted via `thiserror`'s `#[from]`.
|
||||
/// Caller: `Context::new()` — maps `wgpu::RequestDeviceError` into this variant.
|
||||
/// Automatically converted via `thiserror`'s `#[from]` from `wgpu::RequestDeviceError`.
|
||||
/// Caller: `Context::new()` — maps the wgpu error into this variant automatically.
|
||||
#[error("Internal WGPU error: {0}")]
|
||||
InternalWgpu(#[from] wgpu::RequestDeviceError),
|
||||
|
||||
@@ -51,28 +57,28 @@ pub enum WsgError {
|
||||
#[error("No compatible render format or alpha mode found for the surface")]
|
||||
SurfaceIncompatible,
|
||||
|
||||
/// A timeout was encountered while acquiring a surface texture. Skip this frame and retry.
|
||||
/// A timeout was encountered while acquiring a surface texture. Skip this frame and retry. Caller: `Context::begin_frame()`.
|
||||
#[error("Frame acquisition timed out")]
|
||||
FrameTimeout,
|
||||
|
||||
/// The window is occluded (minimized or behind another window). Skip until visible.
|
||||
/// The window is occluded (minimized or behind another window). Skip until visible. Caller: `Context::begin_frame()`.
|
||||
#[error("Window is occluded")]
|
||||
Occluded,
|
||||
|
||||
/// The underlying surface changed — call configure() before retrying.
|
||||
/// The underlying surface changed — call configure() before retrying. Caller: `Context::begin_frame()` on surface mismatch.
|
||||
#[error("Surface configuration outdated; reconfigure required")]
|
||||
Outdated,
|
||||
|
||||
/// The surface has been lost and needs to be recreated.
|
||||
/// The surface has been lost and needs to be recreated. Caller: `Context::begin_frame()` on surface loss.
|
||||
#[error("Surface lost")]
|
||||
Lost,
|
||||
|
||||
/// A validation error inside get_current_texture() was raised.
|
||||
/// A validation error inside get_current_texture() was raised. Caller: `Context::begin_frame()`.
|
||||
#[error("Validation error during frame acquisition")]
|
||||
Validation,
|
||||
|
||||
/// Successfully acquired the surface texture but it no longer matches the surface properties.
|
||||
/// Reconfigure recommended for optimal performance.
|
||||
/// Reconfigure recommended for optimal performance. Caller: `Context::begin_frame()` on suboptimal acquire.
|
||||
#[error("Acquired suboptimal surface texture; reconfigure recommended")]
|
||||
SuboptimalTexture,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user