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

Public Member Functions

gfx_queue_vulkan constget_graphics_queue () const noexcept
 Get a graphics queue.
 
gfx_queue_vulkan constget_graphics_queue (gfx_surface const &surface) const noexcept
 Get a graphics queue.
 
gfx_queue_vulkan constget_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, VmaAllocationcreateBuffer (const vk::BufferCreateInfo &bufferCreateInfo, const VmaAllocationCreateInfo &allocationCreateInfo) const
 
void destroyBuffer (const vk::Buffer &buffer, const VmaAllocation &allocation) const
 
std::pair< vk::Image, VmaAllocationcreateImage (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, std::size_t size) const
 
vk::ShaderModule loadShader (std::span< std::byte const > shaderObjectBytes) const
 
vk::ShaderModule loadShader (std::filesystem::path const &path) 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::Extent2D getRenderAreaGranularity (const vk::RenderPass &render_pass) const noexcept
 
vk::Semaphore createSemaphore (const vk::SemaphoreCreateInfo &createInfo=vk::SemaphoreCreateInfo{}) 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
 
void setDebugUtilsObjectNameEXT (vk::DebugUtilsObjectNameInfoEXT const &name_info) const
 
void setDebugUtilsObjectNameEXT (vk::Image image, char const *name) const
 
void setDebugUtilsObjectNameEXT (vk::Buffer buffer, char const *name) const
 
void setDebugUtilsObjectNameEXT (vk::Sampler sampler, char const *name) const
 
void setDebugUtilsObjectNameEXT (vk::ShaderModule shader_module, char const *name) const
 
void cmdBeginDebugUtilsLabelEXT (vk::CommandBuffer buffer, vk::DebugUtilsLabelEXT const &create_info) const
 
void cmdEndDebugUtilsLabelEXT (vk::CommandBuffer buffer) const
 
void cmdBeginDebugUtilsLabelEXT (vk::CommandBuffer buffer, char const *name) const
 
template<typename T >
void destroy (T x) const
 
vk::SurfaceCapabilitiesKHR getSurfaceCapabilitiesKHR (vk::SurfaceKHR surface) const
 
void log_memory_usage () const noexcept override
 
- Public Member Functions inherited from v1::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::PhysicalDevice physicalIntrinsic
 
vk::Device intrinsic
 
VmaAllocator allocator
 
vk::PhysicalDeviceType deviceType = vk::PhysicalDeviceType::eOther
 
vk::PhysicalDeviceProperties physicalProperties
 
std::vector< gfx_queue_vulkan_queues
 
vk::PhysicalDeviceFeatures device_features
 The device features that have been turned on for this device.
 
vk::Buffer quadIndexBuffer
 Shared index buffer containing indices for drawing quads.
 
VmaAllocation quadIndexBufferAllocation = {}
 
std::unique_ptr< pipeline_box::device_sharedbox_pipeline
 
std::unique_ptr< pipeline_image::device_sharedimage_pipeline
 
std::unique_ptr< pipeline_SDF::device_sharedSDF_pipeline
 
std::unique_ptr< pipeline_alpha::device_sharedalpha_pipeline
 
std::unique_ptr< pipeline_tone_mapper::device_sharedtone_mapper_pipeline
 
std::vector< const char * > requiredExtensions
 
bool supportsLazyTransientImages = false
 
vk::ImageUsageFlags transientImageUsageFlags = vk::ImageUsageFlags{}
 
VmaMemoryUsage lazyMemoryUsage = VMA_MEMORY_USAGE_GPU_ONLY
 
- Data Fields inherited from v1::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 > > v1::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 & v1::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 & v1::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 v1::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]scoreOptional return parameter for the quality of the present mode.

◆ get_present_queue()

gfx_queue_vulkan const & v1::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 v1::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]scoreOptional return parameter for the quality of the surface format.

◆ log_memory_usage()

void v1::gfx_device_vulkan::log_memory_usage ( ) const
overridevirtualnoexcept

Reimplemented from v1::gfx_device.

◆ score()

int v1::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 v1::gfx_device.

Field Documentation

◆ device_features

vk::PhysicalDeviceFeatures v1::gfx_device_vulkan::device_features

The device features that have been turned on for this device.

◆ quadIndexBuffer

vk::Buffer v1::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 *> v1::gfx_device_vulkan::requiredExtensions

List if extension required on this device.


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