Remove the entity index from the UI phase's sort key (#18273)
# Objective The sort key for the transparent UI phase is a (float32, u32) pair consisting of the stack index and the render entity's index. I guess the render entity index was intended to break ties but it's not needed as the sort is stable. It also assumes the indices of the render entities are generated sequentially, which isn't guaranteed. Fixes the issues with the text wrap example seen in #18266 ## Solution Change the sort key to just use the stack index alone.
This commit is contained in:
parent
ec822c8c3b
commit
26ea38e4a6
@ -365,10 +365,8 @@ pub fn queue_shadows(
|
||||
draw_function,
|
||||
pipeline,
|
||||
entity: (entity, extracted_shadow.main_entity),
|
||||
sort_key: (
|
||||
FloatOrd(extracted_shadow.stack_index as f32 + stack_z_offsets::BOX_SHADOW),
|
||||
entity.index(),
|
||||
),
|
||||
sort_key: FloatOrd(extracted_shadow.stack_index as f32 + stack_z_offsets::BOX_SHADOW),
|
||||
|
||||
batch_range: 0..0,
|
||||
extra_index: PhaseItemExtraIndex::None,
|
||||
index,
|
||||
|
||||
@ -981,10 +981,7 @@ pub fn queue_uinodes(
|
||||
draw_function,
|
||||
pipeline,
|
||||
entity: (entity, extracted_uinode.main_entity),
|
||||
sort_key: (
|
||||
FloatOrd(extracted_uinode.stack_index as f32 + stack_z_offsets::NODE),
|
||||
entity.index(),
|
||||
),
|
||||
sort_key: FloatOrd(extracted_uinode.stack_index as f32 + stack_z_offsets::NODE),
|
||||
index,
|
||||
// batch_range will be calculated in prepare_uinodes
|
||||
batch_range: 0..0,
|
||||
|
||||
@ -106,7 +106,7 @@ impl Node for UiPassNode {
|
||||
}
|
||||
|
||||
pub struct TransparentUi {
|
||||
pub sort_key: (FloatOrd, u32),
|
||||
pub sort_key: FloatOrd,
|
||||
pub entity: (Entity, MainEntity),
|
||||
pub pipeline: CachedRenderPipelineId,
|
||||
pub draw_function: DrawFunctionId,
|
||||
@ -153,7 +153,7 @@ impl PhaseItem for TransparentUi {
|
||||
}
|
||||
|
||||
impl SortedPhaseItem for TransparentUi {
|
||||
type SortKey = (FloatOrd, u32);
|
||||
type SortKey = FloatOrd;
|
||||
|
||||
#[inline]
|
||||
fn sort_key(&self) -> Self::SortKey {
|
||||
|
||||
@ -665,10 +665,7 @@ pub fn queue_ui_material_nodes<M: UiMaterial>(
|
||||
draw_function,
|
||||
pipeline,
|
||||
entity: (extracted_uinode.render_entity, extracted_uinode.main_entity),
|
||||
sort_key: (
|
||||
FloatOrd(extracted_uinode.stack_index as f32 + stack_z_offsets::MATERIAL),
|
||||
extracted_uinode.render_entity.index(),
|
||||
),
|
||||
sort_key: FloatOrd(extracted_uinode.stack_index as f32 + stack_z_offsets::MATERIAL),
|
||||
batch_range: 0..0,
|
||||
extra_index: PhaseItemExtraIndex::None,
|
||||
index,
|
||||
|
||||
@ -372,9 +372,8 @@ pub fn queue_ui_slices(
|
||||
draw_function,
|
||||
pipeline,
|
||||
entity: (extracted_slicer.render_entity, extracted_slicer.main_entity),
|
||||
sort_key: (
|
||||
FloatOrd(extracted_slicer.stack_index as f32 + stack_z_offsets::TEXTURE_SLICE),
|
||||
extracted_slicer.render_entity.index(),
|
||||
sort_key: FloatOrd(
|
||||
extracted_slicer.stack_index as f32 + stack_z_offsets::TEXTURE_SLICE,
|
||||
),
|
||||
batch_range: 0..0,
|
||||
extra_index: PhaseItemExtraIndex::None,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user