Use vulkan nomenclature for PresentMode variants

https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkPresentModeKHR.html
This commit is contained in:
Aaron Loucks committed 2020-03-06 00:48:45 -05:00
1 parent 051d08424c
commit fe95fddf5a
3 files changed
+21 -10

No files matched your search

+2 -2
View File
@@ -208,7 +208,7 @@ int main() {
.format = WGPUTextureFormat_Bgra8Unorm,
.width = prev_width,
.height = prev_height,
.present_mode = WGPUPresentMode_Vsync,
.present_mode = WGPUPresentMode_Fifo,
});
while (!glfwWindowShouldClose(window)) {
@@ -225,7 +225,7 @@ int main() {
.format = WGPUTextureFormat_Bgra8Unorm,
.width = width,
.height = height,
.present_mode = WGPUPresentMode_Vsync,
.present_mode = WGPUPresentMode_Fifo,
});
}
+3 -3
View File
@@ -126,9 +126,9 @@ typedef enum {
} WGPUPowerPreference;
typedef enum {
WGPUPresentMode_NoVsync = 0,
WGPUPresentMode_Vsync = 1,
WGPUPresentMode_Mailbox = 2,
WGPUPresentMode_Immediate = 0,
WGPUPresentMode_Mailbox = 1,
WGPUPresentMode_Fifo = 2,
} WGPUPresentMode;
typedef enum {
+16 -5
View File
@@ -63,9 +63,20 @@ pub struct SwapChain<B: hal::Backend> {
#[repr(C)]
#[derive(Copy, Clone, Debug)]
pub enum PresentMode {
NoVsync = 0,
Vsync = 1,
Mailbox = 2,
/// 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,
}
#[repr(C)]
@@ -94,9 +105,9 @@ impl SwapChainDescriptor {
config.image_usage = conv::map_texture_usage(self.usage, hal::format::Aspects::COLOR);
config.composite_alpha_mode = hal::window::CompositeAlphaMode::OPAQUE;
config.present_mode = match self.present_mode {
PresentMode::NoVsync => hal::window::PresentMode::IMMEDIATE,
PresentMode::Vsync => hal::window::PresentMode::FIFO,
PresentMode::Immediate => hal::window::PresentMode::IMMEDIATE,
PresentMode::Mailbox => hal::window::PresentMode::MAILBOX,
PresentMode::Fifo => hal::window::PresentMode::FIFO,
};
config
}