mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-07 01:53:24 +09:00
[Perf] (Magma): texture level uploads stop waiting for the GPU to drain; queue order and the upload barrier already order them (rd12 monolith 70.4 -> 83.4, openra 367 -> 745 fps).
This commit is contained in:
@@ -1464,7 +1464,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
// Submit older renderer work before adding the new bytes to the batch,
|
||||
// otherwise Draw(old T), TexSubImage(T), Draw(new T) can upload before
|
||||
// the first draw. A clean texture never reaches this submission boundary.
|
||||
if (pVulkanRenderer && !pVulkanRenderer->FlushWirePendingCommandsForTextureUpdate()) {
|
||||
if (pVulkanRenderer && !pVulkanRenderer->FlushWirePendingCommandsForTextureUpload()) {
|
||||
MGL_WIRE_DECLINE_AT(UploadFlushFailed,
|
||||
"texture {slot=%u, gen=%u}: earlier renderer work could not be submitted before "
|
||||
"its upload batch",
|
||||
|
||||
@@ -155,6 +155,16 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
if (HasPendingRecordedWork() && !FlushPendingCommands()) return false;
|
||||
return WaitForSubmitsUpTo(m_submitCounter, UINT64_MAX);
|
||||
}
|
||||
// The level-upload arm's half of the above, WITHOUT the CPU wait. Its bytes go through a
|
||||
// staging buffer into an upload batch that is submitted on this same queue after this
|
||||
// flush, and the batch's first barrier takes its source scope from the image's tracked
|
||||
// layout (ALL_COMMANDS for GENERAL, the sampled-read stages for a read-only layout), so
|
||||
// queue submission order already puts every earlier draw's access to the old texels
|
||||
// ahead of the copy. The preserve arm keeps the wait: it retires the old image.
|
||||
// (rd12 Magma: the wait was ~1.8 ms/frame of fence stall, one per lightmap update.)
|
||||
Bool FlushWirePendingCommandsForTextureUpload() {
|
||||
return !HasPendingRecordedWork() || FlushPendingCommands();
|
||||
}
|
||||
// P7 wave 2 package B3: the submission that will carry whatever is recorded NEXT.
|
||||
// RetireWireObjects (WireDraw.inc) already tags future objects with exactly this, and
|
||||
// for the same reason: a draw being set up now is not in any submission yet, so the
|
||||
|
||||
Reference in New Issue
Block a user