VPP  0.8
A high-level modern C++ API for Vulkan
vppSwapChain.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 
44 class SwapChain
45 {
46 public:
48  SwapChain();
49 
76  SwapChain (
77  const Device& hDevice,
78  const Surface& hSurface,
79  unsigned int imageCount = 0,
80  VkPresentModeKHR imageQueuingMode = VK_PRESENT_MODE_MAILBOX_KHR,
81  const SwapChain& hReplacedSwapChain = SwapChain() );
82 
84  bool valid() const;
85 
87  VkSwapchainKHR handle() const;
88 
90  const Device& device() const;
91 
93  const Surface& surface() const;
94 
96  size_t views() const;
97 
99  FrameImageView view ( size_t index ) const;
100 
112  unsigned int acquireDisplayImage ( const Queue& hQueue );
113 
125  void presentDisplayImage ( const Queue& hQueue, unsigned int iImage );
126 };
127 
128 // -----------------------------------------------------------------------------
129 } // namespace vpp
130 // -----------------------------------------------------------------------------
Represents logical rendering device.
Definition: vppDevice.hpp:49
Untyped image view class. Useful for constructing FrameBuffer objects.
Definition: vppFrameImageView.hpp:46
const Surface & surface() const
Retrieves the surface.
bool valid() const
Checks whether this SwapChain object refers to a valid swapchain.
Represents a set of swappable on-screen images.
Definition: vppSwapChain.hpp:44
const Device & device() const
Retrieves the device.
The VPP namespace.
Definition: main.hpp:1
SwapChain()
Constructs null reference.
Represents a surface visible on the screen.
Definition: vppSurface.hpp:59
unsigned int acquireDisplayImage(const Queue &hQueue)
Acquires and locks an image view for rendering.
VkSwapchainKHR handle() const
Retrieves the Vulkan handle.
void presentDisplayImage(const Queue &hQueue, unsigned int iImage)
Schedules an image view for display.
FrameImageView view(size_t index) const
Retrieves the image view for given index.
Command queue for execution of commands.
Definition: vppQueue.hpp:65
size_t views() const
Retrieves the number of images in the swapchain.