fix(rendering): defer descriptor set destruction during streaming unload

M2 destroyInstanceBones and WMO destroyGroupGPU freed descriptor sets
and buffers immediately during tile streaming, while in-flight command
buffers still referenced them — causing DEVICE_LOST on AMD RADV.

Now defers GPU resource destruction via deferAfterFrameFence in streaming
paths (removeInstance, removeInstances, unloadModel). Immediate
destruction preserved for shutdown/clear paths that vkDeviceWaitIdle
first.

Also: vkDeviceWaitIdle before WMO backfillNormalMaps descriptor rebinds,
and fillModeNonSolid added to required device features for wireframe
pipelines on AMD.
This commit is contained in:
Kelsi 2026-04-03 18:30:52 -07:00
parent 8fd4dccf6b
commit ac5c61203d
5 changed files with 97 additions and 39 deletions

View file

@ -641,8 +641,10 @@ private:
// Helper to destroy model GPU resources
void destroyModelGPU(M2ModelGPU& model);
// Helper to destroy instance bone buffers
void destroyInstanceBones(M2Instance& inst);
// Helper to destroy instance bone buffers.
// When defer=true, destruction is scheduled via deferAfterFrameFence so
// in-flight command buffers are not invalidated (use for streaming unload).
void destroyInstanceBones(M2Instance& inst, bool defer = false);
};
} // namespace rendering

View file

@ -599,9 +599,11 @@ private:
VkDescriptorSet allocateMaterialSet();
/**
* Destroy GPU resources for a single group
* Destroy GPU resources for a single group.
* When defer=true, destruction is scheduled via deferAfterFrameFence
* so in-flight command buffers are not invalidated.
*/
void destroyGroupGPU(GroupResources& group);
void destroyGroupGPU(GroupResources& group, bool defer = false);
struct GridCell {
int x;