[Fix] (MG_Test/Backend/DirectVulkan): prevents double init

This commit is contained in:
2026-02-11 22:54:07 +08:00
parent b2ea29b91d
commit a25bfcb0d0
@@ -51,7 +51,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
} }
VulkanRenderer::VulkanRenderer(NativeWindowType window, const RendererConfig& cfg) : m_window(window), m_config(cfg) { VulkanRenderer::VulkanRenderer(NativeWindowType window, const RendererConfig& cfg) : m_window(window), m_config(cfg) {
Initialize(); // Initialize();
} }
VulkanRenderer::~VulkanRenderer() { VulkanRenderer::~VulkanRenderer() {
@@ -96,8 +96,8 @@ namespace MobileGL::MG_Backend::DirectVulkan {
} }
Bool validationLayerAvailable = CheckValidationLayerSupport(); Bool validationLayerAvailable = CheckValidationLayerSupport();
MGLOG_D("Validation layers %s.", validationLayerAvailable ? "available" : "not available"); MGLOG_I("Validation layers %s.", validationLayerAvailable ? "available" : "not available");
MGLOG_D("Validation layers %s.", m_config.EnableValidationLayers ? "requested" : "not requested"); MGLOG_I("Validation layers %s.", m_config.EnableValidationLayers ? "requested" : "not requested");
if (m_config.EnableValidationLayers && !validationLayerAvailable) { if (m_config.EnableValidationLayers && !validationLayerAvailable) {
MOBILEGL_ASSERT(false, "Validation layers requested but not available!"); MOBILEGL_ASSERT(false, "Validation layers requested but not available!");
@@ -145,7 +145,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
auto debugMessengerCreateInfo = PopulateDebugMessengerCreateInfo(); auto debugMessengerCreateInfo = PopulateDebugMessengerCreateInfo();
// Layers // Layers
if (m_validationLayersEnabled) { if (m_validationLayersEnabled) {
MGLOG_I("Enabling validation layer."); MGLOG_I("Enabling validation layer...");
instanceInfo.enabledLayerCount = static_cast<uint32_t>(std::size(s_validationLayerNames)); instanceInfo.enabledLayerCount = static_cast<uint32_t>(std::size(s_validationLayerNames));
instanceInfo.ppEnabledLayerNames = s_validationLayerNames; instanceInfo.ppEnabledLayerNames = s_validationLayerNames;
instanceInfo.pNext = &debugMessengerCreateInfo; instanceInfo.pNext = &debugMessengerCreateInfo;