Skip to content

Parley work #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 40 commits into from
Apr 2, 2025
Merged

Conversation

RobertBrewitz
Copy link
Member

@RobertBrewitz RobertBrewitz commented Mar 19, 2025

PR to integrate parley and font variants.

PR should close #101 .

Using this zulip thread for more direct commuication: https://xi.zulipchat.com/#narrow/channel/205635-parley/topic/.E2.9C.94.20Parley.2C.20layout.20context.2C.20bevy.20and.20multiple.20cores/with/507732907

@RobertBrewitz RobertBrewitz force-pushed the robertbrewitz/parley branch 5 times, most recently from 7f4226c to 689c04f Compare March 19, 2025 21:07
@RobertBrewitz RobertBrewitz force-pushed the robertbrewitz/parley branch 2 times, most recently from abe10a4 to b5b0c69 Compare March 20, 2025 07:55
@RobertBrewitz
Copy link
Member Author

PR is a bit on hold, currently investigating performance issues with font rendering.

@RobertBrewitz
Copy link
Member Author

Ok, resuming work on this and hope that the future hybrid renderer works better with font rendering.

@simbleau
Copy link
Member

simbleau commented Mar 25, 2025

I'm unable to run the text example as is, I get a panic.

Panic originates from here: https://github.com/dfrg/swash/blob/af00b06d9045af8c853eabf3b9eb8b6aed8610c1/src/shape/at.rs#L572

2025-03-25T13:16:33.900863Z  INFO bevy_render::renderer: AdapterInfo { name: "Apple M1 Max", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }
Initialising in parallel using 8 threads
2025-03-25T13:16:34.325168Z  INFO bevy_winit::system: Creating new window "App" (0v1#4294967296)
2025-03-25 09:16:34.531 text[11025:13778357] +[IMKClient subclass]: chose IMKClient_Modern
2025-03-25 09:16:34.531 text[11025:13778357] +[IMKInputSession subclass]: chose IMKInputSession_Modern

thread 'Compute Task Pool (2)' panicked at /Users/simbleau/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/swash-0.2.1/src/shape/at.rs:572:25:
attempt to subtract with overflow
stack backtrace:
   0: rust_begin_unwind
             at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/std/src/panicking.rs:692:5
   1: core::panicking::panic_fmt
             at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/core/src/panicking.rs:75:14
   2: core::panicking::panic_const::panic_const_sub_overflow
             at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/core/src/panicking.rs:178:21
   3: swash::shape::at::CoverageBuilder::finish
             at /Users/simbleau/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/swash-0.2.1/src/shape/at.rs:572:25
   4: swash::shape::at::FeatureStoreBuilder::build_stage
             at /Users/simbleau/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/swash-0.2.1/src/shape/at.rs:482:39
   5: swash::shape::at::FeatureStoreBuilder::build
             at /Users/simbleau/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/swash-0.2.1/src/shape/at.rs:389:13
   6: swash::shape::engine::Engine::collect_features
             at /Users/simbleau/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/swash-0.2.1/src/shape/engine.rs:109:9
   7: swash::shape::ShaperBuilder::build
             at /Users/simbleau/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/swash-0.2.1/src/shape/mod.rs:539:21
   8: swash::shape::partition::shape_clusters
             at /Users/simbleau/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/swash-0.2.1/src/shape/partition.rs:219:22
   9: swash::shape::partition::shape
             at /Users/simbleau/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/swash-0.2.1/src/shape/partition.rs:186:15
  10: parley::shape::shape_text
             at /Users/simbleau/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/parley-0.3.0/src/shape.rs:110:13
  11: parley::builder::build_into_layout
             at /Users/simbleau/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/parley-0.3.0/src/builder.rs:172:9
  12: parley::builder::RangedBuilder<B>::build_into
             at /Users/simbleau/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/parley-0.3.0/src/builder.rs:55:9
  13: parley::builder::RangedBuilder<B>::build
             at /Users/simbleau/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/parley-0.3.0/src/builder.rs:60:9
  14: bevy_vello::text::font::VelloFont::render::{{closure}}::{{closure}}
             at ./src/text/font.rs:99:34
  15: std::thread::local::LocalKey<core::cell::RefCell<T>>::with_borrow_mut::{{closure}}
             at /Users/simbleau/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:529:26
  16: std::thread::local::LocalKey<T>::try_with
             at /Users/simbleau/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:308:12
  17: std::thread::local::LocalKey<T>::with
             at /Users/simbleau/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:272:9
  18: std::thread::local::LocalKey<core::cell::RefCell<T>>::with_borrow_mut
             at /Users/simbleau/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:529:14
  19: bevy_vello::text::font::VelloFont::render::{{closure}}
             at ./src/text/font.rs:88:13
  20: std::thread::local::LocalKey<core::cell::RefCell<T>>::with_borrow_mut::{{closure}}
             at /Users/simbleau/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:529:26
  21: std::thread::local::LocalKey<T>::try_with
             at /Users/simbleau/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:308:12
  22: std::thread::local::LocalKey<T>::with
             at /Users/simbleau/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:272:9
  23: std::thread::local::LocalKey<core::cell::RefCell<T>>::with_borrow_mut
             at /Users/simbleau/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:529:14
  24: bevy_vello::text::font::VelloFont::render
             at ./src/text/font.rs:81:9
  25: bevy_vello::render::systems::render_frame
             at ./src/render/systems.rs:212:21
  26: core::ops::function::FnMut::call_mut
             at /Users/simbleau/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:166:5
  27: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
             at /Users/simbleau/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:294:13
  28: <Func as bevy_ecs::system::function_system::SystemParamFunction<fn(F0,F1,F2,F3,F4,F5,F6,F7,F8) .> Out>>::run::call_inner
             at /Users/simbleau/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.15.3/src/system/function_system.rs:1002:21
  29: <Func as bevy_ecs::system::function_system::SystemParamFunction<fn(F0,F1,F2,F3,F4,F5,F6,F7,F8) .> Out>>::run
             at /Users/simbleau/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.15.3/src/system/function_system.rs:1005:17
  30: <bevy_ecs::system::function_system::FunctionSystem<Marker,F> as bevy_ecs::system::system::System>::run_unsafe
             at /Users/simbleau/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.15.3/src/system/function_system.rs:800:19
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Encountered a panic in system `bevy_vello::render::systems::render_frame`!

@simbleau
Copy link
Member

If I run it in release mode, everything works fine. Not sure if this is an issue for swash or you?

Copy link
Member

@simbleau simbleau left a comment

Choose a reason for hiding this comment

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

As soon as this doesn't cause a panic when I run it in debug mode I can approve this. It looks great!

@RobertBrewitz
Copy link
Member Author

If I run it in release mode, everything works fine. Not sure if this is an issue for swash or you?

Happens here also, peculiar, I'll look into it.

@RobertBrewitz
Copy link
Member Author

If I run it in release mode, everything works fine. Not sure if this is an issue for swash or you?

Something with swash and bevy's default font it seems, asking around a bit what needs to be done to solve it.

@RobertBrewitz
Copy link
Member Author

Awating the panic issue to be solved in swash, here: dfrg/swash#90

@simbleau
Copy link
Member

Awaiting release, patch put into swash.

Copy link
Member

@simbleau simbleau left a comment

Choose a reason for hiding this comment

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

Approved as soon as the cargo update is done

@RobertBrewitz RobertBrewitz enabled auto-merge April 2, 2025 06:26
@RobertBrewitz RobertBrewitz added this pull request to the merge queue Apr 2, 2025
Merged via the queue into linebender:main with commit b0ab058 Apr 2, 2025
4 checks passed
@RobertBrewitz RobertBrewitz deleted the robertbrewitz/parley branch April 2, 2025 18:42
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.

Use parley instead of low-level types (skrifa)
2 participants