diff --git a/vulkano/src/swapchain/display.rs b/vulkano/src/swapchain/display.rs index 61892e7a..b4575284 100644 --- a/vulkano/src/swapchain/display.rs +++ b/vulkano/src/swapchain/display.rs @@ -34,6 +34,7 @@ use vk; /// ? // TODO: plane capabilities +// TODO: store properties in the instance? pub struct DisplayPlane { instance: Arc, physical_device: usize, @@ -112,6 +113,12 @@ impl DisplayPlane { PhysicalDevice::from_index(&self.instance, self.physical_device).unwrap() } + /// Returns the index of the plane. + #[inline] + pub fn index(&self) -> u32 { + self.index + } + /// Returns true if this plane supports the given display. #[inline] pub fn supports(&self, display: &Display) -> bool { diff --git a/vulkano/src/swapchain/surface.rs b/vulkano/src/swapchain/surface.rs index 37a69fe3..25b2136d 100644 --- a/vulkano/src/swapchain/surface.rs +++ b/vulkano/src/swapchain/surface.rs @@ -56,8 +56,7 @@ impl Surface { pub fn from_display_mode(display_mode: &DisplayMode, plane: &DisplayPlane) -> Result, SurfaceCreationError> { - unimplemented!() // TODO: - /*if !display_mode.display().physical_device().instance().loaded_extensions().khr_display { + if !display_mode.display().physical_device().instance().loaded_extensions().khr_display { return Err(SurfaceCreationError::MissingExtension { name: "VK_KHR_display" }); } @@ -74,14 +73,14 @@ impl Surface { pNext: ptr::null(), flags: 0, // reserved displayMode: display_mode.internal_object(), - planeIndex: plane.index, - planeStackIndex: plane.properties.currentStackIndex, + planeIndex: plane.index(), + planeStackIndex: 0, // FIXME: plane.properties.currentStackIndex, transform: vk::SURFACE_TRANSFORM_IDENTITY_BIT_KHR, // TODO: let user choose globalAlpha: 0.0, // TODO: let user choose alphaMode: vk::DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR, // TODO: let user choose imageExtent: vk::Extent2D { // TODO: let user choose - width: display_mode.parameters.visibleRegion.width, - height: display_mode.parameters.visibleRegion.height, + width: display_mode.visible_region()[0], + height: display_mode.visible_region()[1], }, }; @@ -94,7 +93,8 @@ impl Surface { Ok(Arc::new(Surface { instance: instance.clone(), surface: surface, - }))*/ + has_swapchain: AtomicBool::new(false), + })) } /// Creates a `Surface` from a Win32 window.