bevy/crates
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
..
bevy_a11y Add Reflect derive to bevy_a11y::Focus (#14763) 2024-08-15 17:33:20 +00:00
bevy_animation Implement animation masks, allowing fine control of the targets that animations affect. (#15013) 2024-09-02 17:10:34 +00:00
bevy_app Migrated NonZero* to NonZero<*> (#14978) 2024-08-30 02:37:47 +00:00
bevy_asset Use CowArc::Static (#14981) 2024-08-30 01:22:11 +00:00
bevy_audio Generate links to definition in source code pages on docs.rs and dev-docs.bevyengine.org (#12965) 2024-07-29 23:10:16 +00:00
bevy_color Apply unused_qualifications lint (#14828) 2024-08-21 12:29:33 +00:00
bevy_core Generate links to definition in source code pages on docs.rs and dev-docs.bevyengine.org (#12965) 2024-07-29 23:10:16 +00:00
bevy_core_pipeline Migrated NonZero* to NonZero<*> (#14978) 2024-08-30 02:37:47 +00:00
bevy_derive Remove deprecated bevy_dynamic_plugin (#14534) 2024-07-30 15:31:08 +00:00
bevy_dev_tools Rewrite screenshots. (#14833) 2024-08-25 14:14:32 +00:00
bevy_diagnostic Apply unused_qualifications lint (#14828) 2024-08-21 12:29:33 +00:00
bevy_dylib Generate links to definition in source code pages on docs.rs and dev-docs.bevyengine.org (#12965) 2024-07-29 23:10:16 +00:00
bevy_ecs Use #[doc(fake_variadic)] for SystemParamBuilder tuple impls. (#14962) 2024-09-02 16:51:23 +00:00
bevy_encase_derive Generate links to definition in source code pages on docs.rs and dev-docs.bevyengine.org (#12965) 2024-07-29 23:10:16 +00:00
bevy_gilrs Generate links to definition in source code pages on docs.rs and dev-docs.bevyengine.org (#12965) 2024-07-29 23:10:16 +00:00
bevy_gizmos Curve gizmos integration (#14971) 2024-08-29 16:48:22 +00:00
bevy_gltf Apply unused_qualifications lint (#14828) 2024-08-21 12:29:33 +00:00
bevy_hierarchy Fix with_child not inserting Parent component (#15009) 2024-09-02 22:47:25 +00:00
bevy_input Fix common capitalization errors in documentation (#14562) 2024-07-31 21:16:05 +00:00
bevy_internal Add bevy_picking sprite backend (#14757) 2024-08-26 18:01:32 +00:00
bevy_log Move the default LogPlugin filter to a public constant (#14958) 2024-08-29 12:15:49 +00:00
bevy_macro_utils Generate links to definition in source code pages on docs.rs and dev-docs.bevyengine.org (#12965) 2024-07-29 23:10:16 +00:00
bevy_math Curve gizmos integration (#14971) 2024-08-29 16:48:22 +00:00
bevy_mikktspace Fix underflow panic in InitTriInfo (#14893) 2024-08-25 14:13:23 +00:00
bevy_pbr Migrated NonZero* to NonZero<*> (#14978) 2024-08-30 02:37:47 +00:00
bevy_picking rename Drop to bevy::picking::events::DragDrop to unclash std::ops:Drop (#14926) 2024-08-26 18:38:56 +00:00
bevy_ptr Migrated NonZero* to NonZero<*> (#14978) 2024-08-30 02:37:47 +00:00
bevy_reflect Reflect SmolStr's De/Serialize implementation (#14982) 2024-09-02 22:35:17 +00:00
bevy_render Adds ShaderStorageBuffer asset (#14663) 2024-09-02 16:46:34 +00:00
bevy_scene reflect: implement the unique reflect rfc (#7207) 2024-08-12 17:01:41 +00:00
bevy_sprite Remove unnecessary muts in RenderSet::QueueMeshes (#14953) 2024-08-28 11:38:38 +00:00
bevy_state Fix compile error caused by incorrect feature flag in bevy_state (#14987) 2024-08-30 18:57:08 +00:00
bevy_tasks Migrated NonZero* to NonZero<*> (#14978) 2024-08-30 02:37:47 +00:00
bevy_text Avoid reallocating spans buffer in TextPipeline (#15012) 2024-09-02 17:02:06 +00:00
bevy_time Allow ordering variable timesteps around fixed timesteps (#14881) 2024-08-23 16:19:42 +00:00
bevy_transform Generate links to definition in source code pages on docs.rs and dev-docs.bevyengine.org (#12965) 2024-07-29 23:10:16 +00:00
bevy_ui UI texture atlas slice shader (#14990) 2024-09-02 23:03:58 +00:00
bevy_utils Replace bevy_utils::CowArc with atomicow (#14977) 2024-08-30 00:43:07 +00:00
bevy_window Migrated NonZero* to NonZero<*> (#14978) 2024-08-30 02:37:47 +00:00
bevy_winit Have EntityCommands methods consume self for easier chaining (#14897) 2024-08-26 18:24:59 +00:00