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)
This commit is contained in:
re0312 2024-07-04 04:54:11 +08:00 committed by GitHub
parent c8d8ea6d4f
commit 1c2f687202
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,6 +8,7 @@ use bevy_core_pipeline::core_3d::graph::{Core3d, Node3d};
use bevy_core_pipeline::{core_2d::Camera2d, core_3d::Camera3d};
use bevy_hierarchy::Parent;
use bevy_render::render_phase::ViewSortedRenderPhases;
use bevy_render::texture::TRANSPARENT_IMAGE_HANDLE;
use bevy_render::{
render_phase::{PhaseItem, PhaseItemExtraIndex},
texture::GpuImage,
@ -334,7 +335,10 @@ pub fn extract_uinode_images(
};
// Skip invisible images
if !view_visibility.get() || image.color.is_fully_transparent() {
if !view_visibility.get()
|| image.color.is_fully_transparent()
|| image.texture.id() == TRANSPARENT_IMAGE_HANDLE.id()
{
continue;
}