diff --git a/lib/src/core/frame.rs b/lib/src/core/frame.rs index 6a7303e..fad02ca 100644 --- a/lib/src/core/frame.rs +++ b/lib/src/core/frame.rs @@ -9,12 +9,16 @@ //! - **context**: provides the Surface from which Frame acquires the current texture. //! - **renderer**: passes Frame's TextureView to render() as the color attachment target. //! - **error**: does not use errors directly; Frame::new() panics on acquisition failure while -//! Frame::try_new() returns Option for graceful recovery. +//! Frame::try_new() returns `Option` for graceful recovery. //! //! ## Architecture Notes (per ARCHI_APP.md) //! - **Phase d'Exécution**: Frame is acquired at the start of each render loop iteration and released after rendering. //! - **Ergonomie**: Users interact with frames through Renderer::render() + Renderer::present(), not directly with wgpu handles. +/// A per-frame RAII wrapper around the surface texture and its `TextureView`. +/// Owned for the duration of a single render pass: acquired via `Frame::new()`/`try_new()` at the +/// start of each frame loop iteration, used by `Renderer` as the color attachment target, then +/// dropped after `present()` submits it to the GPU queue. pub struct Frame { /// The GPU surface texture representing the current display buffer to be presented. pub surface_texture: wgpu::SurfaceTexture, diff --git a/lib/src/lib.rs b/lib/src/lib.rs index c79d387..55f6863 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -25,6 +25,9 @@ //! use wsg_lib::utils::BASIC_SHADER; //! ``` +// Warn if a public API item has no rustdoc comment, keeping API coverage at 100%. +#![warn(missing_docs)] + pub mod app; pub mod core; pub mod handler; diff --git a/lib/src/pipeline/pipeline_cache.rs b/lib/src/pipeline/pipeline_cache.rs index 2d2bceb..a1fa444 100644 --- a/lib/src/pipeline/pipeline_cache.rs +++ b/lib/src/pipeline/pipeline_cache.rs @@ -198,7 +198,7 @@ impl PipelineCache { /// Retrieves a cached RenderPipeline by shader_id without creating one. /// Inputs: shader_id (unique key into the cache). - /// Returns Some(Arc) if found, None otherwise. Called by renderer code for pipeline inspection. + /// Returns Some(`Arc`) if found, None otherwise. Called by renderer code for pipeline inspection. pub fn get(&self, shader_id: &str) -> Option<&Arc> { self.pipelines.get(shader_id) } diff --git a/lib/src/resources/material.rs b/lib/src/resources/material.rs index 31c83a8..6a3f9a6 100644 --- a/lib/src/resources/material.rs +++ b/lib/src/resources/material.rs @@ -6,7 +6,7 @@ //! //! ## Architecture Notes (per ARCHI_APP.md) //! - **Identifiants**: Each Material is registered in Scene by string identifier, enabling dynamic access -//! during the render loop without borrow checker issues. The shader_id serves as the Handle key. +//! during the render loop without borrow checker issues. The shader_id serves as the `Handle` key. //! - **Phase de Déclaration**: Materials are instantiated once in the declarative phase before the render loop begins. use crate::pipeline::PipelineCache; diff --git a/lib/src/resources/mesh.rs b/lib/src/resources/mesh.rs index 970ead5..9b19aa1 100644 --- a/lib/src/resources/mesh.rs +++ b/lib/src/resources/mesh.rs @@ -5,7 +5,7 @@ //! //! ## Architecture Notes (per ARCHI_APP.md) //! - **Identifiants**: Each Mesh is registered in Scene by string identifier, enabling dynamic access -//! during the render loop without borrow checker issues. The identifier serves as the Handle key. +//! during the render loop without borrow checker issues. The identifier serves as the `Handle` key. //! - **Phase de Déclaration**: Meshes are instantiated once in the declarative phase before the render loop begins. //! - **Performance**: Multiple entities can reference the same Mesh, reducing memory footprint for repeated geometry. diff --git a/lib/src/resources/vertex.rs b/lib/src/resources/vertex.rs index 26d0f55..9176146 100644 --- a/lib/src/resources/vertex.rs +++ b/lib/src/resources/vertex.rs @@ -15,13 +15,13 @@ #[repr(C)] #[derive(Copy, Clone, Debug, bytemuck::Pod, bytemuck::Zeroable)] pub struct Vertex { - /// XYZ coordinates of this vertex in world space. Offset: 0 bytes (12 bytes total as [f32;3]). + /// XYZ coordinates of this vertex in world space. Offset: 0 bytes (12 bytes total as `[f32; 3]`). pub position: [f32; 3], - /// XYZ coordinates of the vertex normal. Offset: 12 bytes (12 bytes total as [f32;3]). + /// XYZ coordinates of the vertex normal. Offset: 12 bytes (12 bytes total as `[f32; 3]`). pub normal: [f32; 3], - /// UV texture coordinates. Offset: 24 bytes (8 bytes total as [f32;2]). + /// UV texture coordinates. Offset: 24 bytes (8 bytes total as `[f32; 2]`). pub uv: [f32; 2], - /// RGBA color values. Offset: 32 bytes (16 bytes total as [f32;4]). + /// RGBA color values. Offset: 32 bytes (16 bytes total as `[f32; 4]`). pub color: [f32; 4], } diff --git a/lib/src/scene/scene.rs b/lib/src/scene/scene.rs index 803662e..23ed115 100644 --- a/lib/src/scene/scene.rs +++ b/lib/src/scene/scene.rs @@ -6,7 +6,7 @@ //! ## Architecture Notes (per ARCHI_APP.md) //! - **La Recette**: Scene is central to the "App" facade workflow. In the Phase de Déclaration, users call add_mesh(), add_material(), and add_entity() //! to build the resource depot. During Phase d'Exécution, Renderer iterates Scene entities for rendering. -//! - **Identifiants**: All resource registration uses string identifiers (Handle/String pattern), guaranteeing memory safety +//! - **Identifiants**: All resource registration uses string identifiers (`Handle`/String pattern), guaranteeing memory safety //! and avoiding borrow checker issues during dynamic updates. //! - **Ergonomie**: Users interact only with entity-level operations (add/remove/get) rather than wgpu buffers/pipelines directly. @@ -18,9 +18,9 @@ use std::sync::Arc; /// and maps entity labels to their associated mesh+material pairs for rendering iteration. /// Created once during application setup; entities are added before the render loop starts. pub struct Scene { - /// Map of mesh identifiers to owned Arc instances. Populated via `add_mesh()`. + /// Map of mesh identifiers to owned `Arc` instances. Populated via `add_mesh()`. meshes: HashMap>, - /// Map of material identifiers to owned Arc instances. Populated via `add_material()`. + /// Map of material identifiers to owned `Arc` instances. Populated via `add_material()`. materials: HashMap>, /// Map of entity labels to (mesh_id, material_id) associations. Populated via `add_entity()`. entities: HashMap, diff --git a/lib/src/utils/error.rs b/lib/src/utils/error.rs index 70dae92..bd94d6b 100644 --- a/lib/src/utils/error.rs +++ b/lib/src/utils/error.rs @@ -8,7 +8,7 @@ //! ## 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). -//! - **frame** does not use errors — Frame::new() panics while Frame::try_new() returns Option. +//! - **frame** does not use errors — Frame::new() panics while Frame::try_new() returns `Option`. use thiserror::Error;