fix: use expansion context for spline parsing; preload DBC caches at world entry

Spline parsing: remove Classic format fallback from the WotLK parser. The
PacketParsers hierarchy already dispatches to expansion-specific parsers
(Classic/TBC/WotLK/Turtle), so the WotLK parseMovementBlock should only
attempt WotLK spline format. The Classic fallback could false-positive when
durationMod bytes resembled a valid point count, corrupting downstream parsing.

Preload DBC caches: call loadSpellNameCache() and 5 other lazy DBC caches
during handleLoginVerifyWorld() on initial world entry. This moves the ~170ms
Spell.csv load from the first SMSG_SPELL_GO handler to the loading screen,
eliminating the mid-gameplay stall.

WMO portal culling: move per-instance portalVisibleGroups vector and
portalVisibleGroupSet to reusable member variables, eliminating heap
allocations per WMO instance per frame.
This commit is contained in:
Kelsi 2026-03-27 16:58:39 -07:00
parent a795239e77
commit 6f2c8962e5
5 changed files with 54 additions and 48 deletions

View file

@ -1395,21 +1395,21 @@ void WMORenderer::render(VkCommandBuffer cmd, VkDescriptorSet perFrameSet, const
result.portalCulled = 0;
result.distanceCulled = 0;
// Portal-based visibility — use a flat sorted vector instead of unordered_set
std::vector<uint32_t> portalVisibleGroups;
// Portal-based visibility — reuse member scratch buffers (avoid per-frame alloc)
portalVisibleGroups_.clear();
bool usePortalCulling = doPortalCull && !model.portals.empty() && !model.portalRefs.empty();
if (usePortalCulling) {
std::unordered_set<uint32_t> pvgSet;
portalVisibleGroupSet_.clear();
glm::vec4 localCamPos = instance.invModelMatrix * glm::vec4(portalViewerPos, 1.0f);
getVisibleGroupsViaPortals(model, glm::vec3(localCamPos), frustum,
instance.modelMatrix, pvgSet);
portalVisibleGroups.assign(pvgSet.begin(), pvgSet.end());
std::sort(portalVisibleGroups.begin(), portalVisibleGroups.end());
instance.modelMatrix, portalVisibleGroupSet_);
portalVisibleGroups_.assign(portalVisibleGroupSet_.begin(), portalVisibleGroupSet_.end());
std::sort(portalVisibleGroups_.begin(), portalVisibleGroups_.end());
}
for (size_t gi = 0; gi < model.groups.size(); ++gi) {
if (usePortalCulling &&
!std::binary_search(portalVisibleGroups.begin(), portalVisibleGroups.end(),
!std::binary_search(portalVisibleGroups_.begin(), portalVisibleGroups_.end(),
static_cast<uint32_t>(gi))) {
result.portalCulled++;
continue;