UI materials: don't reserve in loop when enough capacity (#15919)
# Objective - UI materials reserve too much capacity in a vec: for every node in the transparent phase, it reserves enough memory to store all the nodes - Update #10437 ## Solution - Only reserve extra memory if there's not enough - Only reserve the needed memory, not more
This commit is contained in:
		
							parent
							
								
									ad9f197150
								
							
						
					
					
						commit
						7495d68b41
					
				| @ -642,9 +642,11 @@ pub fn queue_ui_material_nodes<M: UiMaterial>( | ||||
|                 bind_group_data: material.key.clone(), | ||||
|             }, | ||||
|         ); | ||||
|         transparent_phase | ||||
|             .items | ||||
|             .reserve(extracted_uinodes.uinodes.len()); | ||||
|         if transparent_phase.items.capacity() < extracted_uinodes.uinodes.len() { | ||||
|             transparent_phase.items.reserve_exact( | ||||
|                 extracted_uinodes.uinodes.len() - transparent_phase.items.capacity(), | ||||
|             ); | ||||
|         } | ||||
|         transparent_phase.add(TransparentUi { | ||||
|             draw_function, | ||||
|             pipeline, | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 François Mockers
						François Mockers