feat(render): GPU analytical rendering for circles, arcs, and ellipses

- Render planar circles, circular arcs, ellipses, and elliptical arcs analytically via GPU-instanced screen-space quads and WGSL shaders.
- Implement exact arc sweep clamping with round end caps matching the CAD wire shader.
- Implement robust Newton-Raphson closest-point solver for ellipses with isotropic screen-space derivative anti-aliasing.
- Integrate into wire pipeline and PersistentWireArena upload paths.
- Remove unused mesh_volume_centroid function in doc_api.
This commit is contained in:
Karim Jerbi committed 2026-09-07 13:50:12 +01:00
1 parent 143703d809
commit 0425f979f9
17 files changed
+1860 -40

No files matched your search

+23 -1
View File
@@ -853,6 +853,22 @@ impl shader::Primitive for Primitive {
&mut pipeline.block_geometry,
),
);
inner.gpu_circles = std::sync::Arc::new(
inner.upload_circles(
device,
queue,
&vp_wires,
&draw_depths,
),
);
inner.gpu_ellipses = std::sync::Arc::new(
inner.upload_ellipses(
device,
queue,
&vp_wires,
&draw_depths,
),
);
if _patched {
wire_arena::patch_handle_index(
&mut inner.wire_handle_index,
@@ -911,10 +927,14 @@ impl shader::Primitive for Primitive {
// Other panes retain their own references to shared geometry.
inner.gpu_wires = std::sync::Arc::new(Vec::new());
inner.gpu_block_wires = std::sync::Arc::new(Vec::new());
inner.gpu_circles = std::sync::Arc::new(Vec::new());
inner.gpu_ellipses = std::sync::Arc::new(Vec::new());
let held_before = pipeline.wire_buffer_cache.len();
pipeline.wire_buffer_cache.retain(|_, (w, b, _)| {
pipeline.wire_buffer_cache.retain(|_, (w, b, _, c, e)| {
std::sync::Arc::strong_count(w) > 1
|| std::sync::Arc::strong_count(b) > 1
|| std::sync::Arc::strong_count(c) > 1
|| std::sync::Arc::strong_count(e) > 1
});
if _perf {
crate::perf_record!(
@@ -959,6 +979,8 @@ impl shader::Primitive for Primitive {
inner.gpu_wires = built.0;
inner.gpu_block_wires = built.1;
inner.wire_handle_index = built.2;
inner.gpu_circles = built.3;
inner.gpu_ellipses = built.4;
} // end !arena_served
inner.cached_wire_id = vp.wire_content_id;
if _perf {