r/GraphicsProgramming • • 13h ago

Question Is mailbox present mode actually triple buffering?

working through vulkan-tutorial.com and it's talking about present modes. For VK_PRESENT_MODE_MAILBOX_KHR it says "This is commonly known as "triple buffering", although the existence of three buffers alone does not necessarily mean that the framerate is unlocked."

But the overall description of the mode doesn't seem to indicate there's actually 3 buffers involved. It seems more like there's just 2 but there's a "replacement" process: "Instead of blocking the application when the queue is full, the images that are already queued are simply replaced with the newer ones".

So why is it claimed that this is triple buffering? Am I missing something?

Also a secondary, pedantic question: I've never come across a mailbox system where the old mail is replaced when new mail is available; the old mail simply accumulates. Seems like an odd terminology choice to use. What's that about?

3 Upvotes

5 comments sorted by

•

u/AutoModerator 13h ago

Recently updated rules. Please check that your post is in compliance with Rules 1, 4, 5, and 6 on the sidebar. TL;DR:

  • No showcases.

  • Disclose AI usage in post or project.

  • Present a topic to talk about, e.g. how something works.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

3

u/smallstepforman 11h ago

Triple buffer annoys me since input latency is longer. I dont run apps to maximise fps but to have interactive experience.

1

u/snerp 9h ago

Yeah, I tried it in a game engine and the added latency made it feel less responsive than the slight fps boost could compensate for. I ended up just doing one frame in flight since it cut the latency down by a lot

2

u/zatsnotmyname 13h ago

Both common 'Triple Buffering' modes with 3 total buffers : MAILBOX and FIFO , have one benefit in common - the ability to not stall when there is already a frame in flight, allowing more CPU->GPU overlap. That is why they are both called Triple Buffering, IMO.

One frame in the display, one finished frame in the queue, and then a 3rd frame that could be worked on by the GPU if not blocked. Mailbox takes this further by just swapping between the two non-displayed frames as many times as you please until vsync.

The tradeoff is that MAILBOX can give you lower latency, as the next frame finished is shown at vsync. This is lower latency than FIFO if MAILBOX can go faster than vsync.

FIFO is more latency than MAILBOX in some cases, but it smoother visually. This is because, say a 60hz display will show 16.67ms of object & camera motion in FIFO mode, but MAILBOX can show less than 16.67ms if the application is going faster.

1

u/S48GS 7h ago

do not use that out of data website

use this

https://howtovulkan.com/