HoviTron Video Pipeline
VulkanRenderPassAbstract.cpp
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#include "VulkanRenderPassAbstract.h"
16#include"VulkanContext.h"
20#include <iostream>
21#include "commonVulkan.h"
22#include "VulkanWrapper.h"
23#include "InputProvider.h"
24
25#include <fstream> // std::ifstream
26
27
28#ifdef __ANDROID__
29static const char* kTAG = "renderPass";
30#define LOGI(...) \
31 ((void)__android_log_print(ANDROID_LOG_INFO, kTAG, __VA_ARGS__))
32#endif
33
34#ifdef OCULUS_RVS
35const bool transientAttachment = false;
36#else
37//transient bit not always available on dekstop card
38const bool transientAttachment = false;
39#endif
40
42{
43 this->context = context;
44 this->wrapper = wraps;
45}
46
48
50
51 //get streams Parameter and chose how many subpasses should be created
52
53 this->input = inputProvider;
54 auto streamsParams = inputProvider->enumerateStreamsParameters();
55
56 auto activation = wrapper->getCameraActivation();
57 inputImage = 0;
58 for (auto a : activation) {
59 if (a) { inputImage++; }
60 }
61
62 //inputImage = streamsParams.size();
63 std::cout << "Nb of Input view: " << streamsParams.size() << std::endl;
64 std::cout << "Nb of Activated camera: " << inputImage << std::endl;
65}
66
68{
69 for (auto& im : depthImages) {
70 im.destroy(context->device);
71 }
72 depthImages.clear();
73
74 context->device.destroyCommandPool(commandPoolBuffer);
75}
76
77void VulkanRenderPassAbstract::updateBuffer(uint32_t currentImage, bool initAll, std::span<InputProvider::StreamFrameInfo> infos, int view)
78{
79}
80
81void VulkanRenderPassAbstract::recordCommandBuffer(vk::CommandBuffer & commandBuffer, int i, std::span<InputProvider::StreamFrameInfo> frameInfos, int view)
82{
83}
84
86 return initialized;
87}
88
90{
93 }
94 else {
96 }
97
99 depthImages.resize(attachmentSize);
100 for (int i = 0; i < (attachmentSize); i++) {
101
102 depthImages[i].createStruct(context, renderingExtent,depthFormat ,vk::ImageUsageFlagBits::eDepthStencilAttachment, vk::MemoryPropertyFlagBits::eDeviceLocal,
103 commandPoolBuffer, vk::ImageLayout::eDepthStencilAttachmentOptimal, vk::ImageAspectFlagBits::eDepth);
104 /*
105 createImage(context->device, context->physicalDevice, renderingExtent.width, renderingExtent.height, depthFormat,
106 vk::ImageTiling::eOptimal, vk::ImageUsageFlagBits::eDepthStencilAttachment, vk::MemoryPropertyFlagBits::eDeviceLocal, depthImage, depthImageMemory);
107 depthImageView = createImageView(context->device, depthImage, depthFormat, vk::ImageAspectFlagBits::eDepth);
108
109 transitionImageLayout(context, commandPoolBuffer, depthImage, depthFormat, vk::ImageLayout::eUndefined, vk::ImageLayout::eDepthStencilAttachmentOptimal);*/
110 }
111 //}
112
113}
114
116{
117 // create a CommandPool to allocate a CommandBuffer from
119 vk::CommandPoolCreateInfo commandPoolInfo(vk::CommandPoolCreateFlagBits::eTransient, queueFamilyIndices.graphicsFamily.value());
120 commandPoolBuffer = context->device.createCommandPool(commandPoolInfo);
121}
File that contain the VulkanContext class to manage Vulkan Instance, Physical device,...
Class that contains helper functions for Vulkan.
file that conthains a class that manages the pipeline for the blending
Contains the class that manages the warping pipeline.
file that contains the VulkanWrapper class that manages the classes related to Vulkan code and ease t...
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
vk::Format findDepthFormat()
vk::PhysicalDevice physicalDevice
Definition: VulkanContext.h:85
vk::Device device
Definition: VulkanContext.h:87
bool isIndepFromWindowDimension()
QueueFamilyIndices findQueueFamilies(vk::PhysicalDevice device)
std::vector< ImageStruct > depthImages
virtual void init(InputProvider *inputProvider)
VulkanRenderPassAbstract(VulkanContext *context, VulkanWrapper *wraps)
virtual void recordCommandBuffer(vk::CommandBuffer &commandBuffer, int i, std::span< InputProvider::StreamFrameInfo > frameInfos, int view)
virtual void updateBuffer(uint32_t currentImage, bool initAll, std::span< InputProvider::StreamFrameInfo > infos, int view)
Class that manages the classes related to Vulkan code and act as a wrapper around them.
Definition: VulkanWrapper.h:66
bool isDepthOutputRecquired()
vk::Format getDepthSwapchainFormat(int view=0)
const bool multiviewSetup
std::vector< bool > getCameraActivation()
file that contains the common include for the Vulkan part
Struct to encapsulate the indice of the queues families.
Definition: VulkanContext.h:38
std::optional< uint32_t > graphicsFamily
Definition: VulkanContext.h:40