TachyonUI 0.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
Vulkan backend

The Vulkan graphics backend, and sharing a host's device and images. More...

Classes

struct  tachyon::vulkan::DescriptorLayoutBuilder
struct  tachyon::vulkan::DescriptorWriter
struct  tachyon::vulkan::DescriptorAllocator
struct  tachyon::vulkan::DescriptorAllocatorGrowable
struct  tachyon::vulkan::DeletionQueue
 Library internal: destroy functions that run later, newest first. More...
struct  tachyon::vulkan::FrameWaits
 Timeline semaphores the GUI's frame submissions wait on (VulkanGraphicsContext::AddFrameWait). More...
class  tachyon::vulkan::VulkanDeviceContext
 The Vulkan device the GUI renders with: its own, or a host's (SetExternalDevice). More...
class  tachyon::vulkan::VulkanGraphicsContext
 The default graphics backend, on Vulkan 1.3. More...
class  tachyon::vulkan::VulkanImage
class  tachyon::vulkan::VulkanImageSet
struct  tachyon::vulkan::Buffer
struct  tachyon::vulkan::VisualBoxStyleBuffers
struct  tachyon::vulkan::VisualColorStyleBuffers
class  tachyon::vulkan::VulkanBuffer
struct  tachyon::vulkan::GUIRenderContext
 The Vulkan-side GUI pipeline set, built once at device init from kPrimitiveSpecs. More...
class  tachyon::vulkan::VulkanRenderDevice
class  tachyon::vulkan::VulkanRenderCommandList
struct  tachyon::vulkan::FontTexture
class  tachyon::vulkan::VulkanTextAtlasManager
struct  tachyon::vulkan::AllocatedImage
struct  tachyon::vulkan::AllocatedBuffer
class  tachyon::vulkan::UploadWorker
 Library internal: copies into mapped GPU memory on a thread of its own, so the main thread goes on recording commands. More...
struct  tachyon::vulkan::FrameData
struct  tachyon::vulkan::SwapchainState
struct  tachyon::vulkan::WindowVulkanState
class  tachyon::vulkan::VulkanWindowContext

Macros

#define TACHYON_VK_CHECK(x)

Functions

void tachyon::vulkan::transition_image (VkCommandBuffer cmd, VkImage image, VkImageLayout currentLayout, VkImageLayout newLayout, VkPipelineStageFlags2 afterStage=VK_PIPELINE_STAGE_2_NONE)
 Records a layout transition of image into cmd.
void tachyon::vulkan::copy_image_to_image (VkCommandBuffer cmd, VkImage source, VkImage destination, VkExtent2D srcSize, VkExtent2D dstSize)
void tachyon::vulkan::generate_mipmaps (VkCommandBuffer cmd, VkImage image, VkExtent2D imageSize)
VkCommandPoolCreateInfo tachyon::vulkan::command_pool_create_info (uint32_t queueFamilyIndex, VkCommandPoolCreateFlags flags=0)
VkCommandBufferAllocateInfo tachyon::vulkan::command_buffer_allocate_info (VkCommandPool pool, uint32_t count=1)
VkCommandBufferBeginInfo tachyon::vulkan::command_buffer_begin_info (VkCommandBufferUsageFlags flags=0)
VkCommandBufferSubmitInfo tachyon::vulkan::command_buffer_submit_info (VkCommandBuffer cmd)
VkFenceCreateInfo tachyon::vulkan::fence_create_info (VkFenceCreateFlags flags=0)
VkSemaphoreCreateInfo tachyon::vulkan::semaphore_create_info (VkSemaphoreCreateFlags flags=0)
VkSubmitInfo2 tachyon::vulkan::submit_info (VkCommandBufferSubmitInfo *cmd, VkSemaphoreSubmitInfo *signalSemaphoreInfo, VkSemaphoreSubmitInfo *waitSemaphoreInfo)
VkPresentInfoKHR tachyon::vulkan::present_info ()
VkRenderingAttachmentInfo tachyon::vulkan::attachment_info (VkImageView view, VkClearValue *clear, VkImageLayout layout)
VkRenderingAttachmentInfo tachyon::vulkan::depth_attachment_info (VkImageView view, VkImageLayout layout)
VkRenderingInfo tachyon::vulkan::rendering_info (VkExtent2D renderExtent, VkRenderingAttachmentInfo *colorAttachment, VkRenderingAttachmentInfo *depthAttachment)
VkImageSubresourceRange tachyon::vulkan::image_subresource_range (VkImageAspectFlags aspectMask)
VkSemaphoreSubmitInfo tachyon::vulkan::semaphore_submit_info (VkPipelineStageFlags2 stageMask, VkSemaphore semaphore)
VkDescriptorSetLayoutBinding tachyon::vulkan::descriptorset_layout_binding (VkDescriptorType type, VkShaderStageFlags stageFlags, uint32_t binding)
VkDescriptorSetLayoutCreateInfo tachyon::vulkan::descriptorset_layout_create_info (VkDescriptorSetLayoutBinding *bindings, uint32_t bindingCount)
VkWriteDescriptorSet tachyon::vulkan::write_descriptor_image (VkDescriptorType type, VkDescriptorSet dstSet, VkDescriptorImageInfo *imageInfo, uint32_t binding)
VkWriteDescriptorSet tachyon::vulkan::write_descriptor_buffer (VkDescriptorType type, VkDescriptorSet dstSet, VkDescriptorBufferInfo *bufferInfo, uint32_t binding)
VkDescriptorBufferInfo tachyon::vulkan::buffer_info (VkBuffer buffer, VkDeviceSize offset, VkDeviceSize range)
VkImageCreateInfo tachyon::vulkan::image_create_info (VkFormat format, VkImageUsageFlags usageFlags, VkExtent3D extent)
VkImageViewCreateInfo tachyon::vulkan::imageview_create_info (VkFormat format, VkImage image, VkImageAspectFlags aspectFlags)
VkPipelineLayoutCreateInfo tachyon::vulkan::pipeline_layout_create_info ()
VkPipelineShaderStageCreateInfo tachyon::vulkan::pipeline_shader_stage_create_info (VkShaderStageFlagBits stage, VkShaderModule shaderModule, const char *entry="main")
bool tachyon::vulkan::load_shader_module (const char *filePath, VkDevice device, const VkAllocationCallbacks *callbacks, VkShaderModule *outShaderModule)
void tachyon::vulkan::OnVulkanError (VkResult result, const char *call)
 Logs a failed Vulkan call; the frame carries on.
bool tachyon::vulkan::IsDeviceLost ()
void tachyon::vulkan::SetDeviceLost (bool lost)
void tachyon::vulkan::WaitForFence (VkDevice device, VkFence fence)
 Waits for fence however long the GPU takes: VK_TIMEOUT only means the GPU is slow (a busy or stalled driver, a paused debugger).

Variables

constexpr VkFormat tachyon::vulkan::drawImageFormat = VK_FORMAT_B8G8R8A8_UNORM
 format of the images the GUI draws into
constexpr VkFormat tachyon::vulkan::depthImageFormat = VK_FORMAT_D32_SFLOAT
constexpr unsigned int tachyon::vulkan::FRAME_DELETION_SLOT_COUNT = 3
 Frame deletion queue slots: FRAME_OVERLAP + 1, so the slot pushed to is never the one flushed in the same frame (static-asserted against FRAME_OVERLAP).
constexpr unsigned int tachyon::vulkan::FRAME_OVERLAP = 2

Detailed Description

The Vulkan graphics backend, and sharing a host's device and images.

See Using your own Vulkan device.

Macro Definition Documentation

◆ TACHYON_VK_CHECK

#define TACHYON_VK_CHECK ( x)

#include <gui_core/graphics/vulkan/vk_types.h>

Value:
do \
{ \
const VkResult tachyon_vk_result = (x); \
if (tachyon_vk_result != VK_SUCCESS) \
::tachyon::vulkan::OnVulkanError(tachyon_vk_result, #x); \
} while (0)

Function Documentation

◆ transition_image()

void tachyon::vulkan::transition_image ( VkCommandBuffer cmd,
VkImage image,
VkImageLayout currentLayout,
VkImageLayout newLayout,
VkPipelineStageFlags2 afterStage = VK_PIPELINE_STAGE_2_NONE )

#include <gui_core/graphics/vulkan/vk_images.h>

Records a layout transition of image into cmd.

afterStage: for an image coming from UNDEFINED, a stage the transition waits for. A swapchain image passes its acquire semaphore's wait stage, so the transition is ordered after the acquire instead of racing the presentation engine.

◆ copy_image_to_image()

void tachyon::vulkan::copy_image_to_image ( VkCommandBuffer cmd,
VkImage source,
VkImage destination,
VkExtent2D srcSize,
VkExtent2D dstSize )

◆ generate_mipmaps()

void tachyon::vulkan::generate_mipmaps ( VkCommandBuffer cmd,
VkImage image,
VkExtent2D imageSize )

◆ command_pool_create_info()

VkCommandPoolCreateInfo tachyon::vulkan::command_pool_create_info ( uint32_t queueFamilyIndex,
VkCommandPoolCreateFlags flags = 0 )

◆ command_buffer_allocate_info()

VkCommandBufferAllocateInfo tachyon::vulkan::command_buffer_allocate_info ( VkCommandPool pool,
uint32_t count = 1 )

◆ command_buffer_begin_info()

VkCommandBufferBeginInfo tachyon::vulkan::command_buffer_begin_info ( VkCommandBufferUsageFlags flags = 0)

◆ command_buffer_submit_info()

VkCommandBufferSubmitInfo tachyon::vulkan::command_buffer_submit_info ( VkCommandBuffer cmd)

◆ fence_create_info()

VkFenceCreateInfo tachyon::vulkan::fence_create_info ( VkFenceCreateFlags flags = 0)

◆ semaphore_create_info()

VkSemaphoreCreateInfo tachyon::vulkan::semaphore_create_info ( VkSemaphoreCreateFlags flags = 0)

◆ submit_info()

VkSubmitInfo2 tachyon::vulkan::submit_info ( VkCommandBufferSubmitInfo * cmd,
VkSemaphoreSubmitInfo * signalSemaphoreInfo,
VkSemaphoreSubmitInfo * waitSemaphoreInfo )

◆ present_info()

VkPresentInfoKHR tachyon::vulkan::present_info ( )

◆ attachment_info()

VkRenderingAttachmentInfo tachyon::vulkan::attachment_info ( VkImageView view,
VkClearValue * clear,
VkImageLayout layout )

◆ depth_attachment_info()

VkRenderingAttachmentInfo tachyon::vulkan::depth_attachment_info ( VkImageView view,
VkImageLayout layout )

◆ rendering_info()

VkRenderingInfo tachyon::vulkan::rendering_info ( VkExtent2D renderExtent,
VkRenderingAttachmentInfo * colorAttachment,
VkRenderingAttachmentInfo * depthAttachment )

◆ image_subresource_range()

VkImageSubresourceRange tachyon::vulkan::image_subresource_range ( VkImageAspectFlags aspectMask)

◆ semaphore_submit_info()

VkSemaphoreSubmitInfo tachyon::vulkan::semaphore_submit_info ( VkPipelineStageFlags2 stageMask,
VkSemaphore semaphore )

◆ descriptorset_layout_binding()

VkDescriptorSetLayoutBinding tachyon::vulkan::descriptorset_layout_binding ( VkDescriptorType type,
VkShaderStageFlags stageFlags,
uint32_t binding )

◆ descriptorset_layout_create_info()

VkDescriptorSetLayoutCreateInfo tachyon::vulkan::descriptorset_layout_create_info ( VkDescriptorSetLayoutBinding * bindings,
uint32_t bindingCount )

◆ write_descriptor_image()

VkWriteDescriptorSet tachyon::vulkan::write_descriptor_image ( VkDescriptorType type,
VkDescriptorSet dstSet,
VkDescriptorImageInfo * imageInfo,
uint32_t binding )

◆ write_descriptor_buffer()

VkWriteDescriptorSet tachyon::vulkan::write_descriptor_buffer ( VkDescriptorType type,
VkDescriptorSet dstSet,
VkDescriptorBufferInfo * bufferInfo,
uint32_t binding )

◆ buffer_info()

VkDescriptorBufferInfo tachyon::vulkan::buffer_info ( VkBuffer buffer,
VkDeviceSize offset,
VkDeviceSize range )

◆ image_create_info()

VkImageCreateInfo tachyon::vulkan::image_create_info ( VkFormat format,
VkImageUsageFlags usageFlags,
VkExtent3D extent )

◆ imageview_create_info()

VkImageViewCreateInfo tachyon::vulkan::imageview_create_info ( VkFormat format,
VkImage image,
VkImageAspectFlags aspectFlags )

◆ pipeline_layout_create_info()

VkPipelineLayoutCreateInfo tachyon::vulkan::pipeline_layout_create_info ( )

◆ pipeline_shader_stage_create_info()

VkPipelineShaderStageCreateInfo tachyon::vulkan::pipeline_shader_stage_create_info ( VkShaderStageFlagBits stage,
VkShaderModule shaderModule,
const char * entry = "main" )

◆ load_shader_module()

bool tachyon::vulkan::load_shader_module ( const char * filePath,
VkDevice device,
const VkAllocationCallbacks * callbacks,
VkShaderModule * outShaderModule )

◆ OnVulkanError()

void tachyon::vulkan::OnVulkanError ( VkResult result,
const char * call )

#include <gui_core/graphics/vulkan/vk_types.h>

Logs a failed Vulkan call; the frame carries on.

A lost device is remembered: the GUI recreates it before its next frame (DeviceLost / RecreateDevice).

◆ IsDeviceLost()

bool tachyon::vulkan::IsDeviceLost ( )

◆ SetDeviceLost()

void tachyon::vulkan::SetDeviceLost ( bool lost)

◆ WaitForFence()

void tachyon::vulkan::WaitForFence ( VkDevice device,
VkFence fence )
inline

#include <gui_core/graphics/vulkan/vk_types.h>

Waits for fence however long the GPU takes: VK_TIMEOUT only means the GPU is slow (a busy or stalled driver, a paused debugger).

A real error such as device loss is reported and ends the wait.

Variable Documentation

◆ drawImageFormat

VkFormat tachyon::vulkan::drawImageFormat = VK_FORMAT_B8G8R8A8_UNORM
constexpr

#include <gui_core/graphics/vulkan/vk_defaults.h>

format of the images the GUI draws into

◆ depthImageFormat

VkFormat tachyon::vulkan::depthImageFormat = VK_FORMAT_D32_SFLOAT
constexpr

◆ FRAME_DELETION_SLOT_COUNT

unsigned int tachyon::vulkan::FRAME_DELETION_SLOT_COUNT = 3
constexpr

#include <gui_core/graphics/vulkan/vk_device_context.h>

Frame deletion queue slots: FRAME_OVERLAP + 1, so the slot pushed to is never the one flushed in the same frame (static-asserted against FRAME_OVERLAP).

◆ FRAME_OVERLAP

unsigned int tachyon::vulkan::FRAME_OVERLAP = 2
constexpr