vsync
This commit is contained in:
@@ -2,7 +2,7 @@ use std::{convert::TryInto, fs};
|
|||||||
|
|
||||||
use serde_derive::{Deserialize, Serialize};
|
use serde_derive::{Deserialize, Serialize};
|
||||||
use toml;
|
use toml;
|
||||||
use vulkano::image::SampleCount;
|
use vulkano::{image::SampleCount, swapchain::PresentMode};
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
|
||||||
pub struct LogConfigInput {
|
pub struct LogConfigInput {
|
||||||
@@ -27,7 +27,8 @@ impl LogConfig {
|
|||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
|
||||||
pub struct RenderConfig {
|
pub struct RenderConfig {
|
||||||
pub msaa_samples: u32
|
pub msaa_samples: u32,
|
||||||
|
pub vsync: PresentModeConfig,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RenderConfig {
|
impl RenderConfig {
|
||||||
@@ -38,4 +39,23 @@ impl RenderConfig {
|
|||||||
pub fn get_msaa(&self) -> Option<SampleCount> {
|
pub fn get_msaa(&self) -> Option<SampleCount> {
|
||||||
if self.msaa_samples > 0 { self.msaa_samples.try_into().ok() } else { None }
|
if self.msaa_samples > 0 { self.msaa_samples.try_into().ok() } else { None }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
|
||||||
|
pub enum PresentModeConfig {
|
||||||
|
Immediate,
|
||||||
|
Mailbox,
|
||||||
|
Fifo,
|
||||||
|
FifoRelaxed,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Into<PresentMode> for PresentModeConfig {
|
||||||
|
fn into(self) -> PresentMode {
|
||||||
|
match self {
|
||||||
|
PresentModeConfig::Immediate => PresentMode::Immediate,
|
||||||
|
PresentModeConfig::Mailbox => PresentMode::Mailbox,
|
||||||
|
PresentModeConfig::Fifo => PresentMode::Fifo,
|
||||||
|
PresentModeConfig::FifoRelaxed => PresentMode::Relaxed,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -245,7 +245,7 @@ impl VulkanRenderer {
|
|||||||
.sharing_mode(&queue)
|
.sharing_mode(&queue)
|
||||||
.transform(SurfaceTransform::Identity)
|
.transform(SurfaceTransform::Identity)
|
||||||
.composite_alpha(alpha)
|
.composite_alpha(alpha)
|
||||||
.present_mode(PresentMode::Fifo)
|
.present_mode(render_config.vsync.into())
|
||||||
.fullscreen_exclusive(FullscreenExclusive::Default)
|
.fullscreen_exclusive(FullscreenExclusive::Default)
|
||||||
.clipped(true)
|
.clipped(true)
|
||||||
.color_space(color_space)
|
.color_space(color_space)
|
||||||
|
|||||||
Reference in New Issue
Block a user