bevy/crates/bevy_ui/src
ickshonpe c39e02cefb
Improved UI render batching (#8793)
# Objective

`prepare_uinodes` creates a new `UiBatch` whenever the texture changes,
when most often it's just queuing untextured quads. Instead of switching
textures, we can reduce the number of batches generated significantly by
adding a condition to the fragment shader so that it only multiplies by
the `textureSample` value when drawing a textured quad.

# Solution

Add a `mode` field to `UiVertex`.
In `prepare_uinodes` set `mode` to 0 if the quad is textured or 1 if
untextured.
Add a condition to the fragment shader that only multiplies by the
`color` value from `textureSample` if `mode` is set to 1.

---

## Changelog
* Added a `mode` field to `UiVertex`, and added an extra `u32` vertex
attribute to the shader and vertex buffer layout.
* In `prepare_uinodes` mode is set to 0 for the vertices of textured
quads, and 1 if untextured.
* Added a condition to the fragment shader in `ui.wgsl` that only
multiplies by the `color` value from `textureSample` if the mode is
equal to 0.
2023-06-21 23:50:29 +00:00
..
layout Fix errors in the doc comment for UiSurface::upsert_node. (#8796) 2023-06-09 11:59:57 +00:00
render Improved UI render batching (#8793) 2023-06-21 23:50:29 +00:00
widget UI texture atlas support (#8822) 2023-06-19 21:52:02 +00:00
accessibility.rs Move bevy_ui accessibility systems to PostUpdate. (#8653) 2023-05-23 23:50:48 +00:00
camera_config.rs bevy_ui: Add FromReflect derives (#8495) 2023-04-26 12:17:23 +00:00
focus.rs Perform relative_cursor_position calculation vectorwise in ui_focus_system (#8795) 2023-06-09 12:01:07 +00:00
geometry.rs Add UiRect::px() and UiRect::percent() utils (#8866) 2023-06-19 14:00:18 +00:00
lib.rs Allow tuples and single plugins in add_plugins, deprecate add_plugin (#8097) 2023-06-21 20:51:03 +00:00
measurement.rs Add FromReflect where Reflect is used (#8776) 2023-06-19 16:18:17 +00:00
node_bundles.rs UI texture atlas support (#8822) 2023-06-19 21:52:02 +00:00
stack.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
ui_node.rs UI texture atlas support (#8822) 2023-06-19 21:52:02 +00:00
update.rs Split UI Overflow by axis (#8095) 2023-04-17 22:23:52 +00:00