From d18362e54272882b95c86e07ebd5b2b7175d6b1f Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Thu, 7 Sep 2017 15:53:05 +1000 Subject: [PATCH] physical_device: add surface queries --- physical_device.cpp | 27 +++++++++++++++++++++++++-- physical_device.hpp | 5 ++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/physical_device.cpp b/physical_device.cpp index 58527da..e0eed2c 100644 --- a/physical_device.cpp +++ b/physical_device.cpp @@ -18,6 +18,7 @@ #include "./physical_device.hpp" #include "./except.hpp" +#include "./surface.hpp" using cruft::vk::physical_device; @@ -61,10 +62,10 @@ physical_device::features (void) const //----------------------------------------------------------------------------- VkSurfaceCapabilitiesKHR -physical_device::surface_capabilities (VkSurfaceKHR surface) const +physical_device::surface_capabilities (surface &_surface) const { return error::try_query ( - vkGetPhysicalDeviceSurfaceCapabilitiesKHR, id (), surface + vkGetPhysicalDeviceSurfaceCapabilitiesKHR, id (), _surface.id () ); } @@ -94,6 +95,28 @@ physical_device::queue_families (void) const } +/////////////////////////////////////////////////////////////////////////////// +std::vector +physical_device::surface_formats (surface &_surface) +{ + return error::try_array ( + vkGetPhysicalDeviceSurfaceFormatsKHR, + id (), _surface.id () + ); +} + + +//----------------------------------------------------------------------------- +std::vector +physical_device::present_modes (surface &_surface) +{ + return error::try_array ( + vkGetPhysicalDeviceSurfacePresentModesKHR, + id (), _surface.id () + ); +} + + /////////////////////////////////////////////////////////////////////////////// std::string physical_device::name (void) const diff --git a/physical_device.hpp b/physical_device.hpp index 65a29b6..d65ac8f 100644 --- a/physical_device.hpp +++ b/physical_device.hpp @@ -33,11 +33,14 @@ namespace cruft::vk { VkPhysicalDeviceProperties properties (void) const; VkPhysicalDeviceFeatures features (void) const; - VkSurfaceCapabilitiesKHR surface_capabilities (VkSurfaceKHR) const; + VkSurfaceCapabilitiesKHR surface_capabilities (surface&) const; VkPhysicalDeviceMemoryProperties memory_properties (void) const; std::vector queue_families (void) const; + std::vector surface_formats (surface&); + std::vector present_modes (surface&); + std::string name (void) const; }; }