mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Fix GPU resource leaks and re-entrant world loading for instance transitions
Reset descriptor pools in CharacterRenderer/M2Renderer/WMORenderer on map change to prevent VK_ERROR_DEVICE_LOST from pool exhaustion. Defer re-entrant SMSG_NEW_WORLD during active world load to avoid recursive cleanup crashes. Gate swim bubbles on swimming state, skip redundant shadow pipeline re-init, add WOWEE_SKIP_* env vars for render isolation debugging.
This commit is contained in:
parent
19652ae521
commit
48eb0b70a3
9 changed files with 255 additions and 47 deletions
|
|
@ -3254,6 +3254,35 @@ void M2Renderer::clear() {
|
|||
for (auto& inst : instances) {
|
||||
destroyInstanceBones(inst);
|
||||
}
|
||||
// Reset descriptor pools so new allocations succeed after reload.
|
||||
// destroyModelGPU/destroyInstanceBones don't free individual sets,
|
||||
// so the pools fill up across map changes without this reset.
|
||||
VkDevice device = vkCtx_->getDevice();
|
||||
if (materialDescPool_) {
|
||||
vkResetDescriptorPool(device, materialDescPool_, 0);
|
||||
// Re-allocate the glow texture descriptor set (pre-allocated during init,
|
||||
// invalidated by pool reset).
|
||||
if (glowTexture_ && particleTexLayout_) {
|
||||
VkDescriptorSetAllocateInfo ai{VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO};
|
||||
ai.descriptorPool = materialDescPool_;
|
||||
ai.descriptorSetCount = 1;
|
||||
ai.pSetLayouts = &particleTexLayout_;
|
||||
glowTexDescSet_ = VK_NULL_HANDLE;
|
||||
if (vkAllocateDescriptorSets(device, &ai, &glowTexDescSet_) == VK_SUCCESS) {
|
||||
VkDescriptorImageInfo imgInfo = glowTexture_->descriptorInfo();
|
||||
VkWriteDescriptorSet write{VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET};
|
||||
write.dstSet = glowTexDescSet_;
|
||||
write.dstBinding = 0;
|
||||
write.descriptorCount = 1;
|
||||
write.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
|
||||
write.pImageInfo = &imgInfo;
|
||||
vkUpdateDescriptorSets(device, 1, &write, 0, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (boneDescPool_) {
|
||||
vkResetDescriptorPool(device, boneDescPool_, 0);
|
||||
}
|
||||
}
|
||||
models.clear();
|
||||
instances.clear();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue