2025-09-25 22:23:08 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <app/system.hpp>
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-04 22:08:19 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <renderer/backend/vk/context/instance.hpp>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <renderer/backend/vk/utils.hpp>
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-09 14:08:14 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <vulkan/vulkan_core.h>
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#if defined(_WIN32)
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-25 22:23:08 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									#error "Unsupported platform (currently)"
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#elif defined(__unix__)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									#include <dlfcn.h>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								namespace {
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 14:37:16 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void *library = nullptr; // NOLINT
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#endif
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								namespace lt::renderer::vk {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// NOLINTBEGIN(cppcoreguidelines-avoid-non-const-global-variables)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// global functions
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-28 23:35:32 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								PFN_vkGetInstanceProcAddr vk_get_instance_proc_address {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkCreateInstance vk_create_instance {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkEnumerateInstanceExtensionProperties vk_enumerate_instance_extension_properties {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkEnumerateInstanceLayerProperties vk_enumerate_instance_layer_properties {};
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// instance functions
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-28 23:35:32 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								PFN_vkDestroyInstance vk_destroy_instance {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkEnumeratePhysicalDevices vk_enumerate_physical_devices {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkGetPhysicalDeviceProperties vk_get_physical_device_properties {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkGetPhysicalDeviceQueueFamilyProperties vk_get_physical_device_queue_family_properties {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkCreateDevice vk_create_device {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkGetDeviceProcAddr vk_get_device_proc_address {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkDestroyDevice vk_destroy_device {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkGetPhysicalDeviceFeatures vk_get_physical_device_features {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkEnumerateDeviceExtensionProperties vk_enumerate_device_extension_properties {};
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-25 12:56:14 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								PFN_vkGetPhysicalDeviceMemoryProperties vk_get_physical_device_memory_properties {};
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// extension instance functions
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-28 23:35:32 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								PFN_vkCmdBeginDebugUtilsLabelEXT vk_cmd_begin_debug_label {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkCmdEndDebugUtilsLabelEXT vk_cmd_end_debug_label {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkCmdInsertDebugUtilsLabelEXT vk_cmd_insert_debug_label {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkCreateDebugUtilsMessengerEXT vk_create_debug_messenger {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkDestroyDebugUtilsMessengerEXT vk_destroy_debug_messenger {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkQueueBeginDebugUtilsLabelEXT vk_queue_begin_debug_label {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkQueueEndDebugUtilsLabelEXT vk_queue_end_debug_label {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkQueueInsertDebugUtilsLabelEXT vk_queue_insert_debug_label {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkSetDebugUtilsObjectNameEXT vk_set_debug_object_name {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkSetDebugUtilsObjectTagEXT vk_set_debug_object_tag {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkSubmitDebugUtilsMessageEXT vk_submit_debug_message {};
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// device functions
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-28 23:35:32 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								PFN_vkGetDeviceQueue vk_get_device_queue {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkCreateCommandPool vk_create_command_pool {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkDestroyCommandPool vk_destroy_command_pool {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkAllocateCommandBuffers vk_allocate_command_buffers {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkFreeCommandBuffers vk_free_command_buffers {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkBeginCommandBuffer vk_begin_command_buffer {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkEndCommandBuffer vk_end_command_buffer {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkCmdPipelineBarrier vk_cmd_pipeline_barrier {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkQueueSubmit vk_queue_submit {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkQueueWaitIdle vk_queue_wait_idle {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkDeviceWaitIdle vk_device_wait_idle {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkCreateFence vk_create_fence {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkDestroyFence vk_destroy_fence {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkWaitForFences vk_wait_for_fences {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkResetFences vk_reset_fences {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkCreateSemaphore vk_create_semaphore {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkDestroySemaphore vk_destroy_semaphore {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkCreateSwapchainKHR vk_create_swapchain_khr {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkDestroySwapchainKHR vk_destroy_swapchain_khr {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkGetSwapchainImagesKHR vk_get_swapchain_images_khr {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkAcquireNextImageKHR vk_acquire_next_image_khr {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkQueuePresentKHR vk_queue_present_khr {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkCreateImageView vk_create_image_view {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkDestroyImageView vk_destroy_image_view {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkCreateRenderPass vk_create_render_pass {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkDestroyRenderPass vk_destroy_render_pass {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkCreateFramebuffer vk_create_frame_buffer {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkDestroyFramebuffer vk_destroy_frame_buffer {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkCreateShaderModule vk_create_shader_module {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkDestroyShaderModule vk_destroy_shader_module {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkCreatePipelineLayout vk_create_pipeline_layout {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkDestroyPipelineLayout vk_destroy_pipeline_layout {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkCreateGraphicsPipelines vk_create_graphics_pipelines {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkDestroyPipeline vk_destroy_pipeline {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkCmdBeginRenderPass vk_cmd_begin_render_pass {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkCmdEndRenderPass vk_cmd_end_render_pass {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkCmdBindPipeline vk_cmd_bind_pipeline {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkCmdDraw vk_cmd_draw {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkCmdSetViewport vk_cmd_set_viewport {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkCmdSetScissor vk_cmd_set_scissors {};
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-26 06:56:18 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								PFN_vkCmdPushConstants vk_cmd_push_constants {};
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-22 18:50:17 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-25 12:56:14 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								PFN_vkCreateBuffer vk_create_buffer {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkDestroyBuffer vk_destroy_buffer {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkGetBufferMemoryRequirements vk_get_buffer_memory_requirements {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkAllocateMemory vk_allocate_memory {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkBindBufferMemory vk_bind_buffer_memory {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkMapMemory vk_map_memory {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkUnmapMemory vk_unmap_memory {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkFreeMemory vk_free_memory {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-01 17:31:46 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								PFN_vkResetCommandBuffer vk_reset_command_buffer {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-26 16:43:56 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								PFN_vkCmdBeginRendering vk_cmd_begin_rendering {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkCmdEndRendering vk_cmd_end_rendering {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-28 23:35:32 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								PFN_vkGetPhysicalDeviceSurfaceSupportKHR vk_get_physical_device_surface_support {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR vk_get_physical_device_surface_capabilities {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								PFN_vkGetPhysicalDeviceSurfaceFormatsKHR vk_get_physical_device_surface_formats {};
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 14:37:16 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-04 22:08:19 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								auto vk_create_xlib_surface_khr = PFN_vkCreateXlibSurfaceKHR {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								auto vk_destroy_surface_khr = PFN_vkDestroySurfaceKHR {};
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-26 16:43:56 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// NOLINTEND(cppcoreguidelines-avoid-non-const-global-variables)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-25 22:23:08 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								Instance::Instance()
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_library();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_global_functions();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									initialize_instance();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_instance_functions();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-25 22:23:08 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								Instance::~Instance()
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-30 14:04:22 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									vk_destroy_instance(m_instance, nullptr);
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-25 22:23:08 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									unload_library();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-25 22:23:08 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void Instance::initialize_instance()
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									auto app_info = VkApplicationInfo {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										.pApplicationName = "Hallo Hallo Hallo :3",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										.applicationVersion = VK_MAKE_VERSION(1, 4, 0),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										.pEngineName = "light",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										.engineVersion = VK_MAKE_VERSION(1, 4, 0),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										.apiVersion = VK_API_VERSION_1_4,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									auto extensions = std::vector<const char *> {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										VK_EXT_DEBUG_UTILS_EXTENSION_NAME,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										VK_KHR_SURFACE_EXTENSION_NAME,
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 14:37:16 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										VK_KHR_XLIB_SURFACE_EXTENSION_NAME,
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									};
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-30 14:04:22 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									const char *layer_name = "VK_LAYER_KHRONOS_validation";
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									const auto setting_validate_core = VkBool32 { VK_TRUE };
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									const auto setting_validate_sync = VkBool32 { VK_TRUE };
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									const auto setting_thread_safety = VkBool32 { VK_TRUE };
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									const auto *setting_debug_action = "";
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									const auto setting_enable_message_limit = VkBool32 { VK_TRUE };
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-02 23:53:28 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									const auto setting_duplicate_message_limit = uint32_t { UINT32_MAX };
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-30 14:04:22 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									auto setting_report_flags = std::array<const char *, 5> {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										"info", "warn", "perf", "error", "verbose",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									const auto settings = std::array<VkLayerSettingEXT, 7>({
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-08 06:29:20 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									    VkLayerSettingEXT {
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-30 14:04:22 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									        .pLayerName = layer_name,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									        .pSettingName = "validate_core",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									        .type = VK_LAYER_SETTING_TYPE_BOOL32_EXT,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									        .valueCount = 1,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									        .pValues = &setting_validate_core,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    },
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-08 06:29:20 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									    VkLayerSettingEXT {
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-30 14:04:22 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									        .pLayerName = layer_name,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									        .pSettingName = "validate_sync",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									        .type = VK_LAYER_SETTING_TYPE_BOOL32_EXT,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									        .valueCount = 1,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									        .pValues = &setting_validate_sync,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    },
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-08 06:29:20 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									    VkLayerSettingEXT {
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-30 14:04:22 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									        .pLayerName = layer_name,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									        .pSettingName = "thread_safety",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									        .type = VK_LAYER_SETTING_TYPE_BOOL32_EXT,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									        .valueCount = 1,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									        .pValues = &setting_thread_safety,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    },
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-08 06:29:20 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									    VkLayerSettingEXT {
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-30 14:04:22 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									        .pLayerName = layer_name,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									        .pSettingName = "debug_action",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									        .type = VK_LAYER_SETTING_TYPE_STRING_EXT,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									        .valueCount = 1,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									        .pValues = static_cast<const void *>(&setting_debug_action),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    },
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-08 06:29:20 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									    VkLayerSettingEXT {
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-30 14:04:22 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									        .pLayerName = layer_name,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									        .pSettingName = "report_flags",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									        .type = VK_LAYER_SETTING_TYPE_STRING_EXT,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									        .valueCount = setting_report_flags.size(),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									        .pValues = static_cast<const void *>(setting_report_flags.data()),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    },
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-08 06:29:20 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									    VkLayerSettingEXT {
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-30 14:04:22 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									        .pLayerName = layer_name,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									        .pSettingName = "enable_message_limit",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									        .type = VK_LAYER_SETTING_TYPE_BOOL32_EXT,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									        .valueCount = 1,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									        .pValues = &setting_enable_message_limit,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    },
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-08 06:29:20 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									    VkLayerSettingEXT {
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-30 14:04:22 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									        .pLayerName = layer_name,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									        .pSettingName = "duplicate_message_limit",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									        .type = VK_LAYER_SETTING_TYPE_UINT32_EXT,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									        .valueCount = 1u,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									        .pValues = &setting_duplicate_message_limit,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    },
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									});
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									const VkLayerSettingsCreateInfoEXT layer_settings_create_info = {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										.sType = VK_STRUCTURE_TYPE_LAYER_SETTINGS_CREATE_INFO_EXT,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										.settingCount = settings.size(),
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-09 14:08:14 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										.pSettings = settings.data(),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-30 14:04:22 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									auto layers = std::vector<const char *> {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										"VK_LAYER_KHRONOS_validation",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									auto instance_info = VkInstanceCreateInfo {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-30 14:04:22 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										.pNext = &layer_settings_create_info,
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										.pApplicationInfo = &app_info,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										.enabledLayerCount = static_cast<uint32_t>(layers.size()),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										.ppEnabledLayerNames = layers.data(),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										.enabledExtensionCount = static_cast<uint32_t>(extensions.size()),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										.ppEnabledExtensionNames = extensions.data(),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										auto count = 0u;
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 14:37:16 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										vkc(vk_enumerate_instance_extension_properties(nullptr, &count, nullptr));
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										auto extensions = std::vector<VkExtensionProperties>(count);
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-21 09:49:42 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										memset(extensions.data(), 0, extensions.size() * sizeof(VkExtensionProperties));
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 14:37:16 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										vkc(vk_enumerate_instance_extension_properties(nullptr, &count, extensions.data()));
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-22 18:50:17 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										// log_inf("Available vulkan instance extensions:");
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										for (auto &ext : extensions)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										{
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-22 18:50:17 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											// log_inf("\t{} @ {}", ext.extensionName, ext.specVersion);
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 14:37:16 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									vkc(vk_create_instance(&instance_info, nullptr, &m_instance));
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									ensure(m_instance, "Failed to create vulkan instance");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-25 22:23:08 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void Instance::load_library()
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-21 09:49:42 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									constexpr auto runtime_loader_flags = RTLD_NOW | RTLD_LOCAL | RTLD_NODELETE;
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-09 14:08:14 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									library = dlopen("libvulkan.so.1", runtime_loader_flags);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									if (!library)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										library = dlopen("libvulkan.so", runtime_loader_flags);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-08 13:35:42 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									ensure(library, "Failed to dlopen vulkan library");
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									vk_get_instance_proc_address = reinterpret_cast<PFN_vkGetInstanceProcAddr>(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    dlsym(library, "vkGetInstanceProcAddr")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									ensure(vk_get_instance_proc_address, "Failed to load vulkan function: vkGetInstanceProcAddr");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-25 22:23:08 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void Instance::unload_library()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									if (!library)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-08 13:35:42 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// calling dlclose causes many issues with runtime analyzers
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// eg. https://github.com/google/sanitizers/issues/89
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// with no noticable gains, so we just don't bother closing it.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-08 13:16:25 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// dlclose(library);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// library = nullptr;
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-25 22:23:08 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								void Instance::load_global_functions()
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									constexpr auto load_fn = []<typename T>(T &pfn, const char *fn_name) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										pfn = reinterpret_cast<T>(vk_get_instance_proc_address(nullptr, fn_name));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										ensure(pfn, "Failed to load vulkan global function: {}", fn_name);
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-22 18:50:17 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										// log_trc("Loaded global function: {}", fn_name);
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_create_instance, "vkCreateInstance");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_enumerate_instance_extension_properties, "vkEnumerateInstanceExtensionProperties");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_enumerate_instance_layer_properties, "vkEnumerateInstanceLayerProperties");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-25 22:23:08 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void Instance::load_instance_functions()
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									const auto load_fn = [&]<typename T>(T &pfn, const char *fn_name) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										pfn = reinterpret_cast<T>(vk_get_instance_proc_address(m_instance, fn_name));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										ensure(pfn, "Failed to load vulkan instance function: {}", fn_name);
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-22 18:50:17 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										// log_trc("Loaded instance function: {}", fn_name);
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_destroy_instance, "vkDestroyInstance");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_enumerate_physical_devices, "vkEnumeratePhysicalDevices");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_get_physical_device_properties, "vkGetPhysicalDeviceProperties");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    vk_get_physical_device_queue_family_properties,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    "vkGetPhysicalDeviceQueueFamilyProperties"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_create_device, "vkCreateDevice");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_get_device_proc_address, "vkGetDeviceProcAddr");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_destroy_device, "vkDestroyDevice");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_get_physical_device_features, "vkGetPhysicalDeviceFeatures");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_enumerate_device_extension_properties, "vkEnumerateDeviceExtensionProperties");
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-25 12:56:14 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_get_physical_device_memory_properties, "vkGetPhysicalDeviceMemoryProperties");
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_cmd_begin_debug_label, "vkCmdBeginDebugUtilsLabelEXT");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_cmd_end_debug_label, "vkCmdEndDebugUtilsLabelEXT");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_cmd_insert_debug_label, "vkCmdInsertDebugUtilsLabelEXT");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_create_debug_messenger, "vkCreateDebugUtilsMessengerEXT");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_destroy_debug_messenger, "vkDestroyDebugUtilsMessengerEXT");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_queue_begin_debug_label, "vkQueueBeginDebugUtilsLabelEXT");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_queue_end_debug_label, "vkQueueEndDebugUtilsLabelEXT");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_queue_insert_debug_label, "vkQueueInsertDebugUtilsLabelEXT");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_set_debug_object_name, "vkSetDebugUtilsObjectNameEXT");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_set_debug_object_tag, "vkSetDebugUtilsObjectTagEXT");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_submit_debug_message, "vkSubmitDebugUtilsMessageEXT");
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-22 18:50:17 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 14:37:16 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_get_physical_device_surface_support, "vkGetPhysicalDeviceSurfaceSupportKHR");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    vk_get_physical_device_surface_capabilities,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									    "vkGetPhysicalDeviceSurfaceCapabilitiesKHR"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_get_physical_device_surface_formats, "vkGetPhysicalDeviceSurfaceFormatsKHR");
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-22 18:50:17 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_create_xlib_surface_khr, "vkCreateXlibSurfaceKHR");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_destroy_surface_khr, "vkDestroySurfaceKHR");
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-25 22:23:08 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void Instance::load_device_functions_impl(VkDevice device)
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									const auto load_fn = [&]<typename T>(T &pfn, const char *fn_name) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-25 22:23:08 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										pfn = reinterpret_cast<T>(vk_get_device_proc_address(device, fn_name));
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										ensure(pfn, "Failed to load vulkan device function: {}", fn_name);
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-22 18:50:17 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										// log_trc("Loaded device function: {}", fn_name);
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_get_device_queue, "vkGetDeviceQueue");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_create_command_pool, "vkCreateCommandPool");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_destroy_command_pool, "vkDestroyCommandPool");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_allocate_command_buffers, "vkAllocateCommandBuffers");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_free_command_buffers, "vkFreeCommandBuffers");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_begin_command_buffer, "vkBeginCommandBuffer");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_end_command_buffer, "vkEndCommandBuffer");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_cmd_pipeline_barrier, "vkCmdPipelineBarrier");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_queue_submit, "vkQueueSubmit");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_queue_wait_idle, "vkQueueWaitIdle");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_device_wait_idle, "vkDeviceWaitIdle");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_create_fence, "vkCreateFence");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_destroy_fence, "vkDestroyFence");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_wait_for_fences, "vkWaitForFences");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_reset_fences, "vkResetFences");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_create_semaphore, "vkCreateSemaphore");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_destroy_semaphore, "vkDestroySemaphore");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_create_swapchain_khr, "vkCreateSwapchainKHR");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_destroy_swapchain_khr, "vkDestroySwapchainKHR");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_get_swapchain_images_khr, "vkGetSwapchainImagesKHR");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_acquire_next_image_khr, "vkAcquireNextImageKHR");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_queue_present_khr, "vkQueuePresentKHR");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_create_image_view, "vkCreateImageView");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_destroy_image_view, "vkDestroyImageView");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_create_render_pass, "vkCreateRenderPass");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_destroy_render_pass, "vkDestroyRenderPass");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_create_frame_buffer, "vkCreateFramebuffer");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_destroy_frame_buffer, "vkDestroyFramebuffer");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_create_shader_module, "vkCreateShaderModule");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_destroy_shader_module, "vkDestroyShaderModule");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_create_pipeline_layout, "vkCreatePipelineLayout");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_destroy_pipeline_layout, "vkDestroyPipelineLayout");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_create_graphics_pipelines, "vkCreateGraphicsPipelines");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_destroy_pipeline, "vkDestroyPipeline");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_cmd_begin_render_pass, "vkCmdBeginRenderPass");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_cmd_end_render_pass, "vkCmdEndRenderPass");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_cmd_bind_pipeline, "vkCmdBindPipeline");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_cmd_draw, "vkCmdDraw");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_cmd_set_viewport, "vkCmdSetViewport");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_cmd_set_scissors, "vkCmdSetScissor");
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-26 06:56:18 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_cmd_push_constants, "vkCmdPushConstants");
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-25 12:56:14 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_create_buffer, "vkCreateBuffer");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_destroy_buffer, "vkDestroyBuffer");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_allocate_memory, "vkAllocateMemory");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_bind_buffer_memory, "vkBindBufferMemory");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_map_memory, "vkMapMemory");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_unmap_memory, "vkUnmapMemory");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_free_memory, "vkFreeMemory");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_get_buffer_memory_requirements, "vkGetBufferMemoryRequirements");
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-01 17:31:46 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_reset_command_buffer, "vkResetCommandBuffer");
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-26 16:43:56 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_cmd_begin_rendering, "vkCmdBeginRendering");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									load_fn(vk_cmd_end_rendering, "vkCmdEndRendering");
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-04 22:08:19 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								auto Instance::enumerate_gpus() const -> std::vector<VkPhysicalDevice>
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 10:39:45 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-04 22:08:19 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									auto count = 0u;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									vkc(vk_enumerate_physical_devices(m_instance, &count, nullptr));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									ensure(count != 0u, "Failed to find any gpus with Vulkan support");
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 10:39:45 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-04 22:08:19 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									auto gpus = std::vector<VkPhysicalDevice>(count);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									vkc(vk_enumerate_physical_devices(m_instance, &count, gpus.data()));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									return gpus;
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 10:39:45 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-04 22:08:19 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								auto Instance::create_xlib_surface(VkXlibSurfaceCreateInfoKHR info) const -> VkSurfaceKHR
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 10:39:45 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-04 22:08:19 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									auto *value = VkSurfaceKHR {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									vk_create_xlib_surface_khr(m_instance, &info, m_allocator, &value);
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 10:39:45 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-04 22:08:19 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									return value;
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 10:39:45 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-04 22:08:19 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								[[nodiscard]] auto Instance::create_messenger(VkDebugUtilsMessengerCreateInfoEXT info) const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    -> VkDebugUtilsMessengerEXT
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 10:39:45 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-04 22:08:19 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									auto *messenger = VkDebugUtilsMessengerEXT {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									vkc(vk_create_debug_messenger(m_instance, &info, m_allocator, &messenger));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									return messenger;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 10:39:45 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-04 22:08:19 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void Instance::destroy_surface(VkSurfaceKHR surface) const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									vk_destroy_surface_khr(m_instance, surface, m_allocator);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 10:39:45 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-04 22:08:19 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void Instance::destroy_messenger(VkDebugUtilsMessengerEXT messenger) const
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									vk_destroy_debug_messenger(m_instance, messenger, m_allocator);
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 10:39:45 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-08-04 10:39:08 +03:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								} // namespace lt::renderer::vk
							 |