Skip to content

Commit

Permalink
Fix inference conflict with serde_json through schemars feature (#…
Browse files Browse the repository at this point in the history
…733)

Initially marking as a draft, because this currently just fiddles with
Cargo.toml to ensure that CI tests the feature.
this shouldn't actually require any changes to our CI scripts to
trigger, and as Daniel suggested, this uses a feature on with_winit
rather than vello itself.

Will follow up with the actual fix once I've confirmed CI fails.

---------

Co-authored-by: Daniel McNab <[email protected]>
  • Loading branch information
ratmice and DJMcNab authored Nov 9, 2024
1 parent 0bef450 commit 92f3ddc
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 1 deletion.
44 changes: 44 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ vello_encoding = { version = "0.3.0", path = "vello_encoding" }
vello_shaders = { version = "0.3.0", path = "vello_shaders" }
bytemuck = { version = "1.18.0", features = ["derive"] }
skrifa = "0.22.3"
# The version of kurbo used below should be kept in sync
# with the version of kurbo used by peniko.
peniko = "0.2.0"
# FIXME: This can be removed once peniko supports the schemars feature.
kurbo = "0.11.1"
futures-intrusive = "0.5.0"
raw-window-handle = "0.6.2"
smallvec = "1.13.2"
Expand Down
4 changes: 4 additions & 0 deletions examples/with_winit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ default = ["wgpu-profiler"]
# Enable the use of wgpu-profiler. This is an optional feature for times when we use a git dependency on
# wgpu (which means the dependency used in wgpu-profiler would be incompatible)
wgpu-profiler = ["dep:wgpu-profiler", "vello/wgpu-profiler"]
# Test for dependencies which implement std traits in ways that cause type inference issues.
_ci_dep_features_to_test = ["dep:kurbo", "kurbo/schemars"]

[lints]
workspace = true
Expand All @@ -41,6 +43,8 @@ log = { workspace = true }
# We're still using env-logger, but we want to use tracing spans to allow using
# tracing_android_trace
tracing = { version = "0.1.40", features = ["log-always"] }
# For _ci_dep_features_to_test feature tests.
kurbo = { workspace = true, optional = true }

[target.'cfg(not(target_os = "android"))'.dependencies]
# We use android_logger on Android
Expand Down
9 changes: 9 additions & 0 deletions examples/with_winit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -945,3 +945,12 @@ fn android_main(app: AndroidApp) {

run(event_loop, args, scenes, render_cx);
}

#[cfg(all(feature = "_ci_dep_features_to_test", test))]
#[test]
// This just tests that the "kurbo" dependency we enable schemars for
// aligns to the same version that vello's peniko dependency resolves to.
fn test_kurbo_schemars_with_peniko() {
use std::marker::PhantomData;
let _: PhantomData<kurbo::Rect> = PhantomData::<vello::peniko::kurbo::Rect>;
}
4 changes: 3 additions & 1 deletion vello/src/scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,9 @@ impl<'a> DrawGlyphs<'a> {
EmojiLikeGlyph::Bitmap(bitmap) => {
let image = match bitmap.data {
bitmap::BitmapData::Bgra(data) => {
if bitmap.width * bitmap.height * 4 != data.len().try_into().unwrap() {
if bitmap.width * bitmap.height * 4
!= u32::try_from(data.len()).unwrap()
{
// TODO: Error once?
log::error!("Invalid font");
continue;
Expand Down

0 comments on commit 92f3ddc

Please sign in to comment.