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 Multiple Frames in Flight #932

Closed
cwfitzgerald opened this issue Sep 21, 2020 · 3 comments
Closed

Allow Multiple Frames in Flight #932

cwfitzgerald opened this issue Sep 21, 2020 · 3 comments
Labels
area: api Issues related to API surface type: enhancement New feature or request

Comments

@cwfitzgerald
Copy link
Member

cwfitzgerald commented Sep 21, 2020

Description

In order to get full use of the gpu, multiple frames should be in flight so the gpu doesn't have to wait for the cpu.

Repro steps

I have an example of what I think is needed to have multiple frames in flight to the hello-triangle example on a branch here: cwfitzgerald/wgpu-rs@6763396. This panics as I can't acquire more than one swapchain frame at a time.

Extra materials

https://github.com/gfx-rs/wgpu/blob/master/wgpu-core/src/swap_chain.rs#L194-L196 This code is spawning the error. To get this working, more than one outstanding frame would need to be able to be tracked, maybe up to some limit.

Note

There might be some extra complexity here, but I was discussing this on a vulkan discord channel, so I had to sift through a lot of vulkan specifics to get to how it all works. My understanding at this point is that this is all that is needed, but I could be very wrong.

@kvark kvark added area: api Issues related to API surface type: enhancement New feature or request labels Sep 21, 2020
@cwfitzgerald
Copy link
Member Author

An interesting extension to this is what happens when a resize event is received. As far as I know, you need to get a new swapchain before the next presentation, or you'll hit vulkan issues. If there is a frame in the delay slot, and you get a resize event, there is no way in the api to cancel the presentation of that frame. I'm not entirely sure this'll be an issue, but something to keep in mind as we progress.

@kvark
Copy link
Member

kvark commented Sep 21, 2020

We need to move from "drop" semantics to explicit present() call - https://github.com/gfx-rs/wgpu-rs/issues/558. This will allow discarding those frames.

@cwfitzgerald
Copy link
Member Author

I had no idea what I was talking about at this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: api Issues related to API surface type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants