Foundation
Loading...
Searching...
No Matches
Swapchain.hpp
Go to the documentation of this file.
1#pragma once
3#include "Common.hpp"
4#include "Resource.hpp"
5namespace Foundation::RHI {
8 switch (mode) {
9 case Mailbox: return vk::PresentModeKHR::eMailbox;
10 case Tearing: return vk::PresentModeKHR::eImmediate;
11 case Fifo:
12 default:
13 return vk::PresentModeKHR::eFifo;
14 }
15 }
16 class VulkanDevice;
19 vk::raii::SwapchainKHR mSwapchain{ nullptr };
20 std::array<uint32_t, 2> mQueueFamilyIndices{};
23
24 void Instantiate();
25 vk::SwapchainCreateInfoKHR vkSwapchainCreateInfoFromSwapchainDesc(SwapchainDesc desc);
26 public:
28
30
31 [[nodiscard]] inline auto const& GetVkSwapchain() const { return mSwapchain; }
32 [[nodiscard]] RHIExtent2D GetExtents() const override;
37 ) override;
38
39 void DebugSetObjectName(const char* name) override;
40 };
41}
Definition Swapchain.hpp:19
Definition Device.hpp:80
Definition Swapchain.hpp:17
auto const & GetVkSwapchain() const
Definition Swapchain.hpp:31
vk::raii::SwapchainKHR mSwapchain
Definition Swapchain.hpp:19
const VulkanDevice & mDevice
Definition Swapchain.hpp:18
RHIExtent2D GetExtents() const override
Definition Swapchain.cpp:92
Core::Vector< RHITexture * > mImagesPtrs
Definition Swapchain.hpp:22
std::array< uint32_t, 2 > mQueueFamilyIndices
Definition Swapchain.hpp:20
void Instantiate()
Definition Swapchain.cpp:67
uint32_t GetNextImage(uint64_t timeout_ns, RHIDeviceObjectHandle< RHIDeviceSemaphore > semaphore, RHIDeviceObjectHandle< RHIDeviceFence > fence) override
Gets the next image in the swapchain. Raises RHISwapchainResizeException if the swapchain needs to be...
Definition Swapchain.cpp:96
vk::SwapchainCreateInfoKHR vkSwapchainCreateInfoFromSwapchainDesc(SwapchainDesc desc)
Definition Swapchain.cpp:9
void DebugSetObjectName(const char *name) override
Definition Swapchain.cpp:116
Core::Span< RHITexture *const > GetImages() const override
Definition Swapchain.cpp:89
UniquePtr< RHIObjectPool< VulkanTexture > > mImages
Definition Swapchain.hpp:21
std::unique_ptr< T, StlDeleter< T > > UniquePtr
std::unique_ptr with custom deleter that uses a Foundation::Core::Allocator to deallocate memory.
Definition Allocator.hpp:161
Low-level Rendering Hardware Interface (RHI) abstractions.
Definition Application.hpp:5
RHISwapchainPresentMode
Definition Swapchain.hpp:11
vk::PresentModeKHR vkPresentModeFromSwapchainDesc(RHISwapchainPresentMode mode)
Definition Swapchain.hpp:6
glm::vec< 2, uint32_t > RHIExtent2D
Definition Common.hpp:10