Skip to content

Commit 1c2f687

Browse files
authored
Skip extract UiImage When its texture is default (#14122)
# Objective - After #14017 , I noticed that the drawcall increased 10x in the `many_buttons`, causing the `UIPassNode `to increase from 1.5ms to 6ms. This is because our UI batching is very fragile. ## Solution - skip extract UiImage when its texture is default ## Performance many_buttons UiPassNode ![image](https://github.com/bevyengine/bevy/assets/45868716/9295d958-8c3f-469c-a7e0-d1e90db4dfb7)
1 parent c8d8ea6 commit 1c2f687

File tree

1 file changed

+5
-1
lines changed
  • crates/bevy_ui/src/render

1 file changed

+5
-1
lines changed

crates/bevy_ui/src/render/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use bevy_core_pipeline::core_3d::graph::{Core3d, Node3d};
88
use bevy_core_pipeline::{core_2d::Camera2d, core_3d::Camera3d};
99
use bevy_hierarchy::Parent;
1010
use bevy_render::render_phase::ViewSortedRenderPhases;
11+
use bevy_render::texture::TRANSPARENT_IMAGE_HANDLE;
1112
use bevy_render::{
1213
render_phase::{PhaseItem, PhaseItemExtraIndex},
1314
texture::GpuImage,
@@ -334,7 +335,10 @@ pub fn extract_uinode_images(
334335
};
335336

336337
// Skip invisible images
337-
if !view_visibility.get() || image.color.is_fully_transparent() {
338+
if !view_visibility.get()
339+
|| image.color.is_fully_transparent()
340+
|| image.texture.id() == TRANSPARENT_IMAGE_HANDLE.id()
341+
{
338342
continue;
339343
}
340344

0 commit comments

Comments
 (0)