Skip to content

Commit 130aa8d

Browse files
authored
Merge pull request #114 from AdaWorldAPI/claude/ci-docs-and-clippy-install
fix(ci): missing docs in framebuffer.rs + install clippy/rustfmt for 1.94.0
2 parents 5bc7903 + 3c91843 commit 130aa8d

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ jobs:
4444
with:
4545
toolchain: ${{ matrix.rust }}
4646
components: clippy
47+
# rust-toolchain.toml pins 1.94.0 — install clippy for that toolchain too,
48+
# since dtolnay/rust-toolchain only installs for the requested matrix value.
49+
- run: rustup component add clippy --toolchain 1.94.0 || true
4750
- uses: Swatinem/rust-cache@v2
4851
- run: cargo clippy --features approx,serde,rayon -- -D warnings
4952
- run: cargo clippy --features native -- -D warnings
@@ -56,6 +59,8 @@ jobs:
5659
- uses: dtolnay/rust-toolchain@stable
5760
with:
5861
components: rustfmt
62+
# rust-toolchain.toml pins 1.94.0 — install rustfmt for that toolchain too.
63+
- run: rustup component add rustfmt --toolchain 1.94.0 || true
5964
- run: cargo fmt --all --check
6065

6166
nostd:

src/hpc/framebuffer.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,11 @@ pub enum ViewMode {
108108
/// Palette-indexed framebuffer. Each pixel is a u8 index into a palette
109109
/// whose size is determined by the SIMD tier.
110110
pub struct Framebuffer {
111+
/// Framebuffer width in pixels.
111112
pub width: usize,
113+
/// Framebuffer height in pixels.
112114
pub height: usize,
115+
/// Active palette tier (determines color count and sprite size).
113116
pub tier: PaletteTier,
114117
/// Row-major palette indices, length = width × height.
115118
pub pixels: Vec<u8>,
@@ -551,6 +554,7 @@ pub struct WobbleState {
551554
}
552555

553556
impl WobbleState {
557+
/// Allocate wobble state for `capacity` nodes (decay 0.92, amplitude 3.0).
554558
pub fn new(capacity: usize) -> Self {
555559
Self {
556560
displace: vec![0.0; capacity * 2],
@@ -613,6 +617,7 @@ pub struct FireState {
613617
}
614618

615619
impl FireState {
620+
/// Allocate fire state for `capacity` nodes (decay rate 16/tick).
616621
pub fn new(capacity: usize) -> Self {
617622
Self {
618623
intensity: vec![0u8; capacity],
@@ -755,19 +760,23 @@ pub struct FlybyFrame {
755760
pub packed: Vec<u64>,
756761
/// Bits per pixel used for packing.
757762
pub bpp: usize,
758-
/// Camera position at this keyframe.
763+
/// Camera X position at this keyframe.
759764
pub cam_x: f32,
765+
/// Camera Y position at this keyframe.
760766
pub cam_y: f32,
767+
/// Camera zoom factor at this keyframe.
761768
pub cam_zoom: f32,
762769
}
763770

764771
/// Ring buffer of pre-rendered flyby keyframes.
765772
pub struct FlybyCache {
773+
/// Pre-rendered keyframes in the orbit sequence.
766774
pub frames: Vec<FlybyFrame>,
767775
/// Current playback position in [0, frames.len()).
768776
pub cursor: usize,
769-
/// Width/height of pre-rendered frames.
777+
/// Width of pre-rendered frames.
770778
pub width: usize,
779+
/// Height of pre-rendered frames.
771780
pub height: usize,
772781
}
773782

@@ -843,9 +852,11 @@ impl FlybyCache {
843852
self.frames.iter().map(|f| f.packed.len() * 8).sum()
844853
}
845854

855+
/// Frame count.
846856
/// Frame count.
847857
pub fn len(&self) -> usize { self.frames.len() }
848858

859+
/// True when no keyframes have been pre-rendered.
849860
pub fn is_empty(&self) -> bool { self.frames.is_empty() }
850861
}
851862

@@ -1114,6 +1125,7 @@ pub struct PyramidShader {
11141125
}
11151126

11161127
impl PyramidShader {
1128+
/// Allocate the four-level pyramid (~9 MB total: L1=4K + L2=64K + L3=1M + L4=4M + scratch).
11171129
pub fn new(palette_max: u8) -> Self {
11181130
Self {
11191131
l1: vec![0u8; 64 * 64],

0 commit comments

Comments
 (0)