Skip to content

RM-190: Finish Plotting Core Function Set#232

Open
nallana wants to merge 40 commits intodevfrom
rm-190
Open

RM-190: Finish Plotting Core Function Set#232
nallana wants to merge 40 commits intodevfrom
rm-190

Conversation

@nallana
Copy link
Copy Markdown
Contributor

@nallana nallana commented Mar 26, 2026

Note

High Risk
Touches core plotting render and serialization paths, adding per-axes uniform state and new scene schema fields; regressions could affect subplot rendering correctness and backward compatibility of figure snapshots/scenes.

Overview
Expands plotting capabilities and scene serialization. Adds new plot kinds and metadata to the figure scene/event schema (e.g. line3, quiver, pie, richer errorbar/stem styling, area lower curve, surface image_mode + optional per-cell colors), plus per-axes metadata (limits, log modes, view angles, labels/styles, legend style, annotations, active axes).

Reworks subplot rendering to be truly per-axes. The renderer now maintains per-axes cameras, applies stored 3D view angles, fits extents per-axes (including honoring axes-specific limits/axis_equal), and uses per-axes uniform/direct-uniform/grid-uniform bind groups to avoid state bleed between subplots; subplot passes also force msaa_samples=1 to prevent resolves from overwriting other panels.

Adds GPU compute “packers” for more primitives. Introduces new WGPU compute shaders and Rust wrappers for generating vertex buffers on-GPU for area, errorbar, image (truecolor), line3, quiver, and stem.

Also bumps the TS bindings package version to 0.3.4 and updates exports to include pie labels in image/SVG exports.

Written by Cursor Bugbot for commit b0df409. This will update automatically on new commits. Configure here.

@nallana nallana requested review from finrunsfar and gneeri March 26, 2026 23:52
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
runmat Ready Ready Preview, Comment, Open in v0 Mar 30, 2026 7:22pm

Request Review

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Stem GPU buffer underallocated when baseline hidden
    • The bug was real, and I fixed it by making the stem vertex base offset conditional on baseline_visible so hidden-baseline draws no longer write past the allocated buffer.

Create PR

Or push these changes by commenting:

@cursor push 6b597cb148
Preview (6b597cb148)
diff --git a/crates/runmat-plot/src/gpu/shaders/stem.rs b/crates/runmat-plot/src/gpu/shaders/stem.rs
--- a/crates/runmat-plot/src/gpu/shaders/stem.rs
+++ b/crates/runmat-plot/src/gpu/shaders/stem.rs
@@ -74,7 +74,7 @@
         return;
     }
 
-    let base = 2u + i * 2u;
+    let base = select(0u, 2u, params.baseline_visible != 0u) + i * 2u;
     write_vertex(base, vec3<f32>(buf_x[i], params.baseline, 0.0), params.color);
     write_vertex(base + 1u, vec3<f32>(buf_x[i], buf_y[i], 0.0), params.color);
 }
@@ -156,7 +156,7 @@
         return;
     }
 
-    let base = 2u + i * 2u;
+    let base = select(0u, 2u, params.baseline_visible != 0u) + i * 2u;
     write_vertex(base, vec3<f32>(f32(buf_x[i]), params.baseline, 0.0), params.color);
     write_vertex(base + 1u, vec3<f32>(f32(buf_x[i]), f32(buf_y[i]), 0.0), params.color);
 }

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

entry_point: "main",
});
let baseline_count = if params.baseline_visible { 2 } else { 0 };
let vertex_count = baseline_count as u64 + inputs.len as u64 * 2;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stem GPU buffer underallocated when baseline hidden

High Severity

The GPU output buffer is too small when baseline_visible is false. The shader always writes stem vertices at base = 2u + i * 2u (reserving indices 0–1 for the baseline regardless of visibility), but the Rust allocator uses baseline_count + len * 2 which drops to len * 2 when the baseline is hidden. The last point writes at index 2*len + 1, exceeding the 2*len-sized buffer by 2 vertices — an out-of-bounds GPU storage write.

Additional Locations (1)
Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant