Skip to content

Commit

Permalink
RenderUiSystem::ExtractTextureSlice (#15332)
Browse files Browse the repository at this point in the history
# 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.
  • Loading branch information
ickshonpe committed Sep 20, 2024
1 parent 661ab1a commit 48f2bd4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions crates/bevy_ui/src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ pub const UI_SHADER_HANDLE: Handle<Shader> = Handle::weak_from_u128(130128470471
pub enum RenderUiSystem {
ExtractBackgrounds,
ExtractImages,
ExtractTextureSlice,
ExtractBorders,
ExtractText,
}
Expand All @@ -95,6 +96,7 @@ pub fn build_ui_render(app: &mut App) {
(
RenderUiSystem::ExtractBackgrounds,
RenderUiSystem::ExtractImages,
RenderUiSystem::ExtractTextureSlice,
RenderUiSystem::ExtractBorders,
RenderUiSystem::ExtractText,
)
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ui/src/render/ui_texture_slice_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl Plugin for UiTextureSlicerPlugin {
.init_resource::<SpecializedRenderPipelines<UiTextureSlicePipeline>>()
.add_systems(
ExtractSchedule,
extract_ui_texture_slices.after(extract_uinode_images),
extract_ui_texture_slices.in_set(RenderUiSystem::ExtractTextureSlice),
)
.add_systems(
Render,
Expand Down

0 comments on commit 48f2bd4

Please sign in to comment.