HoviTron Video Pipeline
VulkanDrawing.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/*****************************************************************/
22#pragma once
23
24#include "commonVulkan.h"
25#include<optional>
26
27#include "InputProvider.h"
28
29class VulkanContext;
30class VulkanPresentation;
31class VulkanPipeline;
32class VulkanWrapper;
34class WindowAbstract;
35
36const int MAX_FRAMES_IN_FLIGHT = 3; //maximum of command buffer that can be in-flight
37
47public:
49 VulkanDrawing(VulkanContext * context, VulkanRenderPassAbstract* renderPass, WindowAbstract * window, VulkanWrapper * wraps);
51 void init(InputProvider* inputProvider);
53 void cleanup();
55 bool isInitialized();
57 vk::Fence submitDrawCall(std::tuple<int, uint32_t> idImage, const std::vector<vk::Semaphore> & imageAvailableSemaphores, std::vector<vk::Semaphore> & signalSemaphore, uint32_t depthIndex = UINT_MAX);
58
59private:
61 int viewNumber = 1;
63 bool initialized = false;
64
66 VulkanContext* context = nullptr;
68 VulkanRenderPassAbstract* renderPass = nullptr;
70 WindowAbstract* window = nullptr;
72 VulkanWrapper* wrapper = nullptr;
74 InputProvider* inputProvider = nullptr;
75
77 vk::CommandPool commandPool;
79 std::vector<std::vector<vk::CommandBuffer>> commandBuffers;
81 std::vector<size_t > currentFrame;
82
84 std::vector<std::vector<vk::Fence>> inFlightFences;
86 std::vector<std::vector<std::optional<vk::Fence>>> imagesInFlight; // not for openXR mode
87
89 void createCommandPool();
91 void createCommandBuffers();
93 void recordCommandBuffers(vk::CommandBuffer& buff, int view, int i, std::span<InputProvider::StreamFrameInfo> frameInfos);
95 void createSyncObjects();
96
97
98};
Abstract interface around getting source views parameters and data.
Definition: InputProvider.h:35
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
vk::Fence submitDrawCall(std::tuple< int, uint32_t > idImage, const std::vector< vk::Semaphore > &imageAvailableSemaphores, std::vector< vk::Semaphore > &signalSemaphore, uint32_t depthIndex=UINT_MAX)
void init(InputProvider *inputProvider)
An abstract class that contains a common base of code for the class that inherit from it.
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