HoviTron Video Pipeline
VulkanRenderPassAbstract.h
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#pragma once
16/*****************************************************************/
24#include"commonVulkan.h"
25#include<memory>
29
30class VulkanContext;
31class Shader;
32class VulkanWrapper;
33class InputProvider;
34
42 vk::Image image;
44 vk::DeviceMemory memory;
46 vk::ImageView imageView;
47
48#ifndef NDEBUG
49 //name of the image for debug purpose
50 std::string name;
51#endif
53 void destroy(vk::Device& device) {
54 device.destroyImageView(imageView);
55 device.destroyImage(image);
56 device.freeMemory(memory);
57 };
59 void createStruct(VulkanContext * context, vk::Extent2D & renderingExtent, vk::Format format, vk::ImageUsageFlags imageUsage,
60 vk::MemoryPropertyFlags memoryProperty, vk::CommandPool & commandPool, vk::ImageLayout finalLayout, vk::ImageAspectFlags imageAspect = vk::ImageAspectFlagBits::eColor) {
61 createImage(context->device, context->physicalDevice, renderingExtent.width, renderingExtent.height, format,
62 vk::ImageTiling::eOptimal, imageUsage, memoryProperty, image, memory);
63 imageView = createImageView(context->device, image, format, imageAspect);
64 transitionImageLayout(context, commandPool, image, format, vk::ImageLayout::eUndefined, finalLayout);
65 }
66};
67
74public:
78 virtual void init(InputProvider* inputProvider);
80 virtual void cleanUp();
82 virtual void updateBuffer(uint32_t currentImage, bool initAll, std::span<InputProvider::StreamFrameInfo> infos, int view);
84 virtual void recordCommandBuffer(vk::CommandBuffer& commandBuffer, int i, std::span<InputProvider::StreamFrameInfo> frameInfos, int view);
86 virtual bool isInitialized();
88 virtual vk::Image getImageToBlit(int imageIndex) = 0;
90 virtual std::vector<vk::Format> getSupportedDepthFormats() const =0;
91
93 std::vector<ImageStruct> depthImages;
94
96 vk::Extent2D renderingExtent;
98 int inputImage = 1;
99
101 vk::CommandPool commandPoolBuffer = nullptr;
102
104 vk::Viewport viewport;
106 vk::Rect2D scissor;
107protected:
109 bool initialized = false;
111 InputProvider * input = nullptr;
112
117
119 vk::Format depthFormat;
120
125
126};
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.
Abstract interface around getting source views parameters and data.
Definition: InputProvider.h:35
Class that represents SPIR-V shader.
Definition: Shader.h:42
class that manages tasks related to Vulkan context (Vulkan Instance, Vulkan Physical device,...
Definition: VulkanContext.h:59
vk::PhysicalDevice physicalDevice
Definition: VulkanContext.h:85
vk::Device device
Definition: VulkanContext.h:87
An abstract class that contains a common base of code for the class that inherit from it.
virtual vk::Image getImageToBlit(int imageIndex)=0
std::vector< ImageStruct > depthImages
virtual void init(InputProvider *inputProvider)
virtual std::vector< vk::Format > getSupportedDepthFormats() const =0
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
file that contains the common include for the Vulkan part
Struct that aims to facilitate the creation of image, their view and memory.
void destroy(vk::Device &device)
void createStruct(VulkanContext *context, vk::Extent2D &renderingExtent, vk::Format format, vk::ImageUsageFlags imageUsage, vk::MemoryPropertyFlags memoryProperty, vk::CommandPool &commandPool, vk::ImageLayout finalLayout, vk::ImageAspectFlags imageAspect=vk::ImageAspectFlagBits::eColor)
vk::ImageView imageView
vk::DeviceMemory memory