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:
27 VulkanSwapchain(const VulkanDevice& device, SwapchainDesc const& desc);
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}
Handle type for RHI Objects.
Definition Details.hpp:42
Definition Swapchain.hpp:19
Definition Device.hpp:94
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:76
Core::Vector< RHITexture * > mImagesPtrs
Definition Swapchain.hpp:22
std::array< uint32_t, 2 > mQueueFamilyIndices
Definition Swapchain.hpp:20
void Instantiate()
Definition Swapchain.cpp:52
uint32_t GetNextImage(uint64_t timeout_ns, RHIDeviceHandle< RHIDeviceSemaphore > semaphore, RHIDeviceHandle< RHIDeviceFence > fence) override
Gets the next image in the swapchain. Raises RHISwapchainResizeException if the swapchain needs to be...
Definition Swapchain.cpp:80
vk::SwapchainCreateInfoKHR vkSwapchainCreateInfoFromSwapchainDesc(SwapchainDesc desc)
Definition Swapchain.cpp:3
void DebugSetObjectName(const char *name) override
Definition Swapchain.cpp:100
Core::Span< RHITexture *const > GetImages() const override
Definition Swapchain.cpp:73
UniquePtr< RHIObjectPool< VulkanTexture > > mImages
Definition Swapchain.hpp:21
std::vector< T, StlAllocator< T > > Vector
std::vector with explicit Foundation::Core::StlAllocator constructor
Definition Container.hpp:130
std::unique_ptr< T, Deleter > UniquePtr
std::unique_ptr with custom deleter that uses a Foundation::Core::Allocator to deallocate memory.
Definition Allocator.hpp:166
T * Construct(Allocator *resource, Args &&...args)
Convenience placement new with object of type T using a Foundation::Core::Allocator.
Definition Allocator.hpp:149
std::span< T > Span
Alias for std::span
Definition Container.hpp:60
Low-level Rendering Hardware Interface (RHI) abstractions.
Definition Application.hpp:4
RHISwapchainPresentMode
Definition Swapchain.hpp:11
vk::PresentModeKHR vkPresentModeFromSwapchainDesc(RHISwapchainPresentMode mode)
Definition Swapchain.hpp:6
glm::vec< 2, uint32_t > RHIExtent2D
Definition Common.hpp:10