HoviTron Video Pipeline
SwapchainCommon.h
Go to the documentation of this file.
1/* ----------------------
2* Copyright 2023 Université Libre de Bruxelles(ULB), Universidad Politécnica de Madrid(UPM), CREAL, Deutsches Zentrum für Luft - und Raumfahrt(DLR)
3
4* Licensed under the Apache License, Version 2.0 (the "License");
5* you may not use this file except in compliance with the License.
6* You may obtain a copy of the License at < http://www.apache.org/licenses/LICENSE-2.0>
7
8* Unless required by applicable law or agreed to in writing, software
9* distributed under the License is distributed on an "AS IS" BASIS,
10* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11* See the License for the specific language governing permissionsand
12* limitations under the License.
13---------------------- */
14
15
16
17/*****************************************************************/
24#pragma once
25#include "SwapchainAbstract.h"
27
28class WindowAbstract;
29
37public:
39 SwapchainCommon(VkSurfaceKHR & surface, WindowAbstract* window, VulkanWrapper* wrapper);
41 std::tuple<uint32_t, std::optional<vk::Semaphore> > acquireImage() override;
43 void presentImage(uint32_t imageIndex, vk::Semaphore & renderingFinnished) override;
45 void presentImage(uint32_t imageIndex, vk::Fence & renderingFinnishedFence) override;
47 vk::ImageView getSwapchainImageView(int elem) override;
49 vk::Image getSwapchainImage(int index) override;
51 void cleanup() override;
53 int getAttachmentSize() override;
55 vk::Image getCurrentImage() override;
56
57
58
59private:
61 vk::SurfaceFormatKHR chooseSwapSurfaceFormat(const std::vector<vk::SurfaceFormatKHR>& availableFormats);
63 vk::PresentModeKHR chooseSwapPresentMode(const std::vector<vk::PresentModeKHR>& availablePresentModes);
65 vk::Extent2D chooseSwapExtent(const vk::SurfaceCapabilitiesKHR& capabilities);
67 void createSwapchainImageView();
69 void createAcquireSemaphores();
70
72 uint32_t currentFrame = 0;
74 std::vector<vk::Image> swapChainImages;
76 vk::SwapchainKHR swapChain = nullptr;
78 std::vector<vk::Semaphore> imageAvailableSemaphores;
79};
Contains the class that encapsulate the notion of Swapchain: SwapchainAbstract.
Encapsulate the notion of Swapchain.
WindowAbstract * window
Class that encapsulate a vkSwapchainHHR object and the methods linked to it.
vk::Image getSwapchainImage(int index) override
vk::Image getCurrentImage() override
void presentImage(uint32_t imageIndex, vk::Semaphore &renderingFinnished) override
int getAttachmentSize() override
std::tuple< uint32_t, std::optional< vk::Semaphore > > acquireImage() override
void cleanup() override
vk::ImageView getSwapchainImageView(int elem) override
Class that manages the classes related to Vulkan code and act as a wrapper around them.
Definition: VulkanWrapper.h:66
Abstraction of the way of the result is displayed (screen or HMD).
file that contains the common include for the Vulkan part