Skip to content
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

Perform text scaling calculations per text, not per glyph #7819

Merged
merged 25 commits into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
fb6cfaa
move transform scaling calculations for text out of the inner loop
ickshonpe Feb 25, 2023
67519e5
fix scaling in text2d
ickshonpe Feb 25, 2023
39f2f86
add many_glyphs example
ickshonpe Feb 25, 2023
fa6f831
Added many_glyphs example
ickshonpe Feb 25, 2023
a2ef631
modify example
ickshonpe Feb 25, 2023
65763ab
switch to single text section
ickshonpe Feb 25, 2023
b48bf4a
swapped flex_basis for style constraint on text node
ickshonpe Feb 25, 2023
58c69ee
Merge branch 'many_glyphs' into text-perf
ickshonpe Feb 25, 2023
ed801f5
cargo fmt
ickshonpe Feb 25, 2023
c64ee5c
fix manual-str-repeat
ickshonpe Feb 25, 2023
734ddb1
* cleaned up example
ickshonpe Feb 25, 2023
983b44d
cleaned up imports and improve transform calculations
ickshonpe Feb 25, 2023
15a41e4
replaced `extend` chain with `Vec4::from`
ickshonpe Feb 25, 2023
838fba2
Changed the precompution in `extract_text_uinodes` to use `from_scale…
ickshonpe Feb 27, 2023
6eabeef
cleaned up `extract_text2d_sprite` to be more similar to`extract_text…
ickshonpe Feb 27, 2023
3b760e7
Cleaned up `extract_text2d_sprite` to be more similar to`extract_tex…
ickshonpe Feb 27, 2023
26a04fe
Added text drawn with Text2d to the many_glyphs example.
ickshonpe Feb 27, 2023
c8ca008
cargo fmt
ickshonpe Feb 27, 2023
63f60cc
removed an unnecessary `mut` and an unused variable
ickshonpe Feb 27, 2023
6944b78
simplify text transform calculations
ickshonpe Feb 27, 2023
faedcab
simplified text calculations
ickshonpe Feb 27, 2023
567749c
fixed imports and fmt
ickshonpe Feb 27, 2023
fdfe321
fix clippy::doc-markdown warning
ickshonpe Feb 27, 2023
f3343cc
Merge branch 'main' into text-perf
ickshonpe Mar 13, 2023
d01878e
Moved scaling inversion calculation out of loop extraction loop.
ickshonpe Mar 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix manual-str-repeat
  • Loading branch information
ickshonpe committed Feb 25, 2023
commit c64ee5c33f725b1dfb7bb76ac340fe1fd72c0393
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ Example | Description
[Many Buttons](../examples/stress_tests/many_buttons.rs) | Test rendering of many UI elements
[Many Cubes](../examples/stress_tests/many_cubes.rs) | Simple benchmark to test per-entity draw overhead. Run with the `sphere` argument to test frustum culling
[Many Foxes](../examples/stress_tests/many_foxes.rs) | Loads an animated fox model and spawns lots of them. Good for testing skinned mesh performance. Takes an unsigned integer argument for the number of foxes to spawn. Defaults to 1000
[Many Glyphs](../examples/stress_tests/many_glyphs.rs) | Simple text rendering benchmark.
[Many Glyphs](../examples/stress_tests/many_glyphs.rs) | Simple benchmark to test text rendering.
[Many Lights](../examples/stress_tests/many_lights.rs) | Simple benchmark to test rendering many point lights. Run with `WGPU_SETTINGS_PRIO=webgl2` to restrict to uniform buffers and max 256 lights
[Many Sprites](../examples/stress_tests/many_sprites.rs) | Displays many sprites in a grid arrangement! Used for performance testing. Use `--colored` to enable color tinted sprites.
[Transform Hierarchy](../examples/stress_tests/transform_hierarchy.rs) | Various test cases for hierarchy and transform propagation performance
Expand Down
4 changes: 1 addition & 3 deletions examples/stress_tests/many_glyphs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
commands.spawn(TextBundle {
text: Text {
sections: vec![TextSection {
value: std::iter::repeat("0123456789")
.take(10_000)
.collect::<String>(),
value: "0123456789".repeat(10_000),
style: TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 4.,
Expand Down