mirror of
https://github.com/storytold/wgpu.git
synced 2026-12-01 10:34:57 +01:00
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:
1 parent
051d08424c
commit
fe95fddf5a
3 files changed
+21
-10
No files matched your search
@@ -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
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user