HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Data Fields
v1::gfx_device Class Reference

Public Member Functions

 gfx_device (const gfx_device &)=delete
 
gfx_deviceoperator= (const gfx_device &)=delete
 
 gfx_device (gfx_device &&)=delete
 
gfx_deviceoperator= (gfx_device &&)=delete
 
 gfx_device (vk::PhysicalDevice physicalDevice)
 
std::string string () const noexcept
 
gfx_queue_vulkan const & get_graphics_queue () const noexcept
 Get a graphics queue.
 
gfx_queue_vulkan const & get_graphics_queue (vk::SurfaceKHR surface) const noexcept
 Get a graphics queue.
 
gfx_queue_vulkan const & get_present_queue (vk::SurfaceKHR surface) const noexcept
 Get a present queue.
 
vk::SurfaceFormatKHR get_surface_format (vk::SurfaceKHR surface, int *score=nullptr) const noexcept
 Get the surface format.
 
vk::PresentModeKHR get_present_mode (vk::SurfaceKHR surface, int *score=nullptr) const noexcept
 Get the present mode.
 
int score (vk::SurfaceKHR surface) const
 
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, 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
 

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

std::string deviceName = "<no device>"
 
uint32_t vendorID = 0
 
uint32_t deviceID = 0
 
uuid deviceUUID = {}
 
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< gfx_pipeline_box::device_shared > box_pipeline
 
std::unique_ptr< gfx_pipeline_image::device_shared > image_pipeline
 
std::unique_ptr< gfx_pipeline_SDF::device_shared > SDF_pipeline
 
std::unique_ptr< gfx_pipeline_override::device_shared > override_pipeline
 
std::unique_ptr< gfx_pipeline_tone_mapper::device_shared > tone_mapper_pipeline
 
std::vector< const char * > requiredExtensions
 
bool supportsLazyTransientImages = false
 
vk::ImageUsageFlags transientImageUsageFlags = vk::ImageUsageFlags{}
 
VmaMemoryUsage lazyMemoryUsage = VMA_MEMORY_USAGE_GPU_ONLY
 

Member Function Documentation

◆ find_best_queue_family_indices()

std::vector< std::pair< uint32_t, uint8_t > > v1::gfx_device::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::get_graphics_queue ( ) const
inlinenoexcept

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::get_graphics_queue ( vk::SurfaceKHR surface) const
inlinenoexcept

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::get_present_mode ( vk::SurfaceKHR surface,
int * score = nullptr ) const
inlinenoexcept

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::get_present_queue ( vk::SurfaceKHR surface) const
inlinenoexcept

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::get_surface_format ( vk::SurfaceKHR surface,
int * score = nullptr ) const
inlinenoexcept

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.

◆ score()

int v1::gfx_device::score ( vk::SurfaceKHR surface) const
inline

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

It is possible for a surface 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.

Field Documentation

◆ device_features

vk::PhysicalDeviceFeatures v1::gfx_device::device_features

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

◆ quadIndexBuffer

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

List if extension required on this device.


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