mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Optimize M2/WMO render loop: cache UBO pointers, precompute model flags, reduce rebinds
- Cache material UBO mapped pointers at creation time, eliminating per-batch vmaGetAllocationInfo() calls in the hot render path - Precompute foliage/elven/lantern/kobold model name classifications at load time instead of per-instance string operations every frame - Remove redundant descriptor set and push constant rebinds on WMO pipeline switches (preserved across compatible layouts) - Pre-allocate glow sprite descriptor set once at init instead of allocating from the pool every frame
This commit is contained in:
parent
77012adbc6
commit
efc7e65dfc
3 changed files with 58 additions and 74 deletions
|
|
@ -1475,17 +1475,14 @@ void WMORenderer::render(VkCommandBuffer cmd, VkDescriptorSet perFrameSet, const
|
|||
neededPipeline = 1; // transparent (alpha blend, no depth write)
|
||||
}
|
||||
|
||||
// Switch pipeline if needed
|
||||
// Switch pipeline if needed (descriptor sets and push constants
|
||||
// are preserved across compatible pipeline layout switches)
|
||||
if (neededPipeline != currentPipelineKind) {
|
||||
VkPipeline targetPipeline = activePipeline;
|
||||
if (neededPipeline == 1) targetPipeline = transparentPipeline_;
|
||||
else if (neededPipeline == 2) targetPipeline = glassPipeline_;
|
||||
|
||||
vkCmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, targetPipeline);
|
||||
vkCmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout_,
|
||||
0, 1, &perFrameSet, 0, nullptr);
|
||||
vkCmdPushConstants(cmd, pipelineLayout_, VK_SHADER_STAGE_VERTEX_BIT,
|
||||
0, sizeof(GPUPushConstants), &push);
|
||||
currentPipelineKind = neededPipeline;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue