HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Data Fields
tt::gfx_device_vulkan Class Referencefinal
Inheritance diagram for tt::gfx_device_vulkan:
tt::gfx_device

Public Member Functions

gfx_queue_vulkan const & get_graphics_queue () const noexcept
 Get a graphics queue.
 
gfx_queue_vulkan const & get_graphics_queue (gfx_surface const &surface) const noexcept
 Get a graphics queue.
 
gfx_queue_vulkan const & get_present_queue (gfx_surface const &surface) const noexcept
 Get a present queue.
 
vk::SurfaceFormatKHR get_surface_format (gfx_surface const &surface, int *score=nullptr) const noexcept
 Get the surface format.
 
vk::PresentModeKHR get_present_mode (gfx_surface const &surface, int *score=nullptr) const noexcept
 Get the present mode.
 
 gfx_device_vulkan (gfx_system &system, vk::PhysicalDevice physicalDevice)
 
 gfx_device_vulkan (const gfx_device_vulkan &)=delete
 
gfx_device_vulkanoperator= (const gfx_device_vulkan &)=delete
 
 gfx_device_vulkan (gfx_device_vulkan &&)=delete
 
gfx_device_vulkanoperator= (gfx_device_vulkan &&)=delete
 
int score (vk::SurfaceKHR surface) const
 
int score (gfx_surface const &surface) const override
 
std::vector< std::pair< uint32_t, uint8_t > > find_best_queue_family_indices (vk::SurfaceKHR surface) const
 
std::pair< vk::Buffer, VmaAllocation > createBuffer (const vk::BufferCreateInfo &bufferCreateInfo, const VmaAllocationCreateInfo &allocationCreateInfo) const
 
void destroyBuffer (const vk::Buffer &buffer, const VmaAllocation &allocation) const
 
std::pair< vk::Image, VmaAllocation > createImage (const vk::ImageCreateInfo &imageCreateInfo, const VmaAllocationCreateInfo &allocationCreateInfo) const
 
void destroyImage (const vk::Image &image, const VmaAllocation &allocation) const
 
vk::CommandBuffer beginSingleTimeCommands () const
 
void endSingleTimeCommands (vk::CommandBuffer commandBuffer) const
 
void transition_layout (vk::Image image, vk::Format format, vk::ImageLayout src_layout, vk::ImageLayout dst_layout) const
 
void copyImage (vk::Image srcImage, vk::ImageLayout srcLayout, vk::Image dstImage, vk::ImageLayout dstLayout, vk::ArrayProxy< vk::ImageCopy const > regions) const
 
void clearColorImage (vk::Image image, vk::ImageLayout layout, vk::ClearColorValue const &color, vk::ArrayProxy< const vk::ImageSubresourceRange > ranges) const
 
template<typename T >
std::span< T > mapMemory (const VmaAllocation &allocation) const
 
void unmapMemory (const VmaAllocation &allocation) const
 
void flushAllocation (const VmaAllocation &allocation, VkDeviceSize offset, VkDeviceSize size) const
 
vk::ShaderModule loadShader (uint32_t const *data, size_t size) const
 
vk::ShaderModule loadShader (std::span< std::byte const > shaderObjectBytes) const
 
vk::ShaderModule loadShader (URL const &shaderObjectLocation) const
 
void waitIdle () const
 
vk::Result waitForFences (vk::ArrayProxy< const vk::Fence > fences, vk::Bool32 waitAll, uint64_t timeout) const
 
vk::Result acquireNextImageKHR (vk::SwapchainKHR swapchain, uint64_t timeout, vk::Semaphore semaphore, vk::Fence fence, uint32_t *pImageIndex) const
 
void resetFences (vk::ArrayProxy< const vk::Fence > fences) const
 
vk::Result createSwapchainKHR (const vk::SwapchainCreateInfoKHR *pCreateInfo, const vk::AllocationCallbacks *pAllocator, vk::SwapchainKHR *pSwapchain) const
 
std::vector< vk::Image > getSwapchainImagesKHR (vk::SwapchainKHR swapchain) const
 
vk::ImageView createImageView (const vk::ImageViewCreateInfo &createInfo) const
 
vk::Framebuffer createFramebuffer (const vk::FramebufferCreateInfo &createInfo) const
 
vk::RenderPass createRenderPass (const vk::RenderPassCreateInfo &createInfo) const
 
vk::Semaphore createSemaphore (const vk::SemaphoreCreateInfo &createInfo) const
 
vk::Fence createFence (const vk::FenceCreateInfo &createInfo) const
 
vk::DescriptorSetLayout createDescriptorSetLayout (const vk::DescriptorSetLayoutCreateInfo &createInfo) const
 
vk::DescriptorPool createDescriptorPool (const vk::DescriptorPoolCreateInfo &createInfo) const
 
vk::PipelineLayout createPipelineLayout (const vk::PipelineLayoutCreateInfo &createInfo) const
 
vk::Pipeline createGraphicsPipeline (vk::PipelineCache pipelineCache, const vk::GraphicsPipelineCreateInfo &createInfo) const
 
vk::Sampler createSampler (const vk::SamplerCreateInfo &createInfo) const
 
std::vector< vk::DescriptorSet > allocateDescriptorSets (const vk::DescriptorSetAllocateInfo &allocateInfo) const
 
std::vector< vk::CommandBuffer > allocateCommandBuffers (const vk::CommandBufferAllocateInfo &allocateInfo) const
 
void updateDescriptorSets (vk::ArrayProxy< const vk::WriteDescriptorSet > descriptorWrites, vk::ArrayProxy< const vk::CopyDescriptorSet > descriptorCopies) const
 
void freeCommandBuffers (vk::CommandPool commandPool, vk::ArrayProxy< const vk::CommandBuffer > commandBuffers) const
 
template<typename T >
void destroy (T x) const
 
vk::SurfaceCapabilitiesKHR getSurfaceCapabilitiesKHR (vk::SurfaceKHR surface) const
 
- Public Member Functions inherited from tt::gfx_device
std::string string () const noexcept
 
 gfx_device (gfx_system &system) noexcept
 
 gfx_device (const gfx_device &)=delete
 
gfx_deviceoperator= (const gfx_device &)=delete
 
 gfx_device (gfx_device &&)=delete
 
gfx_deviceoperator= (gfx_device &&)=delete
 

Static Public Member Functions

static void transition_layout (vk::CommandBuffer command_buffer, vk::Image image, vk::Format format, vk::ImageLayout src_layout, vk::ImageLayout dst_layout)
 

Data Fields

vk::PhysicalDeviceType deviceType = vk::PhysicalDeviceType::eOther
 
vk::PhysicalDeviceProperties physicalProperties
 
std::vector< gfx_queue_vulkan_queues
 
vk::Buffer quadIndexBuffer
 Shared index buffer containing indices for drawing quads.
 
VmaAllocation quadIndexBufferAllocation = {}
 
std::unique_ptr< pipeline_flat::device_sharedflatPipeline
 
std::unique_ptr< pipeline_box::device_sharedboxPipeline
 
std::unique_ptr< pipeline_image::device_sharedimagePipeline
 
std::unique_ptr< pipeline_SDF::device_sharedSDFPipeline
 
std::unique_ptr< pipeline_tone_mapper::device_sharedtoneMapperPipeline
 
std::vector< const char * > requiredExtensions
 
bool supportsLazyTransientImages = false
 
vk::ImageUsageFlags transientImageUsageFlags = vk::ImageUsageFlags{}
 
VmaMemoryUsage lazyMemoryUsage = VMA_MEMORY_USAGE_GPU_ONLY
 
- Data Fields inherited from tt::gfx_device
gfx_systemsystem
 
std::string deviceName = "<no device>"
 
uint32_t vendorID = 0
 
uint32_t deviceID = 0
 
uuid deviceUUID = {}
 

Member Function Documentation

◆ find_best_queue_family_indices()

std::vector< std::pair< uint32_t, uint8_t > > tt::gfx_device_vulkan::find_best_queue_family_indices ( vk::SurfaceKHR surface) const

Find the minimum number of queue families to instantiate for a window. This will give priority for having the Graphics and Present in the same queue family.

It is possible this method returns an incomplete queue family set. For example without Present.

◆ get_graphics_queue() [1/2]

gfx_queue_vulkan const & tt::gfx_device_vulkan::get_graphics_queue ( ) const
noexcept

Get a graphics queue.

Always returns the first queue that can handle graphics.

◆ get_graphics_queue() [2/2]

gfx_queue_vulkan const & tt::gfx_device_vulkan::get_graphics_queue ( gfx_surface const & surface) const
noexcept

Get a graphics queue.

Always returns the first queue that can handle both graphics and presenting; or as fallback the first graphics queue.

◆ get_present_mode()

vk::PresentModeKHR tt::gfx_device_vulkan::get_present_mode ( gfx_surface const & surface,
int * score = nullptr ) const
noexcept

Get the present mode.

Always returns the best suitable present mode.

Prioritized a double buffering mode.

Parameters
surfaceThe surface to determine the present mode for.
[out]

Optional return parameter for the quality of the present mode.

◆ get_present_queue()

gfx_queue_vulkan const & tt::gfx_device_vulkan::get_present_queue ( gfx_surface const & surface) const
noexcept

Get a present queue.

Always returns the first queue that can handle both graphics and presenting; or as fallback the first present queue.

◆ get_surface_format()

vk::SurfaceFormatKHR tt::gfx_device_vulkan::get_surface_format ( gfx_surface const & surface,
int * score = nullptr ) const
noexcept

Get the surface format.

Always returns the best suitable surface format.

Prioritizes HDR, followed by sRGB.

Parameters
surfaceThe surface to determine the surface format for.
[out]

Optional return parameter for the quality of the surface format.

◆ score()

int tt::gfx_device_vulkan::score ( gfx_surface const & surface) const
overridevirtual

Check if this device is a good match for this window.

It is possible for a window to be created that is not presentable, in case of a headless-virtual-display, however in this case it may still be able to be displayed by any device.

Returns
-1 When not viable, 0 when not presentable, positive values for increasing score.

Implements tt::gfx_device.

Field Documentation

◆ quadIndexBuffer

vk::Buffer tt::gfx_device_vulkan::quadIndexBuffer

Shared index buffer containing indices for drawing quads.

The index buffer uses the following index order: 0, 1, 2, 2, 1, 3

2<--3
|\ ^
| \ |
v \|
0-->1

◆ requiredExtensions

std::vector<const char *> tt::gfx_device_vulkan::requiredExtensions

List if extension required on this device.


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