VPP  0.8
A high-level modern C++ API for Vulkan
vppSurface.hpp
1 /*
2  Copyright 2016-2018 SOFT-ERG, Przemek Kuczmierczyk (www.softerg.com)
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without modification,
6  are permitted provided that the following conditions are met:
7 
8  1. Redistributions of source code must retain the above copyright notice,
9  this list of conditions and the following disclaimer.
10 
11  2. Redistributions in binary form must reproduce the above copyright notice,
12  this list of conditions and the following disclaimer in the documentation
13  and/or other materials provided with the distribution.
14 
15  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
23  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
24  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26 
27 // -----------------------------------------------------------------------------
28 namespace vpp {
29 // -----------------------------------------------------------------------------
30 
37 {
38  #ifdef VK_USE_PLATFORM_WIN32_KHR
39  HINSTANCE hInstance;
40  HWND hWnd;
41  #endif
42 };
43 
44 // -----------------------------------------------------------------------------
59 class Surface
60 {
61 public:
63  Surface();
64 
66  Surface (
67  const SurfaceInfo& surfaceInfo,
68  const PhysicalDevice& hDevice,
69  const Instance& hInstance );
70 
72  Surface (
73  VkSurfaceKHR hSurface,
74  const PhysicalDevice& hDevice,
75  const Instance& hInstance );
76 
78  VkSurfaceKHR handle() const;
79 
81  bool getCapabilities ( VkSurfaceCapabilitiesKHR* pResult ) const;
82 
84  bool getFormats ( SurfaceFormats* pResult ) const;
85 
87  bool getPresentationModes ( PresentationModes* pResult ) const;
88 
90  VkExtent2D getSize() const;
91 
93  VkFormat getDefaultFormat ( VkColorSpaceKHR* pColorSpace = 0 ) const;
94 
96  void getParametersAsText ( std::ostream& sst ) const;
97 };
98 
99 // -----------------------------------------------------------------------------
100 } // namespace vpp
101 // -----------------------------------------------------------------------------
VkSurfaceKHR handle() const
Retrieves the Vulkan handle.
The VPP namespace.
Definition: main.hpp:1
Represents a surface visible on the screen.
Definition: vppSurface.hpp:59
Surface()
Constructs null reference.
VkExtent2D getSize() const
Retrieves the surface size in pixels.
Represents physical rendering device.
Definition: vppPhysicalDevice.hpp:258
VkFormat getDefaultFormat(VkColorSpaceKHR *pColorSpace=0) const
Retrieves the default format and color space.
bool getFormats(SurfaceFormats *pResult) const
Retrieves a list of formats supported by the surface.
Represents the instance of Vulkan system.
Definition: vppInstance.hpp:115
bool getPresentationModes(PresentationModes *pResult) const
Retrieves a list of queuing modes supported by the surface.
bool getCapabilities(VkSurfaceCapabilitiesKHR *pResult) const
Retrieves surface capabilities.
void getParametersAsText(std::ostream &sst) const
Retrieves various surface parameters in text format for diagnostic logging.
A platform-dependent structure containing information required to create a surface.
Definition: vppSurface.hpp:36