mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-24 16:10:14 +00:00
Batch GPU uploads to eliminate per-upload fence waits (stutter fix)
Every uploadBuffer/VkTexture::upload called immediateSubmit which did a separate vkQueueSubmit + vkWaitForFences. Loading a single creature model with textures caused 4-8+ fence waits; terrain chunks caused 80+ per batch. Added beginUploadBatch/endUploadBatch to VkContext: records all upload commands into a single command buffer, submits once with one fence wait. Staging buffers are deferred for cleanup after the batch completes. Wrapped in batch mode: - CharacterRenderer::loadModel (creature VB/IB + textures) - M2Renderer::loadModel (doodad VB/IB + textures) - TerrainRenderer::loadTerrain/loadTerrainIncremental (chunk geometry + textures) - TerrainRenderer::uploadPreloadedTextures - WMORenderer::loadModel (group geometry + textures)
This commit is contained in:
parent
884b72bc1c
commit
16b4336700
8 changed files with 97 additions and 4 deletions
|
|
@ -96,7 +96,11 @@ bool VkTexture::upload(VkContext& ctx, const uint8_t* pixels, uint32_t width, ui
|
|||
generateMipmaps(ctx, format, width, height);
|
||||
}
|
||||
|
||||
destroyBuffer(ctx.getAllocator(), staging);
|
||||
if (ctx.isInUploadBatch()) {
|
||||
ctx.deferStagingCleanup(staging);
|
||||
} else {
|
||||
destroyBuffer(ctx.getAllocator(), staging);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -162,7 +166,11 @@ bool VkTexture::uploadMips(VkContext& ctx, const uint8_t* const* mipData,
|
|||
VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
|
||||
});
|
||||
|
||||
destroyBuffer(ctx.getAllocator(), staging);
|
||||
if (ctx.isInUploadBatch()) {
|
||||
ctx.deferStagingCleanup(staging);
|
||||
} else {
|
||||
destroyBuffer(ctx.getAllocator(), staging);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue