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

Public Member Functions

 GUIDevice_vulkan (vk::PhysicalDevice physicalDevice)
 
 GUIDevice_vulkan (const GUIDevice_vulkan &)=delete
 
GUIDevice_vulkanoperator= (const GUIDevice_vulkan &)=delete
 
 GUIDevice_vulkan (GUIDevice_vulkan &&)=delete
 
GUIDevice_vulkanoperator= (GUIDevice_vulkan &&)=delete
 
void initializeDevice (Window const &window) override
 
int score (vk::SurfaceKHR surface) const
 
int score (Window const &window) const override
 
std::vector< std::pair< uint32_t, uint8_t > > findBestQueueFamilyIndices (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 transitionLayout (vk::Image image, vk::Format format, vk::ImageLayout srcLayout, vk::ImageLayout dstLayout) 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 >
nonstd::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 (nonstd::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::GUIDevice_base
std::string string () const noexcept
 
 GUIDevice_base (const GUIDevice_base &)=delete
 
GUIDevice_baseoperator= (const GUIDevice_base &)=delete
 
 GUIDevice_base (GUIDevice_base &&)=delete
 
GUIDevice_baseoperator= (GUIDevice_base &&)=delete
 
ssize_t getNumberOfWindows () const noexcept
 
void add (std::unique_ptr< Window > window)
 
void remove (Window &window) noexcept
 
void render (hires_utc_clock::time_point displayTimePoint) noexcept
 

Data Fields

vk::PhysicalDeviceType deviceType = vk::PhysicalDeviceType::eOther
 
vk::PhysicalDeviceProperties physicalProperties
 
uint32_t graphicsQueueFamilyIndex = 0
 
uint32_t presentQueueFamilyIndex = 0
 
uint32_t computeQueueFamilyIndex = 0
 
uint32_t graphicsQueueIndex = 0
 
uint32_t presentQueueIndex = 0
 
uint32_t computeQueueIndex = 0
 
vk::Queue graphicsQueue
 
vk::Queue presentQueue
 
vk::Queue computeQueue
 
vk::CommandPool graphicsCommandPool
 
vk::CommandPool presentCommandPool
 
vk::CommandPool computeCommandPool
 
vk::Buffer quadIndexBuffer
 Shared index buffer containing indices for drawing quads.
 
VmaAllocation quadIndexBufferAllocation = {}
 
std::unique_ptr< PipelineFlat::DeviceSharedflatPipeline
 
std::unique_ptr< PipelineBox::DeviceSharedboxPipeline
 
std::unique_ptr< PipelineImage::DeviceSharedimagePipeline
 
std::unique_ptr< PipelineSDF::DeviceSharedSDFPipeline
 
std::unique_ptr< PipelineToneMapper::DeviceSharedtoneMapperPipeline
 
std::vector< const char * > requiredExtensions
 
bool supportsLazyTransientImages = false
 
vk::ImageUsageFlags transientImageUsageFlags = vk::ImageUsageFlags{}
 
VmaMemoryUsage lazyMemoryUsage = VMA_MEMORY_USAGE_GPU_ONLY
 
std::vector< std::pair< uint32_t, uint8_t > > queueFamilyIndicesAndCapabilities
 
vk::SurfaceFormatKHR bestSurfaceFormat = {}
 
vk::PresentModeKHR bestSurfacePresentMode = vk::PresentModeKHR::eFifo
 
- Data Fields inherited from tt::GUIDevice_base
State state = State::NO_DEVICE
 
std::string deviceName = "<no device>"
 
uint32_t vendorID = 0
 
uint32_t deviceID = 0
 
uuid deviceUUID = {}
 
std::vector< std::unique_ptr< Window > > windows
 

Additional Inherited Members

- Public Types inherited from tt::GUIDevice_base
enum class  State { NO_DEVICE , READY_TO_DRAW }
 

Member Function Documentation

◆ findBestQueueFamilyIndices()

std::vector< std::pair< uint32_t, uint8_t > > tt::GUIDevice_vulkan::findBestQueueFamilyIndices ( 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.

◆ initializeDevice()

void tt::GUIDevice_vulkan::initializeDevice ( Window const & window)
overridevirtual

Initialise the logical device.

Parameters
windowis used as prototype for queue allocation.

Reimplemented from tt::GUIDevice_base.

◆ score()

int tt::GUIDevice_vulkan::score ( Window const & window) 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, postive values for increasing score.

Implements tt::GUIDevice_base.

Field Documentation

◆ bestSurfaceFormat

vk::SurfaceFormatKHR tt::GUIDevice_vulkan::bestSurfaceFormat = {}
mutable

Best surfae format. score(window) must be called before initializeDevice(window);

◆ bestSurfacePresentMode

vk::PresentModeKHR tt::GUIDevice_vulkan::bestSurfacePresentMode = vk::PresentModeKHR::eFifo
mutable

Best surfae format. score(window) must be called before initializeDevice(window);

◆ quadIndexBuffer

vk::Buffer tt::GUIDevice_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

◆ queueFamilyIndicesAndCapabilities

std::vector<std::pair<uint32_t, uint8_t> > tt::GUIDevice_vulkan::queueFamilyIndicesAndCapabilities
mutable

Sorted list of queueFamilies and their capabilities. score(window) must be called before initializeDevice(window);

◆ requiredExtensions

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

List if extension required on this device.


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