From 48f2bd410b9e6b4af616bfc02d819994b89fe523 Mon Sep 17 00:00:00 2001 From: ickshonpe Date: Sat, 21 Sep 2024 00:55:11 +0100 Subject: [PATCH] `RenderUiSystem::ExtractTextureSlice` (#15332) # Objective Fixes #15330 ## Solution 1. Add an `ExtractTextureSlice` variant to `RenderUiSystem`. 2. Add `RenderUiSystem::ExtractTextureSlice` to the `ExtractSchedule` between `ExtractImages` and `ExtractBorders`. 3. Add `extract_ui_texture_slices` to the new `ExtractTextureSlice` system set. Which results in texture slice nodes being extracted before borders. No more z-fighting, borders will always be drawn on top of texture-sliced images. --- crates/bevy_ui/src/render/mod.rs | 2 ++ crates/bevy_ui/src/render/ui_texture_slice_pipeline.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/bevy_ui/src/render/mod.rs b/crates/bevy_ui/src/render/mod.rs index 0b646367aa094..ead0059c2b2c3 100644 --- a/crates/bevy_ui/src/render/mod.rs +++ b/crates/bevy_ui/src/render/mod.rs @@ -70,6 +70,7 @@ pub const UI_SHADER_HANDLE: Handle = Handle::weak_from_u128(130128470471 pub enum RenderUiSystem { ExtractBackgrounds, ExtractImages, + ExtractTextureSlice, ExtractBorders, ExtractText, } @@ -95,6 +96,7 @@ pub fn build_ui_render(app: &mut App) { ( RenderUiSystem::ExtractBackgrounds, RenderUiSystem::ExtractImages, + RenderUiSystem::ExtractTextureSlice, RenderUiSystem::ExtractBorders, RenderUiSystem::ExtractText, ) diff --git a/crates/bevy_ui/src/render/ui_texture_slice_pipeline.rs b/crates/bevy_ui/src/render/ui_texture_slice_pipeline.rs index c712d7838650f..5839f7034ace5 100644 --- a/crates/bevy_ui/src/render/ui_texture_slice_pipeline.rs +++ b/crates/bevy_ui/src/render/ui_texture_slice_pipeline.rs @@ -53,7 +53,7 @@ impl Plugin for UiTextureSlicerPlugin { .init_resource::>() .add_systems( ExtractSchedule, - extract_ui_texture_slices.after(extract_uinode_images), + extract_ui_texture_slices.in_set(RenderUiSystem::ExtractTextureSlice), ) .add_systems( Render,