Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow waiting on SwapchainAcquireFuture #2080

Merged
merged 1 commit into from
Nov 6, 2022
Merged

Conversation

phire
Copy link
Contributor

@phire phire commented Nov 4, 2022

Changelog:

### Additions
- Allow waiting on `SwapchainAcquireFuture`

Fixes: #1218

It was previously theoretically possible to wait on SwapchainAcquireFuture by dropping it.

But if you dropped it, it became impossible to actually present the image, as then_swapchain_present requires acquire_future to have been joined.

Why might you want to wait for the swapchain acquire?

  • Because my machine (Nvidia on Linux) pegs the cpu at 100% if you don't (like, wtf???)
  • Because that's what Sascha Willems' samples do
  • Because it allows you to lower input latency when running vsynced.

Is this the best design?

There was some discussion on discord about making acquire_next_image return some opaque object that did more things automatically. Or perhaps tracking the acquire state on the image instead of with this future.

But this approach achieve much the same result, and doesn't require invasive refactoring.

@Rua
Copy link
Contributor

Rua commented Nov 5, 2022

It looks good, thanks! Would any of the examples in Vulkano benefit from using this function?

@phire
Copy link
Contributor Author

phire commented Nov 5, 2022

Not an easy question to answer.

You could just add it to all of them: They all seem to use PresentMode::FIFO, and you could argue it's a good idea to always wait after acquire when using PresentMode::FIFO, especially if there are driver implementations out there (like mine) that appear to freak out when you don't.

Or you could argue that unless you are actually accepting input, there is no difference between waiting before building the command buffer, or after command buffer submission.

And with a quick skim though the examples, only one (interactive fractal) that actually accepts input.

@Rua
Copy link
Contributor

Rua commented Nov 5, 2022

Shall I merge this as it is then?

@phire
Copy link
Contributor Author

phire commented Nov 5, 2022

Yeah probably.

It's not really in-scope of the examples to start worrying about input latency.

@Rua Rua merged commit f2158e4 into vulkano-rs:master Nov 6, 2022
Rua added a commit that referenced this pull request Nov 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Waiting on SwapchainAcquireFuture without dropping it
2 participants