mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 09:33:51 +00:00
Validate WMO GPU resources before render to prevent device lost
Add null checks for vertex/index buffers, pipelines, and zero-count draws in WMO render path. The shadow pass already had buffer validation but the main render() was missing it, which could cause GPU crashes on WMO-only maps like Stockades (26 groups).
This commit is contained in:
parent
0c5a915db3
commit
5519c73f5c
1 changed files with 5 additions and 0 deletions
|
|
@ -1499,6 +1499,9 @@ void WMORenderer::render(VkCommandBuffer cmd, VkDescriptorSet perFrameSet, const
|
||||||
if (groupDistSq < LOD_SHELL_DIST_SQ) continue;
|
if (groupDistSq < LOD_SHELL_DIST_SQ) continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skip groups with invalid GPU resources
|
||||||
|
if (group.vertexBuffer == VK_NULL_HANDLE || group.indexBuffer == VK_NULL_HANDLE) continue;
|
||||||
|
|
||||||
// Bind vertex + index buffers
|
// Bind vertex + index buffers
|
||||||
VkDeviceSize offset = 0;
|
VkDeviceSize offset = 0;
|
||||||
vkCmdBindVertexBuffers(cmd, 0, 1, &group.vertexBuffer, &offset);
|
vkCmdBindVertexBuffers(cmd, 0, 1, &group.vertexBuffer, &offset);
|
||||||
|
|
@ -1522,6 +1525,7 @@ void WMORenderer::render(VkCommandBuffer cmd, VkDescriptorSet perFrameSet, const
|
||||||
VkPipeline targetPipeline = activePipeline;
|
VkPipeline targetPipeline = activePipeline;
|
||||||
if (neededPipeline == 1) targetPipeline = transparentPipeline_;
|
if (neededPipeline == 1) targetPipeline = transparentPipeline_;
|
||||||
else if (neededPipeline == 2) targetPipeline = glassPipeline_;
|
else if (neededPipeline == 2) targetPipeline = glassPipeline_;
|
||||||
|
if (targetPipeline == VK_NULL_HANDLE) continue;
|
||||||
|
|
||||||
vkCmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, targetPipeline);
|
vkCmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, targetPipeline);
|
||||||
currentPipelineKind = neededPipeline;
|
currentPipelineKind = neededPipeline;
|
||||||
|
|
@ -1533,6 +1537,7 @@ void WMORenderer::render(VkCommandBuffer cmd, VkDescriptorSet perFrameSet, const
|
||||||
|
|
||||||
// Issue draw calls for each range in this merged batch
|
// Issue draw calls for each range in this merged batch
|
||||||
for (const auto& dr : mb.draws) {
|
for (const auto& dr : mb.draws) {
|
||||||
|
if (dr.indexCount == 0) continue;
|
||||||
vkCmdDrawIndexed(cmd, dr.indexCount, 1, dr.firstIndex, 0, 0);
|
vkCmdDrawIndexed(cmd, dr.indexCount, 1, dr.firstIndex, 0, 0);
|
||||||
lastDrawCalls++;
|
lastDrawCalls++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue