Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Metal allows you to present surfaces at exact times. You have access to the display refresh timing information and it's your job to synchronise your drawing rate to (potentially variable) display presentation interval. Vulkan presentation modes are workarounds over the fact that Vulkan provides no fine-grained control over presentation intervals.

There is the VK_GOOGLE_display_timing extension that provides functionality similar to Metal, but it doesn't seem like it's well supported on desktop. The equivalent official extension seems to be stuck in limbo somewhere.



Sounds really fine-grained, but does this mean I have to invent my own "mailbox" every time I want "unlimited refresh rate with minimal input lag, but without tearing"?


I think it should be as easy as not presenting a drawable if you detect that the previous frame is still rendering. Should be solvable by adding a single conditional guard to the command buffer completion handler. Never did that myself as I don't have a use case for it, so I might be underestimating the challenge.

Note that mailbox approach does not really give you unlimited refresh rate, as you are bound by the number of drawables/swapchain images your driver can supply. If your drawing is very fast these resources become the bottleneck. If you truly need unlimited framerate (e.g. for benchmarking) the best approach is probably to render to a texture and then blit the last one to a drawable for presentation. And if your goal is "minimal input lag", then you might as well do it right and decouple your simulation and rendering threads.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: