bevy/crates/bevy_ui/src
ickshonpe 01a3b0e830
UI texture atlas slice shader (#14990)
# Objective

Fixes https://github.com/bevyengine/bevy/issues/14183

## Solution

Reimplement the UI texture atlas slicer using a shader. 

The problems with #14183 could be fixed more simply by hacking around
with the coordinates and scaling but that way is very fragile and might
get broken again the next time we make changes to the layout
calculations. A shader based solution is more robust, it's impossible
for gaps to appear between the image slices with these changes as we're
only drawing a single quad.

I've not tried any benchmarks yet but it should much more efficient as
well, in the worst cases even hundreds or thousands of times faster.

Maybe could have used the UiMaterialPipeline. I wrote the shader first
and used fat vertices and then realised it wouldn't work that way with a
UiMaterial. If it's rewritten it so it puts all the slice geometry in
uniform buffer, then it might work? Adding the uniform buffer would
probably make the shader more complicated though, so don't know if it's
even worth it. Instancing is another alternative.

## Testing
The examples are working and it seems to match the old API correctly but
I've not used the texture atlas slicing API for anything before, I
reviewed the PR but that was back in January.

Needs a review by someone who knows the rendering pipeline and wgsl
really well because I don't really have any idea what I'm doing.
2024-09-02 23:03:58 +00:00
..
layout Reduce allocations in ui_layout_system (#15001) 2024-09-02 22:37:27 +00:00
render UI texture atlas slice shader (#14990) 2024-09-02 23:03:58 +00:00
widget Don't reallocate scale factors in measure_text_system (#14999) 2024-09-02 17:01:59 +00:00
accessibility.rs Resolve UI outlines using the correct target's viewport size (#14947) 2024-09-02 16:56:58 +00:00
focus.rs Apply Clippy lints regarding lazy evaluation and closures (#14015) 2024-07-01 15:54:40 +00:00
geometry.rs Fix uses of "it's" vs "its". (#13033) 2024-04-19 18:17:31 +00:00
lib.rs UI texture atlas slice shader (#14990) 2024-09-02 23:03:58 +00:00
measurement.rs Optimize UI text measurement (#15003) 2024-09-01 11:50:54 +00:00
node_bundles.rs Add BorderRadius field to ImageBundle (#14457) 2024-07-24 18:41:26 +00:00
picking_backend.rs hooking up observers and clicking for ui node (#14695) 2024-08-15 14:43:55 +00:00
stack.rs Merge BuildWorldChildren and BuildChildren traits. (#14052) 2024-07-01 14:29:39 +00:00
ui_material.rs Fix incorrect link in UiMaterial documentation (#12361) 2024-03-07 22:09:57 +00:00
ui_node.rs Resolve UI outlines using the correct target's viewport size (#14947) 2024-09-02 16:56:58 +00:00
update.rs fix: use try_insert instead of insert in bevy_ui to prevent panics when despawning ui nodes (#13000) 2024-04-19 18:12:08 +00:00