enabel vsync
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
const DUMP_SPV_TO_FILE: bool = false;
|
const DUMP_SPV_TO_FILE: bool = false;
|
||||||
const PIPELINE_CACHING: bool = false;
|
const PIPELINE_CACHING: bool = false;
|
||||||
const IGNORE_STENCIL: bool = true;
|
const IGNORE_STENCIL: bool = true;
|
||||||
|
const VSYNC: bool = true;
|
||||||
|
|
||||||
const DEFAULT_SUBDIVISION: u32 = 16;
|
const DEFAULT_SUBDIVISION: u32 = 16;
|
||||||
const MAXIMUM_SUBDIVISION: u32 = 64;
|
const MAXIMUM_SUBDIVISION: u32 = 64;
|
||||||
@@ -678,6 +679,9 @@ impl ApplicationHandler for App {
|
|||||||
let window_size = window.inner_size();
|
let window_size = window.inner_size();
|
||||||
|
|
||||||
let (swapchain, images) = {
|
let (swapchain, images) = {
|
||||||
|
let present_mode = if VSYNC {
|
||||||
|
PresentMode::Fifo
|
||||||
|
} else {
|
||||||
let present_modes = self
|
let present_modes = self
|
||||||
.device
|
.device
|
||||||
.physical_device()
|
.physical_device()
|
||||||
@@ -687,7 +691,8 @@ impl ApplicationHandler for App {
|
|||||||
let present_mode = present_modes
|
let present_mode = present_modes
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.min_by_key(|p| {
|
.min_by_key(|p| {
|
||||||
// We assign a lower score to device types that are likely to be faster/better.
|
// We assign a lower score to device types that are likely to be
|
||||||
|
// faster/better.
|
||||||
match p {
|
match p {
|
||||||
PresentMode::Mailbox => 0,
|
PresentMode::Mailbox => 0,
|
||||||
PresentMode::FifoRelaxed => 1,
|
PresentMode::FifoRelaxed => 1,
|
||||||
@@ -697,6 +702,8 @@ impl ApplicationHandler for App {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
present_mode
|
||||||
|
};
|
||||||
|
|
||||||
info!("Using present mode {:?}.", present_mode);
|
info!("Using present mode {:?}.", present_mode);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user