Merge pull request #3083 from Domanffe/perf/hud-paint-reuses-sprite-key

🤖 Agent: read the diff at 4bf633e8a ("HUD paint: build the sprite key in one reused buffer") against the 26.3 source it cites; verify green, merges cleanly with main. Proof: cg25 union a051cc285 (local branch cg25/union in t3-ef805fdb: main 6d3489d30 + 38 contributor heads merged cleanly, no fixups): clippy -p horizon-client --all-targets -D warnings clean, horizon-client lib 1105 + bin 133 + integration tests pass, parity --changed 355/355 harnesses PASS on the Mac mini (Cargo.lock changed by #3210, so every harness ran; tab_list passed on its one retry).
This commit is contained in:
Ludovic Marie
2026-10-28 19:54:50 +01:00
committed by GitHub
+9 -5
View File
@@ -801,6 +801,8 @@ impl HealthHud {
/// nausea blits (their blending needs the screen-effect pipeline).
pub fn paint(batch: &mut crate::hud::HudBatch, atlas: &crate::hud::HudAtlas, draws: &[GuiDraw]) {
let mut stack = vec![IDENTITY];
// One buffer for the sprite keys, instead of a string per drawn sprite.
let mut name = String::new();
for d in draws {
let start = batch.vertices.len();
let pose = *stack.last().unwrap_or(&IDENTITY);
@@ -817,12 +819,14 @@ pub fn paint(batch: &mut crate::hud::HudBatch, atlas: &crate::hud::HudAtlas, dra
} => {
// Effect sprites belong to the mob_effect atlas directory;
// the other blitSprite ids refer to GUI sprites.
let name = if sprite.starts_with("mob_effect/") {
sprite.to_string()
name.clear();
if sprite.starts_with("mob_effect/") {
name.push_str(sprite);
} else {
format!("gui/sprites/{sprite}")
};
let Some(mut r) = atlas.sprites.get(&name).copied() else {
name.push_str("gui/sprites/");
name.push_str(sprite);
}
let Some(mut r) = atlas.sprites.get(name.as_str()).copied() else {
continue;
};
if let Some([sw, sh, u, v]) = *region {