/* * WiVRn VR streaming * Copyright (C) 2022 Guillaume Meunier * Copyright (C) 2022 Patrick Nicolas * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include "vk/buffer.h" #include "vk/device_memory.h" #include "vk/pipeline.h" #include "vk/pipeline_layout.h" #include "vk/renderpass.h" #include "vk/shader.h" #include "wivrn_packets.h" #include #include class stream_reprojection { struct uniform; VkDevice device; VkPhysicalDevice physical_device; // Uniform buffer vk::buffer buffer; vk::device_memory memory; std::vector ubo{}; // Source images VkSampler sampler{}; std::vector input_images; std::vector input_image_views; std::vector descriptor_sets; // Destination images std::vector output_images; std::vector output_image_views; std::vector framebuffers; VkExtent2D extent{}; VkFormat format{}; // Graphic pipeline VkDescriptorSetLayout descriptor_set_layout{}; VkDescriptorPool descriptor_pool{}; vk::pipeline_layout layout; vk::pipeline pipeline; vk::renderpass renderpass; // Foveation std::array foveation_parameters; void cleanup(); public: stream_reprojection() = default; stream_reprojection(const stream_reprojection &) = delete; void init(VkDevice device, VkPhysicalDevice physical_device, std::vector input_images, std::vector output_images, VkExtent2D extent, VkFormat format, const xrt::drivers::wivrn::to_headset::video_stream_description & description); ~stream_reprojection(); void reproject(VkCommandBuffer command_buffer, int source, int destination, XrQuaternionf source_pose, XrFovf source_fov, XrQuaternionf destination_pose, XrFovf destination_fov); };