HoviTron Video Pipeline
WindowAbstract.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/*****************************************************************/
22#pragma once
23
25#include<vector>
26#include<set>
27#include<string>
28#include <map>
29#include <memory>
30#include "SwapchainAbstract.h"
31
32
33
34class VulkanContext;
35class VulkanDrawing;
36class VulkanWrapper;
37
45 public:
47 virtual void initWindow() = 0;
49 virtual void continueInit() = 0;
51 virtual void cleanUp() = 0;
53 virtual void cleanUpSurface() = 0;
55 virtual void mainLoop(VulkanDrawing * vulkanDrawing) = 0;
57 virtual void createSurface() = 0;
59 virtual std::vector<const char*> getRequiredExtensions() =0;
61 const bool isValidationLayersEnabled();
63 virtual VkBool32 isDeviceSupportingSufaceKHR(VkPhysicalDevice device, int i) = 0;
65 virtual std::vector<const char*> getRequiredDeviceExtensions()=0;
67 virtual SwapChainSupportDetails querySwapChainSupport(vk::PhysicalDevice device)=0;
69 bool isSwapChainNeeded();
73 virtual const bool useOpenXR();
75 virtual bool isDepthRecquired();
77 virtual bool isSynchroWithSemaphore() = 0;
79 virtual void getFrameBufferSize(int* w, int* h, vk::PhysicalDevice & pDevice) = 0;
81 void setWrapper(VulkanWrapper * wraps);
83 virtual void checkForCorrectSize() = 0;
85 virtual vk::Buffer getRenderingDestination();
86
88 virtual vk::Image getSwapchainImage(int view, int index);
90 virtual vk::Image getDepthSwapchainImage(int view, int index);
91
93 glm::vec3 getTranslation();
95 void setRotation(float v0,float v1,float v3);
97 glm::vec3 getRotation();
98
100 virtual std::vector<vk::Image> getBlitDestinations(int view,int elem);
102 virtual std::vector<vk::Extent2D> getBlitExtentDestinations(int view, int elem);
104 virtual std::vector<vk::Semaphore> getSemaphoreWait(int view, int elem);
106 virtual std::vector<vk::Semaphore> getSemaphoreSignal(int view, int elem);
108 vk::ImageView getSwapchainImageView(int view, int elem);
110 vk::ImageView getDepthSwapchainImageView(int view, int elem);
112 int getViewNumber();
114 int getAttachmentSize();
116 virtual vk::Extent2D getSwapchainExtent(int view) ;
118 virtual vk::Format getSwapchainFormat(int view) ;
120 virtual vk::Format getDepthSwapchainFormat(int view);
122 virtual void resetOrigin() = 0;
124 virtual ~WindowAbstract() = default;
125 protected:
127 std::vector<std::unique_ptr<SwapchainAbstract>> swapchains;
129 std::vector<std::unique_ptr<SwapchainAbstract>> depthSwapchains;
130
133
135 const std::vector<const char*> deviceExtensions = {
136 VK_KHR_SWAPCHAIN_EXTENSION_NAME
137 };
138#if __ANDROID__
140 const std::vector<const char*> instanceExtensions = {
141 VK_KHR_SURFACE_EXTENSION_NAME,
142 VK_KHR_ANDROID_SURFACE_EXTENSION_NAME
143 };
144#endif
148 glm::vec3 currentRotation = {0,0,0};
150 glm::vec3 currentTranslation = {0,0,0};
152 bool needSwapchain = true; //false
154 bool initialised = false;
155
156
157
158#ifdef NDEBUG
160 const bool enableValidationLayers = false;
161#else
162#ifdef WIN32
164 const bool enableValidationLayers = true;
165#else
167 const bool enableValidationLayers = false;
168#endif
169#endif
171 bool qualibrationMode = false;
174};
Contains the class that encapsulate the notion of Swapchain: SwapchainAbstract.
class that manages tasks related to Vulkan context (Vulkan Instance, Vulkan Physical device,...
Definition: VulkanContext.h:59
The class that manages the drawing operation (manage and record command buffers).
Definition: VulkanDrawing.h:46
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).
virtual const bool useOpenXR()
vk::ImageView getSwapchainImageView(int view, int elem)
virtual void getFrameBufferSize(int *w, int *h, vk::PhysicalDevice &pDevice)=0
virtual void resetOrigin()=0
virtual vk::Buffer getRenderingDestination()
const std::vector< const char * > deviceExtensions
glm::vec3 currentTranslation
vk::ImageView getDepthSwapchainImageView(int view, int elem)
virtual SwapChainSupportDetails querySwapChainSupport(vk::PhysicalDevice device)=0
glm::vec3 getTranslation()
virtual void cleanUpSurface()=0
virtual VkBool32 isDeviceSupportingSufaceKHR(VkPhysicalDevice device, int i)=0
const bool isValidationLayersEnabled()
glm::vec3 getRotation()
std::vector< std::unique_ptr< SwapchainAbstract > > depthSwapchains
virtual vk::Image getDepthSwapchainImage(int view, int index)
virtual void cleanUp()=0
virtual std::vector< const char * > getRequiredExtensions()=0
virtual vk::Extent2D getSwapchainExtent(int view)
void setWrapper(VulkanWrapper *wraps)
virtual vk::Format getDepthSwapchainFormat(int view)
bool isIndepFromWindowDimension()
virtual void checkForCorrectSize()=0
bool isSwapChainNeeded()
glm::vec3 currentRotation
bool separateFromWindowDim
virtual ~WindowAbstract()=default
void setRotation(float v0, float v1, float v3)
virtual void continueInit()=0
virtual void createSurface()=0
virtual std::vector< vk::Extent2D > getBlitExtentDestinations(int view, int elem)
virtual vk::Format getSwapchainFormat(int view)
virtual std::vector< vk::Semaphore > getSemaphoreSignal(int view, int elem)
virtual std::vector< vk::Image > getBlitDestinations(int view, int elem)
virtual std::vector< vk::Semaphore > getSemaphoreWait(int view, int elem)
std::vector< std::unique_ptr< SwapchainAbstract > > swapchains
virtual std::vector< const char * > getRequiredDeviceExtensions()=0
virtual bool isDepthRecquired()
VulkanWrapper * wrapper
virtual bool isSynchroWithSemaphore()=0
virtual vk::Image getSwapchainImage(int view, int index)
virtual void initWindow()=0
const bool enableValidationLayers
virtual void mainLoop(VulkanDrawing *vulkanDrawing)=0
file that contains the common include for the Vulkan part
Struct that contains the capability for the sapchain, the formats and the present mode supported.
Definition: commonVulkan.h:87