HoviTron Video Pipeline
BuffersControllerWarping.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
24#include "commonVulkan.h"
25
27#include "InputProvider.h"
28
29
30class VulkanContext;
31class VulkanRenderpass;
33class VulkanWrapper;
34
42 alignas(16) glm::mat4x4 R;
44 alignas(16) glm::vec4 t;
45};
53 alignas(4) float max_depth;
55 alignas(4) float min_depth;
56
57 //sizes
59 alignas(4) float w;
61 alignas(4) float h;
63 alignas(4) float n_w;
65 alignas(4) float n_h;
66 // Input/output projection types
68 alignas(4) int erp_in;
70 alignas(4) int erp_out;
71 // Perspective unprojection
73 alignas(8) glm::vec2 f;
75 alignas(8) glm::vec2 p;
76 // Perspective projection
78 alignas(8) glm::vec2 n_f;
80 alignas(8) glm::vec2 n_p;
81 // Equirectangular unprojection
83 alignas(4) float phi0;
85 alignas(4) float theta0;
87 alignas(4) float dphi_du;
89 alignas(4) float dtheta_dv;
90 // Equirectangular projection
92 alignas(4) float u0;
94 alignas(4) float v0;
96 alignas(4) float du_dphi;
98 alignas(4) float dv_dtheta;
99
101 alignas(4) int lin_depth = 0;
103 alignas(4) float scaleFactor = 1.0;
104};
105
113 alignas(4) float w;
115 alignas(4) float h;
117 alignas(4) float pixelThresh;
119 alignas(4) float scaleFactor = 1.0;
120};
132 float maxMul;
134 alignas(4) float scaleFactor = 1.0;
135};
136
137
146public:
149
151 void init() override;
153 void cleanUp() override;
155 void bindBuffers(vk::CommandBuffer & commandBuffer, int index, InputProvider::StreamFrameInfo & frameInfos, int view) override;
157 void updateUniformBuffer(uint32_t currentImage, int view) override;
159 void updateAllUniformBuffer(uint32_t currentImage, int view) override;
160
162 vk::VertexInputBindingDescription getBindingDescription() override;
164 std::vector<vk::VertexInputAttributeDescription> getAttributeDescription() override;
165
167 static inline std::vector<uint32_t> indices;
168
170 uint32_t getIndiceCount() override;
172 void update(std::span<InputProvider::StreamFrameInfo> infos, int view) override;
173
175 static void updateSettings(const InputProvider::StreamFrameInfo& infos, int view, const InputProvider::StreamParameters& streamParams, VulkanWrapper* wrapper, RVScamExtrinsics& extrinsics, RvsSynParam& params);
176private:
178 int idStep = 0;
179
181 RVScamExtrinsics rvsCamExtrinsics;
183 RvsSynParam rvsSynParam;
185 RvsSynGeom rvsSynGeom;
187 RvsSynFrag rvsSynFrag;
188
190 VulkanPipelineWarping* pipeline = nullptr;
192 VulkanWrapper* wrapper = nullptr;
194 InputProvider* input = nullptr;
197
199 inline static uint32_t indiceCount = 0;
201 void createVertexBuffer() override;
203 void createIndexBuffer() override;
204
206 void createUniformBuffer(int size) override;
208 void createDescriptorPool() override;
210 void createDescriptorSets() override;
212 void updateDescriptorSets(int attachment, int slot);
214 void updateCameraBuffer(uint32_t currentImage);
216 void copyBufferToImage(vk::Buffer buffer, vk::Image image, uint32_t width, uint32_t height);
217
219 vk::DescriptorPool descriptorPool;
221 std::vector<vk::DescriptorSet> descriptorSets;
222
223 //-----------------Images from the stream
225 std::vector<InputProvider::StreamImage> textureStreamImages;
227 std::vector<InputProvider::StreamImage> depthStreamImages;
228
229
230 //uniforms
232 std::vector<vk::Buffer> uniformBuffersCam;
234 std::vector<vk::DeviceMemory> uniformBuffersCamMemory;
235
237 std::vector<vk::Buffer> uniformBuffers;
239 std::vector<vk::DeviceMemory> uniformBuffersMemory;
240
242 std::vector<vk::Buffer> uniformBuffersGeom;
244 std::vector<vk::DeviceMemory> uniformBuffersGeomMemory;
245
247 std::vector<vk::Buffer> uniformBuffersFrag;
249 std::vector<vk::DeviceMemory> uniformBuffersFragMemory;
250
252 int attachmentSize = 0;
253
254 //vertex and index
256 inline static vk::Buffer vertexBuffer;
258 inline static vk::DeviceMemory vertexBufferMemory;
260 inline static vk::Buffer indexBuffer ;
262 inline static vk::DeviceMemory indexBufferMemory ;
263};
Abstract class that contains common functionnalities to manage the buffer for synthesis and blending ...
abstract class for the management of the buffers, descriptors, ...
VulkanRenderPass * renderpass
Control the data to be transmitted to the warping pipeline.
void update(std::span< InputProvider::StreamFrameInfo > infos, int view) override
static std::vector< uint32_t > indices
static void updateSettings(const InputProvider::StreamFrameInfo &infos, int view, const InputProvider::StreamParameters &streamParams, VulkanWrapper *wrapper, RVScamExtrinsics &extrinsics, RvsSynParam &params)
void updateAllUniformBuffer(uint32_t currentImage, int view) override
vk::VertexInputBindingDescription getBindingDescription() override
void bindBuffers(vk::CommandBuffer &commandBuffer, int index, InputProvider::StreamFrameInfo &frameInfos, int view) override
void updateUniformBuffer(uint32_t currentImage, int view) override
std::vector< vk::VertexInputAttributeDescription > getAttributeDescription() override
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
Class that manages the graphic pipeline for the warping.
Class that manage the renderPass containing the synthesis and blending steps.
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
Static parameters of an input view stream.
Definition: InputProvider.h:71
Struct that contains camera extrinsics values that must be sent to vertex shader of the warping pipel...
Struct that contains datas for the fragment shader of the warping pipeline.
Struct that contains datas for the geometry shader of the warping pipeline.
Struct that contains parameters for the vertex shader in the warping pipeline.