Skip to content

Commit 84b33b8

Browse files
committed
update deps
1 parent 05a287e commit 84b33b8

11 files changed

Lines changed: 2451 additions & 1241 deletions

File tree

Cargo.lock

Lines changed: 2385 additions & 1168 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

altium-macros/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ proc-macro2 = "1.0.85"
1515
quote = "1.0.36"
1616
regex = "1.10.4"
1717
syn = "2.0.66"
18-
# syn = { version = "2.0.22", features = ["extra-traits"] }
1918

2019
[package.metadata.release]
2120
shared-version = true

drawsvg/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ version = "0.1.0"
44
edition = "2021"
55
publish = false
66

7-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8-
97
[dependencies]
108
paste = "1.0.14"
119
convert_case = "0.6.0"

ecadg/Cargo.toml

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,19 @@ name = "ecadg"
33
version = "0.1.0"
44
edition = "2021"
55

6-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7-
86
[dependencies]
97
altium = { path = "../altium", version = "0.2.1", features = ["_sealed"] }
10-
# FIXME: use wgpu 0.20 when available <https://github.com/emilk/egui/pull/4560>
11-
# egui = "0.27.2"
12-
# egui_extras = "0.27.2"
13-
# egui_plot = "0.27.2"
14-
egui = { git = "https://github.com/emilk/egui.git", branch = "emilk/wgpu-0.20"}
15-
egui_extras = { git = "https://github.com/emilk/egui.git", branch = "emilk/wgpu-0.20"}
16-
egui_plot = { git = "https://github.com/emilk/egui.git", branch = "emilk/wgpu-0.20"}
8+
egui = "0.33.3"
9+
egui_extras = "0.33.3"
10+
egui_plot = "0.34.1"
11+
eframe = { version = "0.33.3", features = ["wgpu", "persistence"] }
1712
log = "0.4.21"
1813
serde = "1.0.203"
1914
rfd = "0.14.1"
2015
regex = "1.10.4"
2116
bytemuck = "1.16.0"
2217
lyon = "1.0.1"
23-
# FIXME: don't use git once there is a new release, <https://github.com/grovesNL/glyphon/issues/94>
24-
# glyphon = "0.5.0"
25-
glyphon = { git = "https://github.com/grovesNL/glyphon.git", ref = "2a457087674b0c124d37c85bc6769ba27dcde173"}
26-
27-
[dependencies.eframe]
28-
# version = "0.27.2"
29-
git = "https://github.com/emilk/egui.git"
30-
branch = "emilk/wgpu-0.20"
31-
reg = "3dca4c667f30fe7199433d3607efbe15c76a1cb6"
32-
default-features = false
33-
features = [
34-
"accesskit", # Make egui comptaible with screen readers. NOTE: adds a lot of dependencies.
35-
"default_fonts", # Embed the default egui fonts.
36-
"wgpu", # Use the wgpu backend rather than glow
37-
"wayland",
38-
"persistence", # Enable restoring app state when restarting the app.
39-
"x11",
40-
]
18+
glyphon = "0.10.0"
4119

4220
[features]
4321
default = ["_debug"]

ecadg/src/draw.rs

Lines changed: 41 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
use std::ops::{Deref, DerefMut};
1+
use std::{
2+
cell::Cell,
3+
ops::{Deref, DerefMut},
4+
};
25

36
use altium::draw::{
47
Canvas,
@@ -15,10 +18,22 @@ use eframe::egui;
1518
use egui::{Align2, Color32, RichText, Stroke};
1619
use egui_plot::{Line, PlotPoint, PlotPoints, PlotUi, Polygon, Text};
1720

18-
pub struct PlotUiWrapper<'a>(pub &'a mut PlotUi);
21+
/// Names must be unique, so just use a counter.
22+
macro_rules! inc_id {
23+
($name:literal) => {{
24+
thread_local! {
25+
static INDEX: Cell<u64> = Cell::new(0);
26+
}
27+
let idx = INDEX.get();
28+
INDEX.set(idx + 1);
29+
format!("{}{idx:06}", $name)
30+
}};
31+
}
32+
33+
pub struct PlotUiWrapper<'a>(pub &'a mut PlotUi<'a>);
1934

20-
impl Deref for PlotUiWrapper<'_> {
21-
type Target = PlotUi;
35+
impl<'a> Deref for PlotUiWrapper<'a> {
36+
type Target = PlotUi<'a>;
2237

2338
fn deref(&self) -> &Self::Target {
2439
self.0
@@ -36,36 +51,42 @@ impl altium::sealed::Sealed for PlotUiWrapper<'_> {}
3651
impl Canvas for PlotUiWrapper<'_> {
3752
fn draw_text(&mut self, item: DrawText) {
3853
let txt = RichText::new(item.text).size(f32::from(item.font.size()) * 2.0);
39-
// let txt = RichText::new(item.text).size(f32::from(item.font.size()) * 13.8);
54+
let txt = RichText::new(item.text).size(f32::from(item.font.size()) * 13.8);
4055
self.text(
41-
Text::new(PlotPoint::new(item.x, item.y), txt)
56+
Text::new(inc_id!("canvas.text"), PlotPoint::new(item.x, item.y), txt)
4257
.anchor(to_align2(item.anchor_v, item.anchor_h))
4358
.color(to_c32(item.color)),
4459
);
4560
}
4661

4762
fn draw_line(&mut self, item: DrawLine) {
4863
self.line(
49-
Line::new(vec![
50-
[f64::from(item.start.x()), f64::from(item.start.y())],
51-
[f64::from(item.end.x()), f64::from(item.end.y())],
52-
])
64+
Line::new(
65+
inc_id!("canvas.line"),
66+
vec![
67+
[f64::from(item.start.x()), f64::from(item.start.y())],
68+
[f64::from(item.end.x()), f64::from(item.end.y())],
69+
],
70+
)
5371
.color(to_c32(item.color))
5472
.width(item.width as f32),
5573
);
5674
}
5775

5876
fn draw_rectangle(&mut self, item: DrawRectangle) {
59-
let poly = Polygon::new(vec![
60-
[f64::from(item.x), f64::from(item.y)],
61-
[f64::from(item.x + item.width), f64::from(item.y)],
62-
[
63-
f64::from(item.x + item.width),
64-
f64::from(item.y + item.height),
77+
let poly = Polygon::new(
78+
inc_id!("canvas.rect"),
79+
vec![
80+
[f64::from(item.x), f64::from(item.y)],
81+
[f64::from(item.x + item.width), f64::from(item.y)],
82+
[
83+
f64::from(item.x + item.width),
84+
f64::from(item.y + item.height),
85+
],
86+
[f64::from(item.x), f64::from(item.y + item.height)],
87+
[f64::from(item.x), f64::from(item.y)],
6588
],
66-
[f64::from(item.x), f64::from(item.y + item.height)],
67-
[f64::from(item.x), f64::from(item.y)],
68-
])
89+
)
6990
.stroke(Stroke {
7091
// width: f32::from(item.stroke_width) * 20.0,
7192
width: 10.0,
@@ -80,6 +101,7 @@ impl Canvas for PlotUiWrapper<'_> {
80101

81102
fn draw_polygon(&mut self, item: DrawPolygon) {
82103
let poly = Polygon::new(
104+
inc_id!("canvas.poly"),
83105
item.locations
84106
.iter()
85107
.map(|loc| [f64::from(loc.x()), f64::from(loc.y())])

ecadg/src/gfx.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ impl egui_wgpu::CallbackTrait for SchLibCallback {
8888
fn paint<'a>(
8989
&'a self,
9090
_info: PaintCallbackInfo,
91-
render_pass: &mut RenderPass<'a>,
91+
render_pass: &mut RenderPass<'static>,
9292
resources: &'a CallbackResources,
9393
) {
9494
let ctx: &GraphicsCtx = resources.get().unwrap();
@@ -150,7 +150,7 @@ impl egui_wgpu::CallbackTrait for SchDocCallback {
150150
fn paint<'a>(
151151
&'a self,
152152
_info: PaintCallbackInfo,
153-
render_pass: &mut RenderPass<'a>,
153+
render_pass: &mut RenderPass<'static>,
154154
resources: &'a CallbackResources,
155155
) {
156156
let ctx: &GraphicsCtx = resources.get().unwrap();

ecadg/src/gfx/grid.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl Default for GridUniformBuf {
4747
/// Data that can be selected for each run of the pipeline
4848
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
4949
#[repr(C, align(16))]
50-
pub struct GridInstanceBuf {
50+
struct GridInstanceBuf {
5151
/// Multiplier of spacing to make major and minor grids
5252
spacing_mult: f32,
5353
/// Unused
@@ -197,14 +197,14 @@ impl GridCtx {
197197
layout: Some(&pipeline_layout),
198198
vertex: wgpu::VertexState {
199199
module: &shader,
200-
entry_point: "vs_main",
200+
entry_point: Some("vs_main"),
201201
// buffers: &[],
202202
buffers: &[GridInstanceBuf::desc()],
203203
compilation_options: wgpu::PipelineCompilationOptions::default(),
204204
},
205205
fragment: Some(wgpu::FragmentState {
206206
module: &shader,
207-
entry_point: "fs_main",
207+
entry_point: Some("fs_main"),
208208
targets: &[Some(render_state.target_format.into())],
209209
compilation_options: wgpu::PipelineCompilationOptions::default(),
210210
}),
@@ -215,6 +215,7 @@ impl GridCtx {
215215
depth_stencil: None,
216216
multisample: wgpu::MultisampleState::default(),
217217
multiview: None,
218+
cache: None,
218219
});
219220

220221
Self {
@@ -264,7 +265,7 @@ impl GridCtx {
264265
}
265266

266267
/// Draw needed lines
267-
pub fn paint<'a>(&'a self, render_pass: &mut RenderPass<'a>, vs: ViewState) {
268+
pub fn paint<'a>(&'a self, render_pass: &mut RenderPass<'static>, vs: ViewState) {
268269
render_pass.set_pipeline(&self.pipeline);
269270
render_pass.set_bind_group(0, &self.bind_group, &[]);
270271
render_pass.set_vertex_buffer(0, self.instance_buffer.slice(..));

ecadg/src/gfx/origin.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ impl Default for OriginUniformBuf {
3939
pub struct OriginCtx {
4040
uniform_buffer: wgpu::Buffer,
4141
uniform_buffer_data: OriginUniformBuf,
42-
instance_buffer: wgpu::Buffer,
4342
bind_group: wgpu::BindGroup,
4443
pipeline: wgpu::RenderPipeline,
4544
}
@@ -55,12 +54,6 @@ impl OriginCtx {
5554
usage: wgpu::BufferUsages::UNIFORM | wgpu::BufferUsages::COPY_DST,
5655
});
5756

58-
let instance_buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
59-
label: Some("origin_instance"),
60-
contents: &[],
61-
usage: wgpu::BufferUsages::VERTEX,
62-
});
63-
6457
let bind_group_layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
6558
label: Some("origin_uniform_layout"),
6659
entries: &[wgpu::BindGroupLayoutEntry {
@@ -100,27 +93,27 @@ impl OriginCtx {
10093
layout: Some(&pipeline_layout),
10194
vertex: wgpu::VertexState {
10295
module: &shader,
103-
entry_point: "vs_main",
96+
entry_point: Some("vs_main"),
10497
buffers: &[],
10598
compilation_options: wgpu::PipelineCompilationOptions::default(),
10699
},
107100
fragment: Some(wgpu::FragmentState {
108101
module: &shader,
109-
entry_point: "fs_main",
102+
entry_point: Some("fs_main"),
110103
targets: &[Some(render_state.target_format.into())],
111104
compilation_options: wgpu::PipelineCompilationOptions::default(),
112105
}),
113106
primitive: wgpu::PrimitiveState::default(),
114107
depth_stencil: None,
115108
multisample: wgpu::MultisampleState::default(),
116109
multiview: None,
110+
cache: None,
117111
});
118112

119113
Self {
120114
uniform_buffer,
121115
bind_group,
122116
pipeline,
123-
instance_buffer,
124117
uniform_buffer_data: OriginUniformBuf::default(),
125118
}
126119
}
@@ -142,10 +135,9 @@ impl OriginCtx {
142135
}
143136

144137
/// Draw needed triangles
145-
pub fn paint<'a>(&'a self, render_pass: &mut RenderPass<'a>, _vs: ViewState) {
138+
pub fn paint<'a>(&'a self, render_pass: &mut RenderPass<'static>, _vs: ViewState) {
146139
render_pass.set_pipeline(&self.pipeline);
147140
render_pass.set_bind_group(0, &self.bind_group, &[]);
148-
render_pass.set_vertex_buffer(0, self.instance_buffer.slice(..));
149141
render_pass.draw(0..12, 0..1);
150142
}
151143
}

ecadg/src/gfx/tessellated.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,14 +259,14 @@ impl TessCtx {
259259
layout: Some(&pipeline_layout),
260260
vertex: wgpu::VertexState {
261261
module: &shader,
262-
entry_point: "vs_main",
262+
entry_point: Some("vs_main"),
263263
buffers: &[TessVertex::desc()],
264264
// buffers: &[TessVertex::desc(), TessVertex::desc()],
265265
compilation_options: wgpu::PipelineCompilationOptions::default(),
266266
},
267267
fragment: Some(wgpu::FragmentState {
268268
module: &shader,
269-
entry_point: "fs_main",
269+
entry_point: Some("fs_main"),
270270
// targets: &[Some(wgpu::ColorTargetState {
271271
// format: wgpu::TextureFormat::Bgra8Unorm,
272272
// blend: None,
@@ -292,6 +292,7 @@ impl TessCtx {
292292
},
293293
// multisample: wgpu::MultisampleState::default(),
294294
multiview: None,
295+
cache: None,
295296
});
296297

297298
Self {
@@ -389,7 +390,7 @@ impl TessCtx {
389390
}
390391

391392
/// Draw needed triangles
392-
pub fn paint<'a>(&'a self, render_pass: &mut RenderPass<'a>, _vs: ViewState) {
393+
pub fn paint<'a>(&'a self, render_pass: &mut RenderPass<'static>, _vs: ViewState) {
393394
if !self.needs_render() {
394395
debug!("skipping tessellation paint");
395396
return;

ecadg/src/gfx/triangle.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,21 @@ impl TriangleCtx {
5858
layout: Some(&pipeline_layout),
5959
vertex: wgpu::VertexState {
6060
module: &shader,
61-
entry_point: "vs_main",
61+
entry_point: Some("vs_main"),
6262
buffers: &[],
6363
compilation_options: wgpu::PipelineCompilationOptions::default(),
6464
},
6565
fragment: Some(wgpu::FragmentState {
6666
module: &shader,
67-
entry_point: "fs_main",
67+
entry_point: Some("fs_main"),
6868
targets: &[Some(render_state.target_format.into())],
6969
compilation_options: wgpu::PipelineCompilationOptions::default(),
7070
}),
7171
primitive: wgpu::PrimitiveState::default(),
7272
depth_stencil: None,
7373
multisample: wgpu::MultisampleState::default(),
7474
multiview: None,
75+
cache: None,
7576
});
7677

7778
Self {

0 commit comments

Comments
 (0)