/* * 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 #ifdef XR_USE_PLATFORM_ANDROID #include #endif #include "utils/handle.h" #include #include #include namespace xr { class instance; class session; class swapchain : public utils::handle { private: int32_t width_; int32_t height_; int sample_count_; vk::Format format_; std::vector images_; public: swapchain() = default; swapchain( instance &, session &, vk::raii::Device & device, vk::Format format, int32_t width, int32_t height, int sample_count = 1, uint32_t array_size = 1); int32_t width() const { return width_; } int32_t height() const { return height_; } XrExtent2Di extent() const { return {width_, height_}; } int sample_count() const { return sample_count_; } const std::vector & images() const { return images_; } vk::Image image(size_t i) const { return images_[i]; } vk::Format format() const { return format_; } int acquire(); bool wait(XrDuration timeout = XR_INFINITE_DURATION); void release(); }; } // namespace xr