Rework Surface::is_supported() and update examples

This commit is contained in:
Pierre Krieger 2017-05-26 10:42:03 +02:00
parent 8ada949322
commit 0d918e3779
4 changed files with 7 additions and 7 deletions

View File

@ -36,7 +36,7 @@ fn main() {
let events_loop = winit::EventsLoop::new();
let window = winit::WindowBuilder::new().build_vk_surface(&events_loop, &instance).unwrap();
let queue = physical.queue_families().find(|q| q.supports_graphics() &&
let queue = physical.queue_families().find(|&q| q.supports_graphics() &&
window.surface().is_supported(q).unwrap_or(false))
.expect("couldn't find a graphical queue family");
@ -50,7 +50,7 @@ fn main() {
let queue = queues.next().unwrap();
let (swapchain, images) = {
let caps = window.surface().get_capabilities(&physical).expect("failed to get surface capabilities");
let caps = window.surface().capabilities(physical).expect("failed to get surface capabilities");
let dimensions = caps.current_extent.unwrap_or([1280, 1024]);
let present = caps.present_modes.iter().next().unwrap();

View File

@ -40,7 +40,7 @@ fn main() {
let events_loop = winit::EventsLoop::new();
let window = winit::WindowBuilder::new().build_vk_surface(&events_loop, &instance).unwrap();
let queue = physical.queue_families().find(|q| q.supports_graphics() &&
let queue = physical.queue_families().find(|&q| q.supports_graphics() &&
window.surface().is_supported(q).unwrap_or(false))
.expect("couldn't find a graphical queue family");
@ -55,7 +55,7 @@ fn main() {
let queue = queues.next().unwrap();
let (swapchain, images) = {
let caps = window.surface().get_capabilities(&physical).expect("failed to get surface capabilities");
let caps = window.surface().capabilities(physical).expect("failed to get surface capabilities");
let dimensions = caps.current_extent.unwrap_or([1280, 1024]);
let present = caps.present_modes.iter().next().unwrap();

View File

@ -118,7 +118,7 @@ fn main() {
// queue to handle data transfers in parallel. In this example we only use one queue.
//
// We have to choose which queues to use early on, because we will need this info very soon.
let queue = physical.queue_families().find(|q| {
let queue = physical.queue_families().find(|&q| {
// We take the first queue that supports drawing to our window.
q.supports_graphics() && window.surface().is_supported(q).unwrap_or(false)
}).expect("couldn't find a graphical queue family");
@ -163,7 +163,7 @@ fn main() {
let (swapchain, images) = {
// Querying the capabilities of the surface. When we create the swapchain we can only
// pass values that are allowed by the capabilities.
let caps = window.surface().get_capabilities(&physical)
let caps = window.surface().capabilities(physical)
.expect("failed to get surface capabilities");
// We choose the dimensions of the swapchain to match the current dimensions of the window.

View File

@ -366,7 +366,7 @@ impl Surface {
}
/// Returns true if the given queue family can draw on this surface.
pub fn is_supported(&self, queue: &QueueFamily) -> Result<bool, OomError> {
pub fn is_supported(&self, queue: QueueFamily) -> Result<bool, CapabilitiesError> {
unsafe {
let vk = self.instance.pointers();