HoviTron Video Pipeline
VulkanRenderPass.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 "VulkanRenderPass.h"
16#include"VulkanContext.h"
20#include <iostream>
21#include "commonVulkan.h"
22#include "VulkanWrapper.h"
23#include "InputProvider.h"
24#include "../WindowAbstract.h"
25
26#include <fstream> // std::ifstream
27
28
29#ifdef __ANDROID__
30static const char* kTAG = "renderPass";
31#define LOGI(...) \
32 ((void)__android_log_print(ANDROID_LOG_INFO, kTAG, __VA_ARGS__))
33#endif
34
35#ifdef OCULUS_RVS
36const bool transientAttachment = false;
37#else
38//transient bit not always available on dekstop card
39const bool transientAttachment = false;
40#endif
41
42#ifndef NDEBUG
43void setDebugName(ImageStruct & imStruct, std::string name, VulkanWrapper* wrapper) {
44 imStruct.name = name;
45 vk::DebugUtilsObjectNameInfoEXT debug(vk::ObjectType::eImage, (uint64_t) static_cast<VkImage>(imStruct.image), imStruct.name.c_str());
46 wrapper->context.device.setDebugUtilsObjectNameEXT(debug);
47}
48#endif // !1
49
51{}
52
53std::vector<vk::Format> VulkanRenderPass::getSupportedDepthFormats() const {
54 return {vk::Format::eD16Unorm, vk::Format::eD32Sfloat, vk::Format::eD24UnormS8Uint};
55}
56
58
59 VulkanRenderPassAbstract::init(inputProvider);
60
61 resetViewPortAndScissor = wrapper->isUsingDifferentViewSize();
62
63
64 for (int i = 0; i < inputImage; i++) {
65 warpingPipelines.push_back(std::make_unique<VulkanPipelineWarping>(context, this, input, wrapper, i));
66 blendingPipelines.push_back(std::make_unique<VulkanPipelineBlending>(context, this, wrapper, i));
67 }
68
70 PRINT("Rendering Size w= %d, h = %d", renderingExtent.width, renderingExtent.height);
71
72
73 createAttachementsRessources();
74 createDepthResources();
75 createRenderPass();
76 createFramebuffers();
77
78 //resetViewPortAndScissor = wrapper->isUsingDifferentViewSize();
79
80 //https://www.saschawillems.de/blog/2019/03/29/flipping-the-vulkan-viewport/
81 viewport = vk::Viewport{
82 0.0f, //x
83 (float)renderingExtent.height, //y
84 (float)renderingExtent.width, //width
85 (float)-1 * renderingExtent.height, //height
86 0.0f, //mindepth
87 1.0f }; //maxdepth
88
89 scissor = vk::Rect2D{ {0,0} , renderingExtent };
90
91 for (int i = 0; i < inputImage; i++) {
92 D(std::cout << "Create pipeline: " << i <<std::endl;)
94 blendingPipelines[i]->init();
95 }
96
97
98 initialized = true;
99
100
101}
102
103void VulkanRenderPass::createFramebuffers()
104{
105 bool renderDirectlyToSwapchain = !context->isIndepFromWindowDimension();
106 auto window = context->get_window();
107 swapChainFramebuffers.resize(window->getViewNumber());
108 //std::array<> attachments;
109 for (int view = 0; view < window->getViewNumber(); view++) {
111 for (size_t i = 0; i < wrapper->getAttachmentSize(); i++) {
112 std::vector<vk::ImageView> attachments = getAttachmentView(i, view);
113 if (renderDirectlyToSwapchain) {
114 if (window->isDepthRecquired()) {
115 attachments.push_back(window->getDepthSwapchainImageView(view, i));
116 }
117 attachments.push_back(window->getSwapchainImageView(view,i));
118 }
119
121
122 vk::FramebufferCreateInfo framebufferCreateInfo(
123 vk::FramebufferCreateFlags(), //flags
124 renderPass, //renderPass
125 static_cast<uint32_t>(attachments.size()), //attachmentCount
126 attachments.data(), //pAttachements
127 extend.width,//presentation->swapChainExtent.width, //width
128 extend.height,//presentation->swapChainExtent.height, //height
129 1 //layers
130 );
131 swapChainFramebuffers[view][i] = context->device.createFramebuffer(framebufferCreateInfo);
132 }
133 }
134}
135
137{
138 for (int i = 0; i < inputImage; i++) {
139 blendingPipelines[i]->cleanUp();
140 warpingPipelines[i]->cleanUp();
141 }
142 blendingPipelines.clear();
143 warpingPipelines.clear();
144
145 for (auto & im : attachementColor) {
146 im.destroy(context->device);
147 }
148
149 for (auto& im : attachementQualityFloat) {
150 im.destroy(context->device);
151 }
152 for (auto& im : attachementDepthFloat) {
153 im.destroy(context->device);
154 }
155 for (auto& im : attachementAccuColor) {
156 im.destroy(context->device);
157 }
158 for (auto& im : attachementAccuQuality) {
159 im.destroy(context->device);
160 }
161 for (auto& im : attachementAccuDepth) {
162 im.destroy(context->device);
163 }
164 for (auto& im : attachementAccuColor2) {
165 im.destroy(context->device);
166 }
167 for (auto& im : attachementAccuQuality2) {
168 im.destroy(context->device);
169 }
170 for (auto& im : attachementAccuDepth2) {
171 im.destroy(context->device);
172 }
173
174 attachementColor.clear();
176 attachementDepthFloat.clear();
177 attachementAccuColor.clear();
179 attachementAccuDepth.clear();
180 attachementAccuColor2.clear();
182 attachementAccuDepth2.clear();
183
184
185 for (auto& im : depthImages) {
186 im.destroy(context->device);
187 }
188 depthImages.clear();
189
190 context->device.destroyRenderPass(renderPass);
191 context->device.destroyCommandPool(commandPoolBuffer);
192
193 for (auto framebuffers : swapChainFramebuffers)
194 for(auto framebuffer:framebuffers) {
195 {
196 context->device.destroyFramebuffer(framebuffer);
197 }
198 }
199 swapChainFramebuffers.clear();
200}
201
202void VulkanRenderPass::updateBuffer(uint32_t currentImage, bool initAll, std::span<InputProvider::StreamFrameInfo> infos, int view)
203{
204 if (initAll) {
205 for (int i = 0; i < inputImage; i++) {
206 warpingPipelines[i]->update(infos,view);
207 warpingPipelines[i]->updateAllBuffer(currentImage,view);
208 blendingPipelines[i]->updateAllBuffer(currentImage, view);
209
210 }
211 }
212 else {
213 for (int i = 0; i < inputImage; i++) {
214 warpingPipelines[i]->update(infos, view);
215 warpingPipelines[i]->updateBuffer(currentImage, view);
216 blendingPipelines[i]->updateBuffer(currentImage, view);
217 }
218 }
219}
220
221void VulkanRenderPass::recordCommandBuffer(vk::CommandBuffer & commandBuffer, int i, std::span<InputProvider::StreamFrameInfo> frameInfos, int view)
222{
223 vk::ClearColorValue clearColor(std::array<float, 4>({ {0.0f, 0.0f, 0.0f, 1.0f} }));
224 /*
225 if (g_color_space == ColorSpace::YUV) {
226 //better black than green
227 vk::ClearColorValue clearColor(std::array<float, 4>({ {0.0f, 0.5f, 0.5f, 1.0f} }));
228 }*/
229
230
231 std::vector<vk::ClearValue> clearValues;
233 clearValues.resize(9);
234 clearValues[0].color = clearColor;
235 clearValues[1].color = clearColor;
236 clearValues[2].color = clearColor;
237 clearValues[3].color = clearColor;
238 clearValues[4].color = clearColor;
239 clearValues[5].color = clearColor;
240 clearValues[6].color = clearColor;
241 clearValues[7].depthStencil = vk::ClearDepthStencilValue{ 1.0f, 0 }; //{ 1.0f, 0};
242 clearValues[8].color = clearColor;
243 }
244 else {
245 clearValues.resize(11);
246 clearValues[0].color = clearColor;
247 clearValues[1].color = clearColor;
248 clearValues[2].color = clearColor;
249 clearValues[3].color = clearColor;
250 clearValues[4].color = clearColor;
251 clearValues[5].color = clearColor;
252 clearValues[6].color = clearColor;
253 clearValues[7].color = clearColor;
254 clearValues[8].color = clearColor;
255 clearValues[9].depthStencil = vk::ClearDepthStencilValue{ 1.0f, 0 }; //{ 1.0f, 0};
256 clearValues[10].color = clearColor;
257 }
258
260
261 vk::RenderPassBeginInfo renderPassBeginInfo(
262 renderPass, //renderpass
263 swapChainFramebuffers[view][i], //framebuffer
264 vk::Rect2D(vk::Offset2D(0, 0),
265 extend),//presentation->swapChainExtent), //offset + extent
266 static_cast<uint32_t>(clearValues.size()),
267 clearValues.data()
268 );
269
270 if (resetViewPortAndScissor) {
271
272 renderPassBeginInfo.renderArea = vk::Rect2D(vk::Offset2D(0, 0),
274 }
275
276 commandBuffer.beginRenderPass(renderPassBeginInfo, vk::SubpassContents::eInline);
277
278
279 if (wrapper->multiviewSetup) {
280 auto ext = wrapper->getSwapchainExtend(view);
281 viewport = vk::Viewport{
282 0.0f, //x
283 (float)ext.height, //y
284 (float)ext.width, //width
285 (float)-1 * ext.height, //height
286 0.0f, //mindepth
287 1.0f }; //maxdepth
288 scissor = vk::Rect2D{ {0, 0}, ext };
289 commandBuffer.setViewport(0, {viewport});
290 commandBuffer.setScissor(0, {scissor});
291 }
293 for (int input = 0; input < inputImage; input++) {
294 //D(std::cout << "\n record Command Buffer for input : " << input << std::endl;)
295 if (input > 0) {
296 //no need to clean the first time
297 vk::ClearColorValue clearColor(std::array<float, 4>({ {0.0f, 0.0f, 0.0f, 1.0f} }));
298 /*
299 if (g_color_space == ColorSpace::YUV) {
300 //better black than green
301 vk::ClearColorValue clearColor(std::array<float, 4>({ {0.0f, 0.5f, 0.5f, 1.0f} }));
302 }*/
303 vk::ClearAttachment clear0(vk::ImageAspectFlagBits::eColor, 0, vk::ClearValue(clearColor));
304 vk::ClearAttachment clear1(vk::ImageAspectFlagBits::eColor, 1, vk::ClearValue(clearColor));
305 vk::ClearAttachment clear2(vk::ImageAspectFlagBits::eColor, 2, vk::ClearValue(clearColor));
306 vk::ClearAttachment clear3(vk::ImageAspectFlagBits::eDepth, 0, vk::ClearValue(vk::ClearDepthStencilValue{ 1.0f,0 }));
307 /*
308 if (input == inputImage - 1) {
309 clear3 = vk::ClearAttachment(vk::ImageAspectFlagBits::eDepth, 0, vk::ClearValue(vk::ClearDepthStencilValue{ 0.0f,0 }));
310 }*/
311 std::array<vk::ClearAttachment, 4> clearAttachments = { clear0,clear1,clear2, clear3};
312 vk::ClearRect rect0 = vk::ClearRect(scissor, 0, 1);
313 vk::ClearRect rect1 = vk::ClearRect(scissor, 0, 1);
314 vk::ClearRect rect2 = vk::ClearRect(scissor, 0, 1);
315 std::array<vk::ClearRect, 3> clearRects = { rect0,rect1,rect2};
316 commandBuffer.clearAttachments(clearAttachments, clearRects);
317 }
318 commandBuffer.bindPipeline(vk::PipelineBindPoint::eGraphics, warpingPipelines[input]->pipeline);
319 warpingPipelines[input]->cmdBufferBindBuffer(commandBuffer, i, frameInfos[input], view);
320 commandBuffer.drawIndexed(warpingPipelines[input]->getIndexNumber(), 1, 0, 0, 0);
321
322 //next subPass
323 commandBuffer.nextSubpass(vk::SubpassContents::eInline);
324 //D(std::cout << "\n next subpass (input: " << input << ")" << std::endl;)
325
326
328 //farplane is value 0
329 vk::ClearAttachment clearD(vk::ImageAspectFlagBits::eDepth, 0, vk::ClearValue(vk::ClearDepthStencilValue{ 0.0f,0 }));
330 std::array<vk::ClearAttachment, 1> clearAttachments = { clearD };
331 vk::ClearRect rect0 = vk::ClearRect(scissor , 0, 1);
332 std::array<vk::ClearRect, 1> clearRect = { rect0 };
333 commandBuffer.clearAttachments(clearAttachments, clearRect);
334 }
335
336 commandBuffer.bindPipeline(vk::PipelineBindPoint::eGraphics, blendingPipelines[input]->pipeline);
337 blendingPipelines[input]->cmdBufferBindBuffer(commandBuffer, i, frameInfos[input], view);
338 commandBuffer.drawIndexed(blendingPipelines[input]->getIndexNumber(), 1, 0, 0, 0);
339
340
341
342 if(input != inputImage - 1){
343 //next subPass
344 commandBuffer.nextSubpass(vk::SubpassContents::eInline);
345 }
346 }
347
348 commandBuffer.endRenderPass();
349}
350
351void VulkanRenderPass::createRenderPass()
352{
353 const bool useSwapChainAttachment = !context->isIndepFromWindowDimension();
354
355 vk::ImageLayout finalLayout = wrapper->getLayoutAfterRenderpass();
356
357 vk::AttachmentDescription swapChainAttachment = vk::AttachmentDescription(vk::AttachmentDescriptionFlags(),
358 wrapper->getSwapchainFormat(), //format
359 vk::SampleCountFlagBits::e1, //samples
360 vk::AttachmentLoadOp::eClear, //loadOp
361 vk::AttachmentStoreOp::eStore, //storeOp
362 vk::AttachmentLoadOp::eDontCare, //stencilLoadOp
363 vk::AttachmentStoreOp::eDontCare, //stencilLoadOp
364 vk::ImageLayout::eUndefined, //initialLayout
365 finalLayout //finalLayout
366 );
367
368 vk::AttachmentDescription depthSwapChainAttachment;
370 depthSwapChainAttachment = vk::AttachmentDescription(vk::AttachmentDescriptionFlags(),
372 vk::SampleCountFlagBits::e1, //samples
373 vk::AttachmentLoadOp::eClear, //loadOp
374 vk::AttachmentStoreOp::eStore, //storeOp
375 vk::AttachmentLoadOp::eDontCare, //stencilLoadOp
376 vk::AttachmentStoreOp::eStore, //stencilLoadOp
377 vk::ImageLayout::eUndefined, //initialLayout
378 vk::ImageLayout::eDepthStencilAttachmentOptimal //finalLayout
379 );
380 }
381
382
383 vk::AttachmentDescription colorAttachment = vk::AttachmentDescription(vk::AttachmentDescriptionFlags(),
385 vk::SampleCountFlagBits::e1, //samples
386 vk::AttachmentLoadOp::eClear, //loadOp
387 vk::AttachmentStoreOp::eDontCare, //storeOp
388 vk::AttachmentLoadOp::eDontCare, //stencilLoadOp
389 vk::AttachmentStoreOp::eDontCare, //stencilLoadOp
390 vk::ImageLayout::eUndefined, //initialLayout
391 finalLayout //finalLayout
392 );
393
394
395 vk::AttachmentDescription floatDepthAttachment = vk::AttachmentDescription(vk::AttachmentDescriptionFlags(),
397 vk::SampleCountFlagBits::e1, //samples
398 vk::AttachmentLoadOp::eClear, //loadOp
399 vk::AttachmentStoreOp::eDontCare, //storeOp
400 vk::AttachmentLoadOp::eDontCare, //stencilLoadOp
401 vk::AttachmentStoreOp::eDontCare, //stencilLoadOp
402 vk::ImageLayout::eUndefined, //initialLayout
403 finalLayout //finalLayout
404 );
405
406 vk::AttachmentDescription qualityAttachment = vk::AttachmentDescription(vk::AttachmentDescriptionFlags(),
408 vk::SampleCountFlagBits::e1, //samples
409 vk::AttachmentLoadOp::eClear, //loadOp
410 vk::AttachmentStoreOp::eDontCare, //storeOp
411 vk::AttachmentLoadOp::eDontCare, //stencilLoadOp
412 vk::AttachmentStoreOp::eDontCare, //stencilLoadOp
413 vk::ImageLayout::eUndefined, //initialLayout
414 finalLayout //finalLayout
415 );
416
417 vk::AttachmentDescription accuColorAttachment = vk::AttachmentDescription(vk::AttachmentDescriptionFlags(),
419 vk::SampleCountFlagBits::e1, //samples
420 vk::AttachmentLoadOp::eClear, //loadOp
421 //vk::AttachmentStoreOp::eDontCare, //storeOp
422 (inputImage % 2 == 0 && !useSwapChainAttachment) ? vk::AttachmentStoreOp::eStore : vk::AttachmentStoreOp::eDontCare, //storeOp
423 vk::AttachmentLoadOp::eDontCare, //stencilLoadOp
424 vk::AttachmentStoreOp::eDontCare, //stencilLoadOp
425 vk::ImageLayout::eUndefined, //initialLayout
426 (inputImage % 2 == 0 && !useSwapChainAttachment) ? vk::ImageLayout::eTransferSrcOptimal : finalLayout //finalLayout
427 //vk::ImageLayout::ePresentSrcKHR
428 );
429 vk::AttachmentDescription accuQualityAttachment = vk::AttachmentDescription(vk::AttachmentDescriptionFlags(),
431 vk::SampleCountFlagBits::e1, //samples
432 vk::AttachmentLoadOp::eClear, //loadOp
433 vk::AttachmentStoreOp::eDontCare, //storeOp
434 vk::AttachmentLoadOp::eDontCare, //stencilLoadOp
435 vk::AttachmentStoreOp::eDontCare, //stencilLoadOp
436 vk::ImageLayout::eUndefined, //initialLayout
437 finalLayout //finalLayout
438 );
439 vk::AttachmentDescription accuDepthAttachment = vk::AttachmentDescription(vk::AttachmentDescriptionFlags(),
441 vk::SampleCountFlagBits::e1, //samples
442 vk::AttachmentLoadOp::eClear, //loadOp
443 //vk::AttachmentStoreOp::eDontCare, //storeOp
444 (inputImage % 2 == 0 && !useSwapChainAttachment) ? vk::AttachmentStoreOp::eStore : vk::AttachmentStoreOp::eDontCare, //storeOp
445 vk::AttachmentLoadOp::eDontCare, //stencilLoadOp
446 vk::AttachmentStoreOp::eDontCare, //stencilLoadOp
447 vk::ImageLayout::eUndefined, //initialLayout
448 (inputImage % 2 == 0 && !useSwapChainAttachment) ? vk::ImageLayout::eTransferSrcOptimal : finalLayout //finalLayout
449 //vk::ImageLayout::ePresentSrcKHR
450 );
451 vk::AttachmentDescription accuColor2Attachment = vk::AttachmentDescription(vk::AttachmentDescriptionFlags(),
453 vk::SampleCountFlagBits::e1, //samples
454 vk::AttachmentLoadOp::eClear, //loadOp
455 //vk::AttachmentStoreOp::eDontCare,
456 (inputImage % 2 == 1 && !useSwapChainAttachment) ? vk::AttachmentStoreOp::eStore : vk::AttachmentStoreOp::eDontCare, //storeOp
457 vk::AttachmentLoadOp::eDontCare, //stencilLoadOp
458 vk::AttachmentStoreOp::eDontCare, //stencilLoadOp
459 vk::ImageLayout::eUndefined, //initialLayout
460 (inputImage % 2 == 1 && !useSwapChainAttachment) ? vk::ImageLayout::eTransferSrcOptimal : finalLayout //finalLayout
461 //vk::ImageLayout::ePresentSrcKHR
462 );
463 vk::AttachmentDescription accuQuality2Attachment = vk::AttachmentDescription(vk::AttachmentDescriptionFlags(),
465 vk::SampleCountFlagBits::e1, //samples
466 vk::AttachmentLoadOp::eClear, //loadOp
467 vk::AttachmentStoreOp::eDontCare, //storeOp
468 vk::AttachmentLoadOp::eDontCare, //stencilLoadOp
469 vk::AttachmentStoreOp::eDontCare, //stencilLoadOp
470 vk::ImageLayout::eUndefined, //initialLayout
471 vk::ImageLayout::ePresentSrcKHR //finalLayout
472 );
473 vk::AttachmentDescription accuDepth2Attachment = vk::AttachmentDescription(vk::AttachmentDescriptionFlags(),
475 vk::SampleCountFlagBits::e1, //samples
476 vk::AttachmentLoadOp::eClear, //loadOp
477 //vk::AttachmentStoreOp::eDontCare,
478 (inputImage % 2 == 1 && !useSwapChainAttachment) ? vk::AttachmentStoreOp::eStore : vk::AttachmentStoreOp::eDontCare, //storeOp
479 vk::AttachmentLoadOp::eDontCare, //stencilLoadOp
480 vk::AttachmentStoreOp::eDontCare, //stencilLoadOp
481 vk::ImageLayout::eUndefined, //initialLayout
482 (inputImage % 2 == 1 && !useSwapChainAttachment) ? vk::ImageLayout::eTransferSrcOptimal : finalLayout //finalLayout
483 //vk::ImageLayout::ePresentSrcKHR
484 );
485 //depth attachement
486
487 vk::AttachmentDescription depthAttachment = vk::AttachmentDescription(vk::AttachmentDescriptionFlags(),
488 depthFormat, //format
489 vk::SampleCountFlagBits::e1, //samples
490 vk::AttachmentLoadOp::eClear, //loadOp
491 wrapper->isDepthOutputRecquired() ? vk::AttachmentStoreOp::eStore : vk::AttachmentStoreOp::eDontCare, //storeOp
492 vk::AttachmentLoadOp::eDontCare, //stencilLoadOp
493 vk::AttachmentStoreOp::eDontCare, //stencilLoadOp
494 vk::ImageLayout::eUndefined, //initialLayout
495 vk::ImageLayout::eDepthStencilAttachmentOptimal //finalLayout
496 );
497
498 //the description of the framebuffer content
499 std::vector<vk::AttachmentDescription> attachmentDescriptions;
501 if (useSwapChainAttachment) {
502 attachmentDescriptions = { colorAttachment,floatDepthAttachment,qualityAttachment,accuColorAttachment,accuQualityAttachment,accuColor2Attachment, accuQuality2Attachment , depthAttachment, swapChainAttachment };
503 }
504 else {
505 attachmentDescriptions = { colorAttachment,floatDepthAttachment,qualityAttachment,accuColorAttachment,accuQualityAttachment,accuColor2Attachment, accuQuality2Attachment, depthAttachment };
506 }
507 }else{
508 if (useSwapChainAttachment) {
509 attachmentDescriptions = { colorAttachment,floatDepthAttachment,qualityAttachment,accuColorAttachment,accuQualityAttachment,accuDepthAttachment,accuColor2Attachment, accuQuality2Attachment,accuDepth2Attachment, depthAttachment, swapChainAttachment };
510 }
511 else {
512 attachmentDescriptions = { colorAttachment,floatDepthAttachment,qualityAttachment,accuColorAttachment,accuQualityAttachment,accuDepthAttachment,accuColor2Attachment, accuQuality2Attachment,accuDepth2Attachment, depthAttachment };
513 }
514 }
515
516 //dependency at the start of the renderpass
517 std::vector<vk::SubpassDescription> subPassDescriptions;
518 std::vector< vk::SubpassDependency> subPassDep;
519 vk::SubpassDependency dependency{};
520 dependency.srcSubpass = VK_SUBPASS_EXTERNAL;
521 dependency.dstSubpass = 0;
522 dependency.srcStageMask = vk::PipelineStageFlagBits::eColorAttachmentOutput | vk::PipelineStageFlagBits::eEarlyFragmentTests;
523 dependency.dstStageMask = vk::PipelineStageFlagBits::eColorAttachmentOutput | vk::PipelineStageFlagBits::eEarlyFragmentTests;
524 dependency.srcAccessMask = vk::AccessFlagBits::eColorAttachmentWrite;
525 dependency.dstAccessMask = vk::AccessFlagBits::eColorAttachmentWrite | vk::AccessFlagBits::eColorAttachmentRead | vk::AccessFlagBits::eDepthStencilAttachmentWrite;//vk::AccessFlagBits::eColorAttachmentWrite | vk::AccessFlagBits::eDepthStencilAttachmentWrite;
526 dependency.dependencyFlags = vk::DependencyFlagBits::eByRegion;
527 subPassDep.push_back(dependency);
528
529 vk::SubpassDependency dependency2{};
530 dependency2.srcSubpass = VK_SUBPASS_EXTERNAL;
531 dependency2.dstSubpass = 1;
532 dependency2.srcStageMask = vk::PipelineStageFlagBits::eColorAttachmentOutput | vk::PipelineStageFlagBits::eEarlyFragmentTests;
533 dependency2.dstStageMask = vk::PipelineStageFlagBits::eFragmentShader | vk::PipelineStageFlagBits::eColorAttachmentOutput;
534 dependency2.srcAccessMask = vk::AccessFlagBits::eColorAttachmentWrite;
535 dependency2.dstAccessMask = vk::AccessFlagBits::eInputAttachmentRead | vk::AccessFlagBits::eColorAttachmentWrite;// | vk::AccessFlagBits::eDepthStencilAttachmentWrite;
536 dependency2.dependencyFlags = vk::DependencyFlagBits::eByRegion;
537 subPassDep.push_back(dependency2);
538
539 //for warping subpasses
540 vk::AttachmentReference colorReference(0, vk::ImageLayout::eColorAttachmentOptimal);
541 vk::AttachmentReference fDepthReference(1, vk::ImageLayout::eColorAttachmentOptimal);
542 vk::AttachmentReference qualityReference(2, vk::ImageLayout::eColorAttachmentOptimal);
543
544 std::array<vk::AttachmentReference, 3> colorAttachementRef = { colorReference,fDepthReference,qualityReference };
545 std::vector<uint32_t> preserveAttachementRef = { 3,4,6,5 };
546 vk::AttachmentReference depthReference(7, vk::ImageLayout::eDepthStencilAttachmentOptimal);
547
548 //for blending
549 vk::AttachmentReference imageInput(0, vk::ImageLayout::eShaderReadOnlyOptimal);
550 vk::AttachmentReference depthInput(1, vk::ImageLayout::eShaderReadOnlyOptimal);
551 vk::AttachmentReference qualityInput(2, vk::ImageLayout::eShaderReadOnlyOptimal);
552 //when blending step %2 == 0
553 vk::AttachmentReference accuColorInput0(3, vk::ImageLayout::eShaderReadOnlyOptimal);
554 vk::AttachmentReference accuQualityInput0(4, vk::ImageLayout::eShaderReadOnlyOptimal);
555 //when blending step %2 == 1
556 vk::AttachmentReference accuColorInput1(5, vk::ImageLayout::eShaderReadOnlyOptimal);
557 vk::AttachmentReference accuQualityInput1(6, vk::ImageLayout::eShaderReadOnlyOptimal);
558
559 vk::AttachmentReference colorOutput0(5, vk::ImageLayout::eColorAttachmentOptimal);
560 vk::AttachmentReference qualityOutput0(6, vk::ImageLayout::eColorAttachmentOptimal);
561 vk::AttachmentReference colorOutput1(3, vk::ImageLayout::eColorAttachmentOptimal);
562 vk::AttachmentReference qualityOutput1(4, vk::ImageLayout::eColorAttachmentOptimal);
563
564 //final atttachment
565 vk::AttachmentReference colorOutputFinal(8, vk::ImageLayout::eColorAttachmentOptimal);
566 if (!useSwapChainAttachment) {
567 colorOutputFinal.attachment = (inputImage-1 % 2 == 0) ? 5 : 3;
568 }
569
570 //-----------Attachments References
571 std::vector<vk::AttachmentReference> inputAttachementBlendingFirst = { imageInput, qualityInput, depthInput }; //no need for accumulators attachments they are empty
572 std::vector<uint32_t> preserveAttachementFirst = { 3,4 }; //weird here
573
574 std::vector<vk::AttachmentReference> inputAttachementBlending0 = { imageInput, qualityInput, depthInput, accuColorInput0,accuQualityInput0 };
575 std::vector<vk::AttachmentReference> inputAttachementBlending1 = { imageInput, qualityInput, depthInput, accuColorInput1,accuQualityInput1 };
576
577 std::vector<vk::AttachmentReference> outputAttachementBlending0 = { colorOutput0, qualityOutput0 };
578 std::vector<vk::AttachmentReference> outputAttachementBlending1 = { colorOutput1, qualityOutput1 };
579 std::vector<vk::AttachmentReference> outputAttachementBlendingFinal = { colorOutputFinal };
580
581 std::array<uint32_t, 1> preserveAttachementDepth = { 7};
582
584 //order in frame buffer is changed
585 //0,1,2 is still for warping (no changes)
586 // 3,4,5 is the first part of the ping-pong buffer for blending
587 // 6,7,8 is the second part of the ping-pong buffer for blending
588 //9 depth ref
589 //10 color of swapchain
590 //11 depth of swapchain
591
592
593 depthReference = vk::AttachmentReference(9, vk::ImageLayout::eDepthStencilAttachmentOptimal);
594
595 //when blending step %2 == 0
596 vk::AttachmentReference accuDepthInput0(5, vk::ImageLayout::eShaderReadOnlyOptimal);
597 //when blending step %2 == 1
598 accuColorInput1 = vk::AttachmentReference (6, vk::ImageLayout::eShaderReadOnlyOptimal);
599 accuQualityInput1 = vk::AttachmentReference(7, vk::ImageLayout::eShaderReadOnlyOptimal);
600 vk::AttachmentReference accuDepthInput1(8, vk::ImageLayout::eShaderReadOnlyOptimal);
601
602 colorOutput0 = vk::AttachmentReference(6, vk::ImageLayout::eColorAttachmentOptimal);
603 qualityOutput0 = vk::AttachmentReference(7, vk::ImageLayout::eColorAttachmentOptimal);
604 vk::AttachmentReference depthOutput0(8, vk::ImageLayout::eColorAttachmentOptimal);
605
606 vk::AttachmentReference depthOutput1(5, vk::ImageLayout::eColorAttachmentOptimal);
607
608 //final atttachment
609 colorOutputFinal = vk::AttachmentReference(10, vk::ImageLayout::eColorAttachmentOptimal);
610 if (!useSwapChainAttachment) {
611 colorOutputFinal.attachment = (inputImage - 1 % 2 == 0) ? 6 : 3;
612 }
613
614 //vk::AttachmentReference depthOutputFinal (11, vk::ImageLayout::eColorAttachmentOptimal);
615 //if (!useSwapChainAttachment) {
616 // depthOutputFinal.attachment = (inputImage - 1 % 2 == 0) ? 8 : 5;
617 //}
618
619 preserveAttachementFirst = { 3,4,5 };
620 inputAttachementBlending0 = { imageInput, qualityInput, depthInput, accuColorInput0,accuQualityInput0, accuDepthInput0 };
621 inputAttachementBlending1 = { imageInput, qualityInput, depthInput, accuColorInput1,accuQualityInput1, accuDepthInput1 };
622
623 outputAttachementBlending0 = { colorOutput0, qualityOutput0, depthOutput0 };
624 outputAttachementBlending1 = { colorOutput1, qualityOutput1,depthOutput1 };
625 outputAttachementBlendingFinal = { colorOutputFinal };
626
627 }
628
629 for (int i = 0; i < inputImage; i++) {
630
631 vk::SubpassDescription subpass(
632 vk::SubpassDescriptionFlags(), //flags
633 vk::PipelineBindPoint::eGraphics, //pipelineBindPoint
634 0, //inputAttachementCount
635 nullptr, //inputattachement
636 static_cast<uint32_t>(colorAttachementRef.size()), //colorAttachmentCount
637 colorAttachementRef.data(), //colorAttachement
638 nullptr, //resolveAttachement
639 &depthReference, //depthAttachement
640 static_cast<uint32_t>(preserveAttachementRef.size()), //preserve attachment count
641 preserveAttachementRef.data() //preserve data
642 );
643 subPassDescriptions.push_back(subpass);
644
645 //second subpass
646 std::vector<vk::AttachmentReference>* inputAttachementsBlending;
647 std::vector<vk::AttachmentReference>* outputAttachementsBlending;
648
649 if (i % 2 == 0) {
650 inputAttachementsBlending = &inputAttachementBlending0;
651 outputAttachementsBlending = &outputAttachementBlending0;
652 }
653 else {
654 inputAttachementsBlending = &inputAttachementBlending1;
655 outputAttachementsBlending = &outputAttachementBlending1;
656 }
657 if (i == 0) {
658 inputAttachementsBlending = &inputAttachementBlendingFirst;
659 }
660 if (i == inputImage - 1){
661 outputAttachementsBlending = &outputAttachementBlendingFinal;
662 }
663 vk::SubpassDescription subpassBlending(
664 vk::SubpassDescriptionFlags(), //flags
665 vk::PipelineBindPoint::eGraphics, //pipelineBindPoint
666 static_cast<uint32_t>(inputAttachementsBlending->size()), //inputAttachementCount
667 inputAttachementsBlending->data(), //inputattachement
668 static_cast<uint32_t>(outputAttachementsBlending->size()), //colorAttachmentCount
669 outputAttachementsBlending->data(), //colorAttachement
670 nullptr, //resolveAttachement
671 (i == inputImage - 1 && wrapper->isDepthOutputRecquired()) ? &depthReference : nullptr, //&depthReference //depthAttachement
672 i == 0 ? static_cast<uint32_t>(preserveAttachementFirst.size()) : 0, //preserve attachment count
673 i == 0 ? preserveAttachementFirst.data() : nullptr //preserve attachment
674 );
675 subPassDescriptions.push_back(subpassBlending);
676
677 vk::SubpassDependency dependencyBlend{};
678 dependencyBlend.srcSubpass = 0 + 2*i;
679 dependencyBlend.dstSubpass = 1 + 2*i;
680 dependencyBlend.srcStageMask = vk::PipelineStageFlagBits::eColorAttachmentOutput;
681 dependencyBlend.dstStageMask = vk::PipelineStageFlagBits::eFragmentShader;
682 dependencyBlend.srcAccessMask = vk::AccessFlagBits::eColorAttachmentWrite;
683 dependencyBlend.dstAccessMask = vk::AccessFlagBits::eInputAttachmentRead;
684 dependencyBlend.dependencyFlags = vk::DependencyFlagBits::eByRegion;
685
686 subPassDep.push_back(dependencyBlend);
687
688 if (i > 0) {
689 vk::SubpassDependency dependencyFragment{};
690 dependencyFragment.srcSubpass = (i-1) * 2 + 1;
691 dependencyFragment.dstSubpass = 2 * i + 1;
692 dependencyFragment.srcStageMask = vk::PipelineStageFlagBits::eColorAttachmentOutput;
693 dependencyFragment.dstStageMask = vk::PipelineStageFlagBits::eFragmentShader;
694 dependencyFragment.srcAccessMask = vk::AccessFlagBits::eColorAttachmentWrite;
695 dependencyFragment.dstAccessMask = vk::AccessFlagBits::eInputAttachmentRead;
696 dependencyFragment.dependencyFlags = vk::DependencyFlagBits::eByRegion;
697 subPassDep.push_back(dependencyFragment);
698
699
700 vk::SubpassDependency dependencyInterView{};
701 dependencyInterView.srcSubpass = (i * 2) - 1;
702 dependencyInterView.dstSubpass = 2 * i;
703 dependencyInterView.srcStageMask = vk::PipelineStageFlagBits::eFragmentShader;
704 //dependencyInterView.srcStageMask = vk::PipelineStageFlagBits::eColorAttachmentOutput;
705 dependencyInterView.dstStageMask = vk::PipelineStageFlagBits::eColorAttachmentOutput;
706 dependencyInterView.srcAccessMask = vk::AccessFlagBits::eInputAttachmentRead;
707 //dependencyInterView.srcAccessMask = vk::AccessFlagBits::eColorAttachmentWrite;
708 dependencyInterView.dstAccessMask = vk::AccessFlagBits::eColorAttachmentWrite;
709 dependencyInterView.dependencyFlags = vk::DependencyFlagBits::eByRegion;
710 subPassDep.push_back(dependencyInterView);
711
712 }
713
714 }
715
716 vk::SubpassDependency finalDependency{};
717 finalDependency.srcSubpass = 2 * inputImage - 1;
718 finalDependency.dstSubpass = VK_SUBPASS_EXTERNAL;
719 finalDependency.srcStageMask = vk::PipelineStageFlagBits::eColorAttachmentOutput;
720 finalDependency.dstStageMask = vk::PipelineStageFlagBits::eBottomOfPipe;
721 finalDependency.srcAccessMask = vk::AccessFlagBits::eColorAttachmentRead | vk::AccessFlagBits::eColorAttachmentWrite;
722 finalDependency.dstAccessMask = vk::AccessFlagBits::eMemoryRead;
723 finalDependency.dependencyFlags = vk::DependencyFlagBits::eByRegion;
724 subPassDep.push_back(finalDependency);
725
726 vk::RenderPassCreateInfo renderPassInfo(
727 vk::RenderPassCreateFlags(),
728 attachmentDescriptions.size(), //attachement count
729 attachmentDescriptions.data(), //attachement
730 static_cast<uint32_t>(subPassDescriptions.size()), //subpass count
731 subPassDescriptions.data(), //subpass
732 static_cast<uint32_t>(subPassDep.size()), //dependencyCount
733 subPassDep.data() //dependency
734 );
735
736 renderPass = context->device.createRenderPass(renderPassInfo);
737}
738
739
740
741
742void VulkanRenderPass::createAttachementsRessources()
743{
744
745 int attachmentSize = wrapper->getAttachmentSize(); //presentation->swapChainImageViews.size()
746
747 if (wrapper->multiviewSetup) {
748 attachmentSize = wrapper->getViewNumber();
749 }
750
751 D(std::cout << "create attachement: " << wrapper->getAttachmentSize() << " images each" << std::endl;)
752 attachementColor.resize(attachmentSize);
753 attachementDepthFloat.resize(attachmentSize);
754 attachementQualityFloat.resize(attachmentSize);
755
756 attachementAccuColor.resize(attachmentSize);
757 attachementAccuQuality.resize(attachmentSize);
758
759 attachementAccuColor2.resize(attachmentSize);
760 attachementAccuQuality2.resize(attachmentSize);
761
762
764 attachementAccuDepth.resize(attachmentSize);
765 attachementAccuDepth2.resize(attachmentSize);
766 }
767
768
769 auto imageUsageNonTransient = vk::ImageUsageFlagBits::eColorAttachment | vk::ImageUsageFlagBits::eInputAttachment;
770 auto memoryPropertyNonLazy = vk::MemoryPropertyFlagBits::eDeviceLocal;
771 auto imageUsageTransient = vk::ImageUsageFlagBits::eColorAttachment | vk::ImageUsageFlagBits::eInputAttachment | vk::ImageUsageFlagBits::eTransientAttachment;
772 vk::MemoryPropertyFlags memoryPropertyLazy = vk::MemoryPropertyFlagBits::eDeviceLocal | vk::MemoryPropertyFlagBits::eLazilyAllocated;
773 auto imageUsage = imageUsageNonTransient;
774 vk::MemoryPropertyFlags memoryProperty = memoryPropertyNonLazy;
775 if (transientAttachment) {
776 imageUsage = imageUsageTransient;
777 memoryProperty = memoryPropertyLazy;
778 }
779
780 for (int i = 0; i < (attachmentSize); i++) {
781 vk::Format colorFormat = wrapper->internalColorAttachmentFormat;//vk::Format::eR32G32B32A32Sfloat;
782 vk::Format qualityFormat = wrapper->qualityAttachmentFormat;//vk::Format::eR32Sfloat;
783 vk::Format depthFloatFormat = wrapper->internal1DAttachmentFormat;//vk::Format::eR32Sfloat;
784
786
787 // color
788 attachementColor[i].createStruct(context, extend,colorFormat,imageUsage, memoryProperty,commandPoolBuffer, vk::ImageLayout::eColorAttachmentOptimal);
789 //depth
790 attachementDepthFloat[i].createStruct(context, extend, depthFloatFormat, imageUsage, memoryProperty, commandPoolBuffer, vk::ImageLayout::eColorAttachmentOptimal);
791 //quality
792 attachementQualityFloat[i].createStruct(context, extend, qualityFormat, imageUsage, memoryProperty, commandPoolBuffer, vk::ImageLayout::eColorAttachmentOptimal);
793
794 //Accu Quality
795 attachementAccuQuality[i].createStruct(context, extend, qualityFormat, imageUsage, memoryProperty, commandPoolBuffer, vk::ImageLayout::eShaderReadOnlyOptimal);
796 //Accu Color
797 auto image4Usage = (inputImage % 2 == 0) ? imageUsageNonTransient | vk::ImageUsageFlagBits::eTransferSrc : imageUsage;
798 auto memoryProp4 = (inputImage % 2 == 0) ? memoryPropertyNonLazy : memoryProperty;
799 attachementAccuColor[i].createStruct(context, extend, colorFormat, image4Usage, memoryProp4, commandPoolBuffer, vk::ImageLayout::eShaderReadOnlyOptimal);
800
801 //Accu Quality 2
802 attachementAccuQuality2[i].createStruct(context, extend, qualityFormat,imageUsage,memoryProperty, commandPoolBuffer, vk::ImageLayout::eColorAttachmentOptimal);
803 //Accu Color 2
804 auto image6Usage = (inputImage % 2 == 1) ? imageUsageNonTransient | vk::ImageUsageFlagBits::eTransferSrc : imageUsage;
805 auto memoryProp6 = (inputImage % 2 == 1) ? memoryPropertyNonLazy : memoryProperty;
806 attachementAccuColor2[i].createStruct(context, extend, colorFormat, image6Usage, memoryProp6, commandPoolBuffer, vk::ImageLayout::eColorAttachmentOptimal);
807
808
810 attachementAccuDepth[i].createStruct(context, extend, depthFloatFormat, image4Usage, memoryProp4, commandPoolBuffer, vk::ImageLayout::eShaderReadOnlyOptimal);
811 attachementAccuDepth2[i].createStruct(context, extend, depthFloatFormat, image6Usage, memoryProp6, commandPoolBuffer, vk::ImageLayout::eColorAttachmentOptimal);
812 }
813
814 }
815
816#ifndef NDEBUG
817 for (int i = 0; i < (attachmentSize); i++) {
818 setDebugName(attachementColor[i], "fb color" + std::to_string(i), wrapper);
819 setDebugName(attachementDepthFloat[i], "fb depth" + std::to_string(i), wrapper);
820 setDebugName(attachementQualityFloat[i], "fb quality" + std::to_string(i), wrapper);
821 setDebugName(attachementAccuColor[i], "fb accu color" + std::to_string(i), wrapper);
822 setDebugName(attachementAccuQuality[i], "fb accu quality" + std::to_string(i), wrapper);
823 setDebugName(attachementAccuColor2[i], "fb accu2 color" + std::to_string(i), wrapper);
824 setDebugName(attachementAccuQuality2[i], "fb accu2 quality" + std::to_string(i), wrapper);
826 setDebugName(attachementAccuDepth[i], "fb accu depth" + std::to_string(i), wrapper);
827 setDebugName(attachementAccuDepth2[i], "fb accu2 depth" + std::to_string(i), wrapper);
828 }
829 /*
830 auto name = "att: " + std::to_string(i);
831 auto nameC = name + "color";
832 vk::DebugUtilsObjectNameInfoEXT debug(vk::ObjectType::eImage, (uint64_t) static_cast<VkImage>(attachementColor[i].image), nameC.c_str());
833 auto nameD = name + "depth";
834 vk::DebugUtilsObjectNameInfoEXT debugd(vk::ObjectType::eImage, (uint64_t) static_cast<VkImage>(attachementDepthFloat[i].image), nameD.c_str());
835 auto nameQ = name + "Quality";
836 vk::DebugUtilsObjectNameInfoEXT debugq(vk::ObjectType::eImage, (uint64_t) static_cast<VkImage>(attachementQualityFloat[i].image), nameQ.c_str());
837 wrapper->context.device.setDebugUtilsObjectNameEXT(debug);
838 wrapper->context.device.setDebugUtilsObjectNameEXT(debugd);
839 wrapper->context.device.setDebugUtilsObjectNameEXT(debugq);*/
840 }
841#endif
842}
843
845 return initialized;
846}
847
848std::vector<vk::ImageView> VulkanRenderPass::getAttachmentView(int swapIndex, int view)
849{
850 int i = wrapper->multiviewSetup ? view : swapIndex;
851 std::vector<vk::ImageView> result = { attachementColor[i].imageView,
852 attachementDepthFloat[i].imageView,
853 attachementQualityFloat[i].imageView,
854 attachementAccuColor[i].imageView,
855 attachementAccuQuality[i].imageView};
856
857
859 result.push_back(attachementAccuDepth[i].imageView);
860 }
861
862 result.push_back(attachementAccuColor2[i].imageView);
863 result.push_back(attachementAccuQuality2[i].imageView);
864
866 result.push_back(attachementAccuDepth2[i].imageView);
867 }
868
870 result.push_back(depthImages[i].imageView);
871 }
872
873 return result;
874}
875
876vk::Image VulkanRenderPass::getImageToBlit(int imageIndex) {
877 if (inputImage % 2 == 1) {
878 //copy attachment 6
879 return attachementAccuColor2[imageIndex].image;
880 } else {
881 return attachementAccuColor[imageIndex].image;
882 }
883}
884
885
886
887void VulkanRenderPass::createDepthResources()
888{
891 }
892 else {
894 }
895
897 depthImages.resize(attachmentSize);
898 for (int i = 0; i < (attachmentSize); i++) {
899
900 depthImages[i].createStruct(context, renderingExtent,depthFormat ,vk::ImageUsageFlagBits::eDepthStencilAttachment, vk::MemoryPropertyFlagBits::eDeviceLocal,
901 commandPoolBuffer, vk::ImageLayout::eDepthStencilAttachmentOptimal, vk::ImageAspectFlagBits::eDepth);
902 /*
903 createImage(context->device, context->physicalDevice, renderingExtent.width, renderingExtent.height, depthFormat,
904 vk::ImageTiling::eOptimal, vk::ImageUsageFlagBits::eDepthStencilAttachment, vk::MemoryPropertyFlagBits::eDeviceLocal, depthImage, depthImageMemory);
905 depthImageView = createImageView(context->device, depthImage, depthFormat, vk::ImageAspectFlagBits::eDepth);
906
907 transitionImageLayout(context, commandPoolBuffer, depthImage, depthFormat, vk::ImageLayout::eUndefined, vk::ImageLayout::eDepthStencilAttachmentOptimal);*/
908 }
909 //}
910
911}
912
913void VulkanRenderPass::createCommandPoolForBuffer()
914{
915 // create a CommandPool to allocate a CommandBuffer from
917 vk::CommandPoolCreateInfo commandPoolInfo(vk::CommandPoolCreateFlagBits::eTransient, queueFamilyIndices.graphicsFamily.value());
918 commandPoolBuffer = context->device.createCommandPool(commandPoolInfo);
919}
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 class that manage the renderPass containing the synthesis and blending steps
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
WindowAbstract * get_window()
bool isIndepFromWindowDimension()
QueueFamilyIndices findQueueFamilies(vk::PhysicalDevice device)
An abstract class that contains a common base of code for the class that inherit from it.
std::vector< ImageStruct > depthImages
virtual void init(InputProvider *inputProvider)
vk::RenderPass renderPass
std::vector< ImageStruct > attachementAccuQuality2
bool isInitialized() override
std::vector< ImageStruct > attachementAccuColor2
std::vector< vk::ImageView > getAttachmentView(int swapIndex, int view)
std::vector< vk::Format > getSupportedDepthFormats() const override
void recordCommandBuffer(vk::CommandBuffer &commandBuffer, int i, std::span< InputProvider::StreamFrameInfo > frameInfos, int view) override
std::vector< ImageStruct > attachementDepthFloat
VulkanRenderPass(VulkanContext *context, VulkanWrapper *wraps)
std::vector< std::unique_ptr< VulkanPipelineWarping > > warpingPipelines
std::vector< ImageStruct > attachementAccuDepth2
std::vector< ImageStruct > attachementQualityFloat
std::vector< std::vector< vk::Framebuffer > > swapChainFramebuffers
void init(InputProvider *inputProvider) override
std::vector< ImageStruct > attachementAccuDepth
std::vector< ImageStruct > attachementAccuColor
void cleanUp() override
std::vector< ImageStruct > attachementAccuQuality
void updateBuffer(uint32_t currentImage, bool initAll, std::span< InputProvider::StreamFrameInfo > infos, int view) override
std::vector< std::unique_ptr< VulkanPipelineBlending > > blendingPipelines
std::vector< ImageStruct > attachementColor
vk::Image getImageToBlit(int imageIndex) override
Class that manages the classes related to Vulkan code and act as a wrapper around them.
Definition: VulkanWrapper.h:66
bool isDepthOutputRecquired()
const vk::Format internal1DAttachmentFormat
vk::Extent2D getRenderOutputExtent()
const vk::Format internalColorAttachmentFormat
vk::Extent2D getSwapchainExtend(int view=0)
VulkanContext context
bool isUsingDifferentViewSize()
vk::Format getDepthSwapchainFormat(int view=0)
const bool multiviewSetup
vk::Format getSwapchainFormat(int view=0)
const vk::Format qualityAttachmentFormat
vk::ImageLayout getLayoutAfterRenderpass()
vk::ImageView getSwapchainImageView(int view, int elem)
vk::ImageView getDepthSwapchainImageView(int view, int elem)
virtual bool isDepthRecquired()
file that contains the common include for the Vulkan part
Struct that aims to facilitate the creation of image, their view and memory.
Struct to encapsulate the indice of the queues families.
Definition: VulkanContext.h:38
std::optional< uint32_t > graphicsFamily
Definition: VulkanContext.h:40