/* * WiVRn VR streaming * Copyright (C) 2024 Guillaume Meunier * Copyright (C) 2024 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/vk_allocator.h" #include #include #include #include struct vk_bundle; namespace wivrn { // to use vk::raii we need a vk::raii::{Instance,PhysicalDevice,Device} // however we don't own it, so deactivate the destructor struct raii_instance : public vk::raii::Instance { raii_instance(vk::raii::Context & ctx, VkInstance i) : vk::raii::Instance(ctx, i) {} raii_instance & operator=(raii_instance &&) noexcept = default; ~raii_instance() { release(); } }; struct raii_device : public vk::raii::Device { raii_device(vk::raii::PhysicalDevice & p, VkDevice d) : vk::raii::Device(p, d) {} raii_device & operator=(raii_device &&) noexcept = default; ~raii_device() { release(); } }; struct wivrn_vk_bundle { vk_bundle & vk; vk::raii::Context vk_ctx; raii_instance instance; vk::raii::PhysicalDevice physical_device; raii_device device; vk_allocator allocator; vk::raii::Queue queue; uint32_t queue_family_index; vk::raii::Queue encode_queue; uint32_t encode_queue_family_index; vk::raii::DebugUtilsMessengerEXT debug; std::vector instance_extensions; std::vector device_extensions; wivrn_vk_bundle(vk_bundle & vk, std::span requested_instance_extensions, std::span requested_device_extensions); uint32_t get_memory_type(uint32_t type_bits, vk::MemoryPropertyFlags memory_props); }; } // namespace wivrn