diff --git a/crates/renderer/src/lib.rs b/crates/renderer/src/lib.rs index 036305b..0b9adad 100644 --- a/crates/renderer/src/lib.rs +++ b/crates/renderer/src/lib.rs @@ -37,6 +37,7 @@ impl Renderer { /// # Panics /// /// Panics if `MAX_FRAMES_IN_FLIGHT` or vertex data sizes exceed `u32`/`u64` limits. + // TODO: partial-construction leak. Each `?` below early-returns and leaks every Vulkan resource created so far; only a fully successful `new` reaches `Drop for Renderer`. Once the renderer grows more state, wrap each resource in an RAII guard so failure paths tear them down too. #[allow(clippy::expect_used)] pub fn new( display_handle: RawDisplayHandle, diff --git a/crates/renderer/src/mesh.rs b/crates/renderer/src/mesh.rs index 6c4c8ec..4d93cbf 100644 --- a/crates/renderer/src/mesh.rs +++ b/crates/renderer/src/mesh.rs @@ -10,7 +10,6 @@ use bytemuck::{Pod, Zeroable}; #[derive(Copy, Clone, Debug, Pod, Zeroable)] pub struct Vertex { /// 3D position of the vertex (X, Y, Z). - /// The position coordinates of the vertex [x, y, z]. pub position: [f32; 3], /// The RGB color of the vertex [r, g, b]. pub color: [f32; 3], @@ -19,8 +18,7 @@ pub struct Vertex { impl Vertex { /// Describes how Vulkan should read the vertex data from a buffer. /// - /// This defines the 'stride' (distance between vertices) and specifies that - /// data is read per-vertex rather than per-instance. + /// This defines the 'stride' (distance between vertices) and specifies that data is read per-vertex rather than per-instance. /// /// # Panics /// Panics if the size of the vertex structure exceeds the maximum value of a 32-bit unsigned integer. diff --git a/crates/renderer/src/pipeline.rs b/crates/renderer/src/pipeline.rs index 5c49fa1..62c996e 100644 --- a/crates/renderer/src/pipeline.rs +++ b/crates/renderer/src/pipeline.rs @@ -7,8 +7,7 @@ use std::io::Cursor; /// Helper to load SPIR-V bytes and create a Vulkan Shader Module. /// -/// Vulkan expects shader code to be 32-bit aligned; `ash::util::read_spv` is -/// used to correctly interpret the raw bytes as a slice of `u32`. +/// Vulkan expects shader code to be 32-bit aligned; `ash::util::read_spv` is used to correctly interpret the raw bytes as a slice of `u32`. pub fn create_shader_module( device: &Device, bytes: &[u8], @@ -25,11 +24,9 @@ pub fn create_shader_module( /// Defines the 'interface' of the pipeline (what data we can pass to the shaders). /// -/// This layout defines any push constants or descriptor sets (textures/UBOs) -/// accessed by the shaders during execution. +/// This layout defines any push constants or descriptor sets (textures/UBOs) accessed by the shaders during execution. pub fn create_pipeline_layout(device: &Device) -> Result { - // A single push constant range is defined for the Model-View-Projection matrix. - // This allows the matrix to be updated for every draw call with high efficiency. + // A single push constant range is defined for the MVP matrix, allowing it to be updated for every draw call with high efficiency. #[allow(clippy::expect_used)] let push_constant_range = vk::PushConstantRange::default() .stage_flags(vk::ShaderStageFlags::VERTEX) @@ -47,8 +44,7 @@ pub fn create_pipeline_layout(device: &Device) -> Result