physical_device: add surface queries

This commit is contained in:
Danny Robson 2017-09-07 15:53:05 +10:00
parent 140a94759f
commit d18362e542
2 changed files with 29 additions and 3 deletions

View File

@ -18,6 +18,7 @@
#include "./physical_device.hpp" #include "./physical_device.hpp"
#include "./except.hpp" #include "./except.hpp"
#include "./surface.hpp"
using cruft::vk::physical_device; using cruft::vk::physical_device;
@ -61,10 +62,10 @@ physical_device::features (void) const
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
VkSurfaceCapabilitiesKHR VkSurfaceCapabilitiesKHR
physical_device::surface_capabilities (VkSurfaceKHR surface) const physical_device::surface_capabilities (surface &_surface) const
{ {
return error::try_query ( return error::try_query (
vkGetPhysicalDeviceSurfaceCapabilitiesKHR, id (), surface vkGetPhysicalDeviceSurfaceCapabilitiesKHR, id (), _surface.id ()
); );
} }
@ -94,6 +95,28 @@ physical_device::queue_families (void) const
} }
///////////////////////////////////////////////////////////////////////////////
std::vector<VkSurfaceFormatKHR>
physical_device::surface_formats (surface &_surface)
{
return error::try_array (
vkGetPhysicalDeviceSurfaceFormatsKHR,
id (), _surface.id ()
);
}
//-----------------------------------------------------------------------------
std::vector<VkPresentModeKHR>
physical_device::present_modes (surface &_surface)
{
return error::try_array (
vkGetPhysicalDeviceSurfacePresentModesKHR,
id (), _surface.id ()
);
}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
std::string std::string
physical_device::name (void) const physical_device::name (void) const

View File

@ -33,11 +33,14 @@ namespace cruft::vk {
VkPhysicalDeviceProperties properties (void) const; VkPhysicalDeviceProperties properties (void) const;
VkPhysicalDeviceFeatures features (void) const; VkPhysicalDeviceFeatures features (void) const;
VkSurfaceCapabilitiesKHR surface_capabilities (VkSurfaceKHR) const; VkSurfaceCapabilitiesKHR surface_capabilities (surface&) const;
VkPhysicalDeviceMemoryProperties memory_properties (void) const; VkPhysicalDeviceMemoryProperties memory_properties (void) const;
std::vector<VkQueueFamilyProperties> queue_families (void) const; std::vector<VkQueueFamilyProperties> queue_families (void) const;
std::vector<VkSurfaceFormatKHR> surface_formats (surface&);
std::vector<VkPresentModeKHR> present_modes (surface&);
std::string name (void) const; std::string name (void) const;
}; };
} }