/* * 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/allocation.h" #include "wivrn_packets.h" #include #include class stream_reprojection { struct vertex; const uint32_t view_count; // Vertex buffer buffer_allocation buffer; size_t vertices_size = 0; vk::raii::Device & device; // Graphic pipeline vk::raii::DescriptorSetLayout descriptor_set_layout = nullptr; vk::raii::DescriptorPool descriptor_pool = nullptr; vk::raii::PipelineLayout layout = nullptr; vk::raii::RenderPass renderpass = nullptr; vk::raii::Pipeline pipeline = nullptr; // Source image vk::raii::Sampler sampler = nullptr; vk::Image input_image; std::vector input_image_views; std::vector descriptor_sets; vk::Extent2D input_extent; // Destination images std::vector output_images; std::vector output_image_views; std::vector framebuffers; vk::Extent2D output_extent; void ensure_vertices(size_t num_vertices); vertex * get_vertices(size_t view); public: stream_reprojection( vk::raii::Device & device, vk::raii::PhysicalDevice & physical_device, vk::Image input_image, vk::Extent2D input_extent, uint32_t view_count, std::vector output_images, vk::Extent2D output_extent, vk::Format format); stream_reprojection(const stream_reprojection &) = delete; std::vector reproject( vk::raii::CommandBuffer & command_buffer, const std::array & foveation, int destination); };