HoviTron Video Pipeline
Public Member Functions | Protected Attributes
WindowAbstract Class Referenceabstract

Abstraction of the way of the result is displayed (screen or HMD). More...

#include <WindowAbstract.h>

Inheritance diagram for WindowAbstract:
WindowGLFW WindowOpenXR

Public Member Functions

virtual void initWindow ()=0
 
virtual void continueInit ()=0
 
virtual void cleanUp ()=0
 
virtual void cleanUpSurface ()=0
 
virtual void mainLoop (VulkanDrawing *vulkanDrawing)=0
 
virtual void createSurface ()=0
 
virtual std::vector< const char * > getRequiredExtensions ()=0
 
const bool isValidationLayersEnabled ()
 
virtual VkBool32 isDeviceSupportingSufaceKHR (VkPhysicalDevice device, int i)=0
 
virtual std::vector< const char * > getRequiredDeviceExtensions ()=0
 
virtual SwapChainSupportDetails querySwapChainSupport (vk::PhysicalDevice device)=0
 
bool isSwapChainNeeded ()
 
bool isIndepFromWindowDimension ()
 
virtual const bool useOpenXR ()
 
virtual bool isDepthRecquired ()
 
virtual bool isSynchroWithSemaphore ()=0
 
virtual void getFrameBufferSize (int *w, int *h, vk::PhysicalDevice &pDevice)=0
 
void setWrapper (VulkanWrapper *wraps)
 
virtual void checkForCorrectSize ()=0
 
virtual vk::Buffer getRenderingDestination ()
 
virtual vk::Image getSwapchainImage (int view, int index)
 
virtual vk::Image getDepthSwapchainImage (int view, int index)
 
glm::vec3 getTranslation ()
 
void setRotation (float v0, float v1, float v3)
 
glm::vec3 getRotation ()
 
virtual std::vector< vk::Image > getBlitDestinations (int view, int elem)
 
virtual std::vector< vk::Extent2D > getBlitExtentDestinations (int view, int elem)
 
virtual std::vector< vk::Semaphore > getSemaphoreWait (int view, int elem)
 
virtual std::vector< vk::Semaphore > getSemaphoreSignal (int view, int elem)
 
vk::ImageView getSwapchainImageView (int view, int elem)
 
vk::ImageView getDepthSwapchainImageView (int view, int elem)
 
int getViewNumber ()
 
int getAttachmentSize ()
 
virtual vk::Extent2D getSwapchainExtent (int view)
 
virtual vk::Format getSwapchainFormat (int view)
 
virtual vk::Format getDepthSwapchainFormat (int view)
 
virtual void resetOrigin ()=0
 
virtual ~WindowAbstract ()=default
 

Protected Attributes

std::vector< std::unique_ptr< SwapchainAbstract > > swapchains
 
std::vector< std::unique_ptr< SwapchainAbstract > > depthSwapchains
 
bool separateFromWindowDim = false
 
const std::vector< const char * > deviceExtensions
 
VulkanWrapperwrapper = nullptr
 
glm::vec3 currentRotation = {0,0,0}
 
glm::vec3 currentTranslation = {0,0,0}
 
bool needSwapchain = true
 
bool initialised = false
 
const bool enableValidationLayers = false
 
bool qualibrationMode = false
 
int selectedCamera = -1
 

Detailed Description

Abstraction of the way of the result is displayed (screen or HMD).

The purpose of this abstract class is to abstract the final rendering hardware (computer screen or HMD) and the control/inputs attached to it) from the rest of the code that does the rendering job. This class also contains the mainloop of the application Contains a lot of platform dependent code

Definition at line 44 of file WindowAbstract.h.

Constructor & Destructor Documentation

◆ ~WindowAbstract()

virtual WindowAbstract::~WindowAbstract ( )
virtualdefault

Destructor

Member Function Documentation

◆ checkForCorrectSize()

virtual void WindowAbstract::checkForCorrectSize ( )
pure virtual

Check if the buffer have the correct size, if not recreate this

Implemented in WindowOpenXR, and WindowGLFW.

◆ cleanUp()

virtual void WindowAbstract::cleanUp ( )
pure virtual

Clean up ressources

Implemented in WindowGLFW, and WindowOpenXR.

◆ cleanUpSurface()

virtual void WindowAbstract::cleanUpSurface ( )
pure virtual

Clean up surface object if any

Implemented in WindowGLFW, and WindowOpenXR.

◆ continueInit()

virtual void WindowAbstract::continueInit ( )
pure virtual

Continue initialisation after context

Implemented in WindowGLFW, and WindowOpenXR.

◆ createSurface()

virtual void WindowAbstract::createSurface ( )
pure virtual

Create a Vulkan surface (if necessary)

Implemented in WindowGLFW, and WindowOpenXR.

◆ getAttachmentSize()

int WindowAbstract::getAttachmentSize ( )

Return the number of attachment necessary

Definition at line 228 of file WindowAbstract.cpp.

229{
230 int res = 1;
231 for (int i = 0; i < swapchains.size();i++) {
232 int s = swapchains[i]->getAttachmentSize();
233 res = s > res ? s : res;
234 }
235 return res;
236}
std::vector< std::unique_ptr< SwapchainAbstract > > swapchains

◆ getBlitDestinations()

std::vector< vk::Image > WindowAbstract::getBlitDestinations ( int  view,
int  elem 
)
virtual

Get Additional rendering destination, for blit command. Usefull for the mirror in OpenXR mode

Reimplemented in WindowOpenXR.

Definition at line 62 of file WindowAbstract.cpp.

63{
64 auto res = std::vector<vk::Image>();
65 return res;
66}

◆ getBlitExtentDestinations()

std::vector< vk::Extent2D > WindowAbstract::getBlitExtentDestinations ( int  view,
int  elem 
)
virtual

Get the dimension of rendering destination, for blit command. Usefull for the mirror in OpenXR mode

Reimplemented in WindowOpenXR.

Definition at line 68 of file WindowAbstract.cpp.

69{
70 auto res = std::vector<vk::Extent2D>();
71 /*
72 if (isIndepFromWindowDimension()) {
73 assert(view < swapchains.size());
74 res.push_back(swapchains[view]->swapchainExtent);
75 }*/
76 return res;
77}

◆ getDepthSwapchainFormat()

vk::Format WindowAbstract::getDepthSwapchainFormat ( int  view)
virtual

Get the format used for the depth attachments

Definition at line 222 of file WindowAbstract.cpp.

223{
224 assert(view < depthSwapchains.size());
225 return depthSwapchains[view]->swapchainFormat;
226}
std::vector< std::unique_ptr< SwapchainAbstract > > depthSwapchains

◆ getDepthSwapchainImage()

vk::Image WindowAbstract::getDepthSwapchainImage ( int  view,
int  index 
)
virtual

Return one image of the depth swapchain at a certain index

Definition at line 204 of file WindowAbstract.cpp.

205{
206 assert(view < depthSwapchains.size());
207 return depthSwapchains[view]->getSwapchainImage(index);
208}

◆ getDepthSwapchainImageView()

vk::ImageView WindowAbstract::getDepthSwapchainImageView ( int  view,
int  elem 
)

Return the vkimageView of the depthSwapchain

Definition at line 95 of file WindowAbstract.cpp.

96{
97 assert(view < depthSwapchains.size());
98 return depthSwapchains[view]->getSwapchainImageView(elem);
99}

◆ getFrameBufferSize()

virtual void WindowAbstract::getFrameBufferSize ( int *  w,
int *  h,
vk::PhysicalDevice &  pDevice 
)
pure virtual

return the framebuffer size

Implemented in WindowGLFW, and WindowOpenXR.

◆ getRenderingDestination()

vk::Buffer WindowAbstract::getRenderingDestination ( )
virtual

Return the buffer for the rendering destination when the swapchain are not used as result of the rendering

Definition at line 46 of file WindowAbstract.cpp.

47{
48 throw std::logic_error(std::string(__func__) + " not implemented");
49 return vk::Buffer();
50}

◆ getRequiredDeviceExtensions()

virtual std::vector< const char * > WindowAbstract::getRequiredDeviceExtensions ( )
pure virtual

Return the extensions required by the vulkan device

Implemented in WindowGLFW, and WindowOpenXR.

◆ getRequiredExtensions()

virtual std::vector< const char * > WindowAbstract::getRequiredExtensions ( )
pure virtual

Return the required extension (for the vulkan instance) needed by the library in charge of diplaying

Implemented in WindowGLFW, and WindowOpenXR.

◆ getRotation()

glm::vec3 WindowAbstract::getRotation ( )

return current rotation

Definition at line 57 of file WindowAbstract.cpp.

58{
59 return currentRotation;
60}
glm::vec3 currentRotation

◆ getSemaphoreSignal()

std::vector< vk::Semaphore > WindowAbstract::getSemaphoreSignal ( int  view,
int  elem 
)
virtual

Return the semaphore that must be signaled

Reimplemented in WindowOpenXR.

Definition at line 84 of file WindowAbstract.cpp.

85{
86 return std::vector<vk::Semaphore>();
87}

◆ getSemaphoreWait()

std::vector< vk::Semaphore > WindowAbstract::getSemaphoreWait ( int  view,
int  elem 
)
virtual

Return the semaphore that must be waited for

Reimplemented in WindowOpenXR.

Definition at line 79 of file WindowAbstract.cpp.

80{
81 return std::vector<vk::Semaphore>();
82}

◆ getSwapchainExtent()

vk::Extent2D WindowAbstract::getSwapchainExtent ( int  view)
virtual

Get the vkExtent2D for the swapchain

Definition at line 210 of file WindowAbstract.cpp.

211{
212 assert(view < swapchains.size());
213 return swapchains[view]->swapchainExtent;
214}

◆ getSwapchainFormat()

vk::Format WindowAbstract::getSwapchainFormat ( int  view)
virtual

Get the vkFormat of the swapchain

Definition at line 216 of file WindowAbstract.cpp.

217{
218 assert(view < swapchains.size());
219 return swapchains[view]->swapchainFormat;
220}

◆ getSwapchainImage()

vk::Image WindowAbstract::getSwapchainImage ( int  view,
int  index 
)
virtual

Return one image of the swapchain at a certain index

Reimplemented in WindowOpenXR.

Definition at line 199 of file WindowAbstract.cpp.

199 {
200 assert(view < swapchains.size());
201 return swapchains[view]->getSwapchainImage(index);
202}

◆ getSwapchainImageView()

vk::ImageView WindowAbstract::getSwapchainImageView ( int  view,
int  elem 
)

Return the vkimageView of the swapchain

Definition at line 89 of file WindowAbstract.cpp.

90{
91 assert(view < swapchains.size());
92 return swapchains[view]->getSwapchainImageView(elem);
93}

◆ getTranslation()

glm::vec3 WindowAbstract::getTranslation ( )

Return current translation

Definition at line 52 of file WindowAbstract.cpp.

53{
54 return currentTranslation;
55}
glm::vec3 currentTranslation

◆ getViewNumber()

int WindowAbstract::getViewNumber ( )

Return the number of view that must be waited for

Definition at line 101 of file WindowAbstract.cpp.

102{
103 return swapchains.size();
104}

◆ initWindow()

virtual void WindowAbstract::initWindow ( )
pure virtual

First initialisation

Implemented in WindowGLFW, and WindowOpenXR.

◆ isDepthRecquired()

bool WindowAbstract::isDepthRecquired ( )
virtual

return true if depth is needed by the window

Reimplemented in WindowOpenXR.

Definition at line 117 of file WindowAbstract.cpp.

118{
119 return false;
120}

◆ isDeviceSupportingSufaceKHR()

virtual VkBool32 WindowAbstract::isDeviceSupportingSufaceKHR ( VkPhysicalDevice  device,
int  i 
)
pure virtual

Return true if the device support the surface

Implemented in WindowGLFW, and WindowOpenXR.

◆ isIndepFromWindowDimension()

bool WindowAbstract::isIndepFromWindowDimension ( )

return true if rendering must be independent of screen dimension

Definition at line 34 of file WindowAbstract.cpp.

35{
37}
bool separateFromWindowDim

◆ isSwapChainNeeded()

bool WindowAbstract::isSwapChainNeeded ( )

Ask if a swapchain must be created

Definition at line 29 of file WindowAbstract.cpp.

30{
31 return needSwapchain;
32}

◆ isSynchroWithSemaphore()

virtual bool WindowAbstract::isSynchroWithSemaphore ( )
pure virtual

return true if semaphore are used for synchronization

Implemented in WindowGLFW, and WindowOpenXR.

◆ isValidationLayersEnabled()

const bool WindowAbstract::isValidationLayersEnabled ( )

Return true if validation layer are activated

Definition at line 23 of file WindowAbstract.cpp.

24{
26}
const bool enableValidationLayers

◆ mainLoop()

virtual void WindowAbstract::mainLoop ( VulkanDrawing vulkanDrawing)
pure virtual

Main rendering loop

Implemented in WindowGLFW, and WindowOpenXR.

◆ querySwapChainSupport()

virtual SwapChainSupportDetails WindowAbstract::querySwapChainSupport ( vk::PhysicalDevice  device)
pure virtual

Check for what format and present mode the swapchain support

Implemented in WindowGLFW, and WindowOpenXR.

◆ resetOrigin()

virtual void WindowAbstract::resetOrigin ( )
pure virtual

Reset the origin

Implemented in WindowGLFW, and WindowOpenXR.

◆ setRotation()

void WindowAbstract::setRotation ( float  v0,
float  v1,
float  v3 
)

Set the Rotatation

Definition at line 107 of file WindowAbstract.cpp.

107 {
108 currentRotation[0] = v0;
109 currentRotation[1] = v1;
110 currentRotation[2] = v2;
111}

◆ setWrapper()

void WindowAbstract::setWrapper ( VulkanWrapper wraps)

Set VulkanWrapper reference

Definition at line 40 of file WindowAbstract.cpp.

41{
42 wrapper = wraps;
43}
VulkanWrapper * wrapper

◆ useOpenXR()

const bool WindowAbstract::useOpenXR ( )
virtual

return true if it use openXr window

Reimplemented in WindowOpenXR.

Definition at line 113 of file WindowAbstract.cpp.

113 {
114 return false;
115}

Field Documentation

◆ currentRotation

glm::vec3 WindowAbstract::currentRotation = {0,0,0}
protected

Current Rotation in euler angles. These are defined using OpenXR space : +x = right + y = up + z = backward

Definition at line 148 of file WindowAbstract.h.

◆ currentTranslation

glm::vec3 WindowAbstract::currentTranslation = {0,0,0}
protected

Current Translation. These are defined using OpenXR space : +x = right + y = up + z = backward

Definition at line 150 of file WindowAbstract.h.

◆ depthSwapchains

std::vector<std::unique_ptr<SwapchainAbstract> > WindowAbstract::depthSwapchains
protected

depth swapchain of the window

Definition at line 129 of file WindowAbstract.h.

◆ deviceExtensions

const std::vector<const char*> WindowAbstract::deviceExtensions
protected
Initial value:
= {
VK_KHR_SWAPCHAIN_EXTENSION_NAME
}

Default Vulkan device extension

Definition at line 135 of file WindowAbstract.h.

◆ enableValidationLayers

const bool WindowAbstract::enableValidationLayers = false
protected

Decide if the validation layers should be activated.

Definition at line 167 of file WindowAbstract.h.

◆ initialised

bool WindowAbstract::initialised = false
protected

true if init process is finnish

Definition at line 154 of file WindowAbstract.h.

◆ needSwapchain

bool WindowAbstract::needSwapchain = true
protected

true if a swapchain is needed

Definition at line 152 of file WindowAbstract.h.

◆ qualibrationMode

bool WindowAbstract::qualibrationMode = false
protected

Used when qualibration should be adjusted using keyboard

Definition at line 171 of file WindowAbstract.h.

◆ selectedCamera

int WindowAbstract::selectedCamera = -1
protected

Camera selected when doing adjustement in calibration

Definition at line 173 of file WindowAbstract.h.

◆ separateFromWindowDim

bool WindowAbstract::separateFromWindowDim = false
protected

searate rendering from window dimension

Definition at line 132 of file WindowAbstract.h.

◆ swapchains

std::vector<std::unique_ptr<SwapchainAbstract> > WindowAbstract::swapchains
protected

color swapchains of the window

Definition at line 127 of file WindowAbstract.h.

◆ wrapper

VulkanWrapper* WindowAbstract::wrapper = nullptr
protected

pointer to the wrapper

Definition at line 146 of file WindowAbstract.h.


The documentation for this class was generated from the following files: