Change present mode to Mailbox
This commit is contained in:
parent
440fc05e55
commit
3f367e19ac
19
src/app.rs
19
src/app.rs
|
@ -16,7 +16,10 @@ use vulkano_util::{
|
||||||
context::{VulkanoConfig, VulkanoContext},
|
context::{VulkanoConfig, VulkanoContext},
|
||||||
window::VulkanoWindows,
|
window::VulkanoWindows,
|
||||||
};
|
};
|
||||||
use winit::{event::{Event, WindowEvent}, window::WindowId};
|
use winit::{
|
||||||
|
event::{Event, WindowEvent},
|
||||||
|
window::WindowId,
|
||||||
|
};
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub struct App {
|
pub struct App {
|
||||||
|
@ -37,7 +40,6 @@ pub struct App {
|
||||||
impl App {
|
impl App {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let mut events = Events::new();
|
let mut events = Events::new();
|
||||||
|
|
||||||
let (tx, rx) = flume::unbounded();
|
let (tx, rx) = flume::unbounded();
|
||||||
events.subscribe_custom(tx);
|
events.subscribe_custom(tx);
|
||||||
|
|
||||||
|
@ -103,19 +105,24 @@ impl App {
|
||||||
&self.vk_context,
|
&self.vk_context,
|
||||||
&vulkano_util::window::WindowDescriptor {
|
&vulkano_util::window::WindowDescriptor {
|
||||||
title: self.name.clone(),
|
title: self.name.clone(),
|
||||||
present_mode: vulkano::swapchain::PresentMode::Fifo,
|
present_mode: vulkano::swapchain::PresentMode::Mailbox,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
|_| {},
|
|_| {},
|
||||||
);
|
);
|
||||||
|
|
||||||
let renderer = self.vk_windows.get_renderer(window).unwrap();
|
let renderer = self.vk_windows.get_renderer(window).unwrap();
|
||||||
|
|
||||||
let gui = Gui::new(
|
let gui = Gui::new(
|
||||||
event_loop,
|
event_loop,
|
||||||
renderer.surface().clone(),
|
renderer.surface().clone(),
|
||||||
renderer.graphics_queue().clone(),
|
renderer.graphics_queue().clone(),
|
||||||
renderer.swapchain_format(),
|
renderer.swapchain_format(),
|
||||||
GuiConfig { is_overlay: true, allow_srgb_render_target: false, ..Default::default() },
|
GuiConfig {
|
||||||
|
is_overlay: true,
|
||||||
|
allow_srgb_render_target: false,
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
self.guis.insert(window, gui);
|
self.guis.insert(window, gui);
|
||||||
|
@ -181,12 +188,12 @@ impl App {
|
||||||
gui.update(window, event);
|
gui.update(window, event);
|
||||||
}
|
}
|
||||||
Event::AboutToWait => {
|
Event::AboutToWait => {
|
||||||
for (window_id, _) in self.vk_windows.iter() {
|
self.vk_windows.iter().for_each(|(window_id, _)| {
|
||||||
self.vk_windows
|
self.vk_windows
|
||||||
.get_window(*window_id)
|
.get_window(*window_id)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.request_redraw()
|
.request_redraw()
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ fn main() -> Result<()> {
|
||||||
|
|
||||||
let mut app = App::new(); // TODO: Move renderer into App
|
let mut app = App::new(); // TODO: Move renderer into App
|
||||||
app.create_window(&event_loop);
|
app.create_window(&event_loop);
|
||||||
|
|
||||||
app.push_module(ConfigModule::new);
|
app.push_module(ConfigModule::new);
|
||||||
app.push_module(WindowModule::new);
|
app.push_module(WindowModule::new);
|
||||||
app.push_render_module(RenderModule::new);
|
app.push_render_module(RenderModule::new);
|
||||||
|
|
|
@ -167,8 +167,13 @@ mod vs {
|
||||||
|
|
||||||
layout(location = 0) in vec2 position;
|
layout(location = 0) in vec2 position;
|
||||||
|
|
||||||
|
layout(location = 0) out vec3 fragColor;
|
||||||
|
|
||||||
|
vec3 colors[3] = vec3[](vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0));
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
gl_Position = vec4(position, 0.0, 1.0);
|
gl_Position = vec4(position, 0.0, 1.0);
|
||||||
|
fragColor = colors[gl_VertexIndex];
|
||||||
}
|
}
|
||||||
",
|
",
|
||||||
}
|
}
|
||||||
|
@ -180,10 +185,12 @@ mod fs {
|
||||||
src: r"
|
src: r"
|
||||||
#version 450
|
#version 450
|
||||||
|
|
||||||
|
layout(location = 0) in vec3 fragColor;
|
||||||
|
|
||||||
layout(location = 0) out vec4 f_color;
|
layout(location = 0) out vec4 f_color;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
f_color = vec4(1.0, 0.0, 0.0, 1.0);
|
f_color = vec4(fragColor, 1.0);
|
||||||
}
|
}
|
||||||
",
|
",
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue