ci(amd64/clang/lsan): fix leak sanitizer errors #57
					 2 changed files with 41 additions and 34 deletions
				
			
		| 
						 | 
					@ -1,6 +1,7 @@
 | 
				
			||||||
#include <app/system.hpp>
 | 
					#include <app/system.hpp>
 | 
				
			||||||
#include <renderer/backend/vk/context/instance.hpp>
 | 
					#include <renderer/backend/vk/context/instance.hpp>
 | 
				
			||||||
#include <renderer/backend/vk/utils.hpp>
 | 
					#include <renderer/backend/vk/utils.hpp>
 | 
				
			||||||
 | 
					#include <vulkan/vulkan_core.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(_WIN32)
 | 
					#if defined(_WIN32)
 | 
				
			||||||
	#error "Unsupported platform (currently)"
 | 
						#error "Unsupported platform (currently)"
 | 
				
			||||||
| 
						 | 
					@ -190,11 +191,21 @@ void Instance::initialize_instance()
 | 
				
			||||||
	        .pValues = &setting_duplicate_message_limit,
 | 
						        .pValues = &setting_duplicate_message_limit,
 | 
				
			||||||
	    },
 | 
						    },
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
						auto disable = VK_VALIDATION_FEATURE_DISABLE_SHADER_VALIDATION_CACHE_EXT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						auto validation_features = VkValidationFeaturesEXT {
 | 
				
			||||||
 | 
							.sType = VK_STRUCTURE_TYPE_VALIDATION_FEATURES_EXT,
 | 
				
			||||||
 | 
							.enabledValidationFeatureCount = 0u,
 | 
				
			||||||
 | 
							.pEnabledValidationFeatures = nullptr,
 | 
				
			||||||
 | 
							.disabledValidationFeatureCount = 1u,
 | 
				
			||||||
 | 
							.pDisabledValidationFeatures = &disable,
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const VkLayerSettingsCreateInfoEXT layer_settings_create_info = {
 | 
						const VkLayerSettingsCreateInfoEXT layer_settings_create_info = {
 | 
				
			||||||
		.sType = VK_STRUCTURE_TYPE_LAYER_SETTINGS_CREATE_INFO_EXT,
 | 
							.sType = VK_STRUCTURE_TYPE_LAYER_SETTINGS_CREATE_INFO_EXT,
 | 
				
			||||||
 | 
							.pNext = &validation_features,
 | 
				
			||||||
		.settingCount = settings.size(),
 | 
							.settingCount = settings.size(),
 | 
				
			||||||
		.pSettings = settings.data()
 | 
							.pSettings = settings.data(),
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	auto layers = std::vector<const char *> {
 | 
						auto layers = std::vector<const char *> {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -44,39 +44,39 @@ Swapchain::Swapchain(ISurface *surface, IGpu *gpu, IDevice *device)
 | 
				
			||||||
	        .oldSwapchain = nullptr,
 | 
						        .oldSwapchain = nullptr,
 | 
				
			||||||
	    }
 | 
						    }
 | 
				
			||||||
	);
 | 
						);
 | 
				
			||||||
	log_dbg("CREATED SWAPCHAIN @ {:x}", std::bit_cast<size_t>(m_swapchain));
 | 
					 | 
				
			||||||
	m_resolution = capabilities.currentExtent;
 | 
						m_resolution = capabilities.currentExtent;
 | 
				
			||||||
	m_device->name(m_swapchain, "swapchain {}", idx++);
 | 
						m_device->name(m_swapchain, "swapchain {}", idx++);
 | 
				
			||||||
	m_device->wait_idle();
 | 
						m_device->wait_idle();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// m_images = m_device->get_swapchain_images(m_swapchain);
 | 
						m_images = m_device->get_swapchain_images(m_swapchain);
 | 
				
			||||||
	// m_image_views.resize(m_images.size());
 | 
						m_image_views.resize(m_images.size());
 | 
				
			||||||
	// for (auto idx = 0u; auto [image, view] : std::views::zip(m_images, m_image_views))
 | 
						for (auto idx = 0u; auto [image, view] : std::views::zip(m_images, m_image_views))
 | 
				
			||||||
	// {
 | 
						{
 | 
				
			||||||
	// 	view = m_device->create_image_view(VkImageViewCreateInfo {
 | 
							view = m_device->create_image_view(VkImageViewCreateInfo {
 | 
				
			||||||
	// 		.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
 | 
								.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
 | 
				
			||||||
	// 		.image = image,
 | 
								.image = image,
 | 
				
			||||||
	// 		.viewType = VK_IMAGE_VIEW_TYPE_2D,
 | 
								.viewType = VK_IMAGE_VIEW_TYPE_2D,
 | 
				
			||||||
	// 		.format = surface_format.format,
 | 
								.format = surface_format.format,
 | 
				
			||||||
	//            .components = VkComponentMapping {
 | 
					            .components = VkComponentMapping {
 | 
				
			||||||
	//                .r = VK_COMPONENT_SWIZZLE_IDENTITY,
 | 
					                .r = VK_COMPONENT_SWIZZLE_IDENTITY,
 | 
				
			||||||
	//                .g = VK_COMPONENT_SWIZZLE_IDENTITY,
 | 
					                .g = VK_COMPONENT_SWIZZLE_IDENTITY,
 | 
				
			||||||
	//                .b = VK_COMPONENT_SWIZZLE_IDENTITY,
 | 
					                .b = VK_COMPONENT_SWIZZLE_IDENTITY,
 | 
				
			||||||
	//                .a = VK_COMPONENT_SWIZZLE_IDENTITY,
 | 
					                .a = VK_COMPONENT_SWIZZLE_IDENTITY,
 | 
				
			||||||
	//            },
 | 
					            },
 | 
				
			||||||
	//            .subresourceRange = VkImageSubresourceRange {
 | 
					            .subresourceRange = VkImageSubresourceRange {
 | 
				
			||||||
	//                .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
 | 
					                .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
 | 
				
			||||||
	//                .baseMipLevel = 0u,
 | 
					                .baseMipLevel = 0u,
 | 
				
			||||||
	//                .levelCount = 1u,
 | 
					                .levelCount = 1u,
 | 
				
			||||||
	//                .baseArrayLayer = 0u,
 | 
					                .baseArrayLayer = 0u,
 | 
				
			||||||
	//                .layerCount = 1u,
 | 
					                .layerCount = 1u,
 | 
				
			||||||
	//            }
 | 
					            }
 | 
				
			||||||
	// 	});
 | 
							});
 | 
				
			||||||
	//
 | 
					
 | 
				
			||||||
	// 	m_device->name(image, "swapchain image {}", idx++);
 | 
							m_device->name(image, "swapchain image {}", idx++);
 | 
				
			||||||
	// 	m_device->name(view, "swapchain image view {}", idx++);
 | 
							m_device->name(view, "swapchain image view {}", idx++);
 | 
				
			||||||
	// }
 | 
						}
 | 
				
			||||||
 | 
						m_device->wait_idle();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Swapchain::~Swapchain()
 | 
					Swapchain::~Swapchain()
 | 
				
			||||||
| 
						 | 
					@ -89,13 +89,9 @@ Swapchain::~Swapchain()
 | 
				
			||||||
	try
 | 
						try
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		m_device->wait_idle();
 | 
							m_device->wait_idle();
 | 
				
			||||||
		log_dbg("DESTROYING SWAPCHAIN @ {:x}", std::bit_cast<size_t>(m_swapchain));
 | 
							m_device->destroy_image_views(m_image_views);
 | 
				
			||||||
		std::this_thread::sleep_for(std::chrono::seconds { 10 });
 | 
					 | 
				
			||||||
		m_device->destroy_swapchain(m_swapchain);
 | 
							m_device->destroy_swapchain(m_swapchain);
 | 
				
			||||||
		m_device->wait_idle();
 | 
							m_device->wait_idle();
 | 
				
			||||||
 | 
					 | 
				
			||||||
		std::this_thread::sleep_for(std::chrono::seconds { 10 });
 | 
					 | 
				
			||||||
		std::cout << "EEP" << std::endl;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	catch (const std::exception &exp)
 | 
						catch (const std::exception &exp)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue