VulkanContext class

Constructors, destructors, conversion operators

VulkanContext() defaulted
~VulkanContext() defaulted
VulkanContext(const VulkanContext&) deleted

Public functions

auto operator=(const VulkanContext&) -> VulkanContext& deleted
auto Initialize(SDL_Window* window, bool enableValidation = true) -> bool
Initialize instance -> surface -> device -> swapchain -> command pools.
void Shutdown()
auto RecreateSwapchain(SDL_Window* window) -> bool
Recreate swapchain after resize. Destroys the old swapchain first.
auto GetInstance() const -> VkInstance
auto GetPhysicalDevice() const -> VkPhysicalDevice
auto GetDevice() const -> VkDevice
auto GetSurface() const -> VkSurfaceKHR
auto GetQueues() const -> const VulkanQueues&
auto GetSwapchain() const -> const VulkanSwapchain&
auto GetGraphicsCommandPool() const -> VkCommandPool
auto GetComputeCommandPool() const -> VkCommandPool
auto GetTransferCommandPool() const -> VkCommandPool
auto GetRaiiDevice() const -> const vk::raii::Device&
Returns the owning raii::Device — needed to create vk::raii:: sync objects in VulkRender.
auto HasReBAR() const -> bool
auto SupportsBufferDeviceAddress() const -> bool
auto SupportsShaderObject() const -> bool
auto SupportsDynamicRendering() const -> bool
auto SupportsTimelineSemaphore() const -> bool
auto SupportsAsyncCompute() const -> bool
auto SupportsAsyncTransfer() const -> bool
auto SupportsHostImageCopy() const -> bool
auto SupportsPushDescriptors() const -> bool
auto SupportsIndexTypeUint8() const -> bool
auto GetReBarHeapIndex() const -> uint32_t
auto FindSupportedFormat(const std::vector<VkFormat>& candidates, VkImageTiling tiling, VkFormatFeatureFlags features) const -> VkFormat

Function documentation

void VulkanContext::Shutdown()

Explicit teardown — must be called from TrinyxEngine::Shutdown() so that all vkDestroy* calls happen while the validation layer is still alive. raii members would otherwise be destroyed at atexit(), after validation layer statics are gone, causing a dispatch-handle crash.

VkFormat VulkanContext::FindSupportedFormat(const std::vector<VkFormat>& candidates, VkImageTiling tiling, VkFormatFeatureFlags features) const

Find a supported image format from the candidates list. Used by VulkRender when selecting depth/render-target formats.