Skip to content

Add PresentMode::Mailbox#512

Merged
bors[bot] merged 2 commits intogfx-rs:masterfrom
aloucks:mailbox
Mar 6, 2020
Merged

Add PresentMode::Mailbox#512
bors[bot] merged 2 commits intogfx-rs:masterfrom
aloucks:mailbox

Conversation

@aloucks
Copy link
Copy Markdown
Contributor

@aloucks aloucks commented Mar 5, 2020

@kvark

Would you be open to renaming the presents modes to match the vulkan/gfx-hal nomenclature? Considering these aren't part of the webgpu spec, I think it would make more sense to keep things consistent.

I can update this PR if you're good with it.

pub enum PresentMode {
    /// The presentation engine does **not** wait for a vertical blanking period and 
    /// the request is presented immediately. This is a low-latency presentation mode,
    /// but visible tearing may be observed. Will fallback to `Fifo` if unavailable on the
    /// selected  platform and backend. Not optimal for mobile. 
    Immediate = 0,
    /// The presentation engine waits for the next vertical blanking period to update
    /// the current image, but frames may be submitted without delay. This is a low-latency 
    /// presentation mode and visible tearing will **not** be observed. Will fallback to `Fifo`
    /// if unavailable on the selected platform and backend. Not optimal for mobile.
    Mailbox = 1,
    /// The presentation engine waits for the next vertical blanking period to update 
    /// the current image. The framerate will be capped at the display refresh rate, 
    /// corresponding to the `VSync`. Tearing cannot be observed. Optimal for mobile.
    Fifo = 2,
}

@kvark
Copy link
Copy Markdown
Member

kvark commented Mar 6, 2020

I think the old names were good when there was only on/off option. With more options, we need better names, and your suggestion sounds fine by me, but only under one condition: if the implementation is able to silently fall back if Mailbox is not supported by the backend.

@aloucks
Copy link
Copy Markdown
Contributor Author

aloucks commented Mar 6, 2020

It falls back to FIFO if not supported:

if !caps.present_modes.contains(config.present_mode) {
log::warn!(
"Surface does not support present mode: {:?}, falling back to {:?}",
config.present_mode,
hal::window::PresentMode::FIFO
);
config.present_mode = hal::window::PresentMode::FIFO;
}

Copy link
Copy Markdown
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, sounds good!
bors r+

@bors
Copy link
Copy Markdown
Contributor

bors bot commented Mar 6, 2020

Build succeeded

@bors bors bot merged commit 79e9ab7 into gfx-rs:master Mar 6, 2020
@kvark kvark mentioned this pull request Mar 13, 2020
kvark pushed a commit to kvark/wgpu that referenced this pull request Jun 3, 2021
512: Convert to using independent subscriber implementation r=kvark a=cwfitzgerald

gfx-rs#881 but for wgpu-rs.

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
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.

2 participants