TGUI 1.14-dev
Loading...
Searching...
No Matches
tgui::BackendRendererVulkan Class Reference

Backend renderer that uses Vulkan. More...

#include <TGUI/Backend/Renderer/Vulkan/BackendRendererVulkan.hpp>

Inheritance diagram for tgui::BackendRendererVulkan:
tgui::BackendRenderer

Classes

struct  Functions
 Vulkan functions that are used by TGUI. More...

Public Member Functions

 BackendRendererVulkan (const VulkanContext &vulkanContext)
 Initializes the backend renderer.
 ~BackendRendererVulkan () override
 Destructor.
std::shared_ptr< BackendTexture > createTexture () override
 Creates a new empty texture object.
unsigned int getMaximumTextureSize () override
 Get the maximum allowed texture size.
const VulkanContext & getVulkanContext () const
 Returns the Vulkan objects that were passed to the constructor of this object.
const Functions & getFunctions () const
 Returns the Vulkan functions that were loaded by the renderer.
VkPipeline createPipeline (VkRenderPass renderPass, std::uint32_t subpass, VkFormat colorFormat, VkFormat depthFormat, VkFormat stencilFormat, VkSampleCountFlagBits samples) const
VkPipelineLayout getPipelineLayout () const
VkDescriptorSet getSamplerDescriptorSet (bool smooth) const
VkDescriptorSet allocateTextureDescriptorSet (VkImageView imageView, VkDescriptorPool &pool)
void freeTextureDescriptorSet (VkDescriptorSet descriptorSet, VkDescriptorPool pool)
bool createBuffer (VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags memoryProperties, VkBuffer &buffer, VkDeviceMemory &memory) const
std::uint32_t findMemoryType (std::uint32_t memoryTypeBits, VkMemoryPropertyFlags properties) const
std::uint64_t submitUploadCommands (const std::function< void(VkCommandBuffer)> &recordFunc, VkBuffer stagingBuffer, VkDeviceMemory stagingMemory)
void waitForUpload (std::uint64_t uploadId)
void releaseFinishedUploads ()
template<typename HandleType>
void setObjectName (VkObjectType objectType, HandleType handle, const char *name) const
Public Member Functions inherited from tgui::BackendRenderer
virtual ~BackendRenderer ()=default
 Virtual destructor.
virtual std::shared_ptr< BackendText > createText ()
 Creates a new empty text object.

Static Public Member Functions

static bool isSrgbFormat (VkFormat format)

Detailed Description

Backend renderer that uses Vulkan.

The renderer doesn't create any Vulkan instance or device itself, these have to be provided by the user. TGUI doesn't link to the Vulkan loader, all Vulkan functions are loaded via the provided vkGetInstanceProcAddr. All TGUI functions must be called from the same thread, as TGUI submits work to the provided queue when textures are loaded. These uploads are submitted without waiting for them to finish, so any work that accesses the images of TGUI textures has to be submitted to the same queue.

Constructor & Destructor Documentation

◆ BackendRendererVulkan()

tgui::BackendRendererVulkan::BackendRendererVulkan ( const VulkanContext & vulkanContext)

Initializes the backend renderer.

Parameters
vulkanContextVulkan objects that will be used for rendering
Exceptions
Exceptionwhen getInstanceProcAddr is empty, when a Vulkan function couldn't be loaded or when a Vulkan object couldn't be created

Member Function Documentation

◆ createTexture()

std::shared_ptr< BackendTexture > tgui::BackendRendererVulkan::createTexture ( )
nodiscardoverridevirtual

Creates a new empty texture object.

Returns
Shared pointer to a new texture object

Implements tgui::BackendRenderer.

◆ getFunctions()

const Functions & tgui::BackendRendererVulkan::getFunctions ( ) const
nodiscard

Returns the Vulkan functions that were loaded by the renderer.

Returns
Function pointers that TGUI uses to call Vulkan functions

◆ getMaximumTextureSize()

unsigned int tgui::BackendRendererVulkan::getMaximumTextureSize ( )
nodiscardoverridevirtual

Get the maximum allowed texture size.

Returns
Maximum width and height that you should try to use in a single texture

This maximum size is defined by the graphics driver. Most likely this will return 8192 or 16384.

Implements tgui::BackendRenderer.

◆ getVulkanContext()

const VulkanContext & tgui::BackendRendererVulkan::getVulkanContext ( ) const
nodiscard

Returns the Vulkan objects that were passed to the constructor of this object.

Returns
Vulkan objects that are used for rendering

The documentation for this class was generated from the following file: