From 410ba37ec2dd54a5c887ab74d5d7b9727519a191 Mon Sep 17 00:00:00 2001 From: IndecisiveTurtle <47210458+raphaelthegreat@users.noreply.github.com> Date: Mon, 1 Jul 2024 13:35:35 +0300 Subject: [PATCH] code: Add additional logging during init --- src/core/libraries/gnmdriver/gnmdriver.cpp | 1 + src/core/libraries/libs.cpp | 1 + src/core/memory.cpp | 3 +++ src/emulator.cpp | 6 ++---- src/emulator.h | 2 ++ src/video_core/renderer_vulkan/vk_instance.cpp | 11 +++++------ src/video_core/renderer_vulkan/vk_platform.cpp | 12 ++++++------ 7 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/core/libraries/gnmdriver/gnmdriver.cpp b/src/core/libraries/gnmdriver/gnmdriver.cpp index 40b1f897..cf162db1 100644 --- a/src/core/libraries/gnmdriver/gnmdriver.cpp +++ b/src/core/libraries/gnmdriver/gnmdriver.cpp @@ -2462,6 +2462,7 @@ int PS4_SYSV_ABI Func_F916890425496553() { } void RegisterlibSceGnmDriver(Core::Loader::SymbolsResolver* sym) { + LOG_INFO(Lib_GnmDriver, "Initializing renderer"); liverpool = std::make_unique(); renderer = std::make_unique(*g_window, liverpool.get()); diff --git a/src/core/libraries/libs.cpp b/src/core/libraries/libs.cpp index 1279016f..00df4ddf 100644 --- a/src/core/libraries/libs.cpp +++ b/src/core/libraries/libs.cpp @@ -38,6 +38,7 @@ namespace Libraries { void InitHLELibs(Core::Loader::SymbolsResolver* sym) { + LOG_INFO(Lib_Kernel, "Initializing HLE libraries"); Libraries::Kernel::LibKernel_Register(sym); Libraries::VideoOut::RegisterLib(sym); Libraries::GnmDriver::RegisterlibSceGnmDriver(sym); diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 9ebd1fea..75faeae8 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -20,6 +20,9 @@ MemoryManager::MemoryManager() { const VAddr virtual_base = impl.VirtualBase(); const size_t virtual_size = impl.VirtualSize(); vma_map.emplace(virtual_base, VirtualMemoryArea{virtual_base, virtual_size}); + + // Log initialization. + LOG_INFO(Kernel_Vmm, "Usable memory address space {}_GB", virtual_size >> 30); } MemoryManager::~MemoryManager() = default; diff --git a/src/emulator.cpp b/src/emulator.cpp index fda7270d..798e7390 100644 --- a/src/emulator.cpp +++ b/src/emulator.cpp @@ -29,12 +29,10 @@ namespace Core { static constexpr s32 WindowWidth = 1280; static constexpr s32 WindowHeight = 720; -Emulator::Emulator() : window{WindowWidth, WindowHeight, controller} { +Emulator::Emulator() : memory{Core::Memory::Instance()}, + window{WindowWidth, WindowHeight, controller} { g_window = &window; - // Initialize memory system as early as possible to reserve mappings. - [[maybe_unused]] const auto* memory = Core::Memory::Instance(); - // Read configuration file. const auto config_dir = Common::FS::GetUserPath(Common::FS::PathType::UserDir); Config::load(config_dir / "config.toml"); diff --git a/src/emulator.h b/src/emulator.h index 3267b8fd..b61ce95e 100644 --- a/src/emulator.h +++ b/src/emulator.h @@ -29,6 +29,8 @@ public: private: void LoadSystemModules(const std::filesystem::path& file); + + Core::MemoryManager* memory; Input::GameController* controller = Common::Singleton::Instance(); Core::Linker* linker = Common::Singleton::Instance(); Frontend::WindowSDL window; diff --git a/src/video_core/renderer_vulkan/vk_instance.cpp b/src/video_core/renderer_vulkan/vk_instance.cpp index 99f289e4..1fc7790d 100644 --- a/src/video_core/renderer_vulkan/vk_instance.cpp +++ b/src/video_core/renderer_vulkan/vk_instance.cpp @@ -49,6 +49,7 @@ Instance::Instance(Frontend::WindowSDL& window, s32 physical_device_index, } const std::size_t num_physical_devices = static_cast(physical_devices.size()); ASSERT_MSG(num_physical_devices > 0, "No physical devices found"); + LOG_INFO(Render_Vulkan, "Found {} physical devices", num_physical_devices); if (physical_device_index < 0) { std::vector> properties2{}; @@ -73,12 +74,10 @@ Instance::Instance(Frontend::WindowSDL& window, s32 physical_device_index, available_extensions = GetSupportedExtensions(physical_device); properties = physical_device.getProperties(); - if (properties.apiVersion < TargetVulkanApiVersion) { - throw std::runtime_error(fmt::format( - "Vulkan {}.{} is required, but only {}.{} is supported by device!", - VK_VERSION_MAJOR(TargetVulkanApiVersion), VK_VERSION_MINOR(TargetVulkanApiVersion), - VK_VERSION_MAJOR(properties.apiVersion), VK_VERSION_MINOR(properties.apiVersion))); - } + ASSERT_MSG(properties.apiVersion >= TargetVulkanApiVersion, + "Vulkan {}.{} is required, but only {}.{} is supported by device!", + VK_VERSION_MAJOR(TargetVulkanApiVersion), VK_VERSION_MINOR(TargetVulkanApiVersion), + VK_VERSION_MAJOR(properties.apiVersion), VK_VERSION_MINOR(properties.apiVersion)); CollectDeviceParameters(); CreateDevice(); diff --git a/src/video_core/renderer_vulkan/vk_platform.cpp b/src/video_core/renderer_vulkan/vk_platform.cpp index 90b3f4a8..cbac8fc0 100644 --- a/src/video_core/renderer_vulkan/vk_platform.cpp +++ b/src/video_core/renderer_vulkan/vk_platform.cpp @@ -168,6 +168,8 @@ std::vector GetInstanceExtensions(Frontend::WindowSystemType window vk::UniqueInstance CreateInstance(vk::DynamicLoader& dl, Frontend::WindowSystemType window_type, bool enable_validation, bool dump_command_buffers) { + LOG_INFO(Render_Vulkan, "Creating vulkan instance"); + auto vkGetInstanceProcAddr = dl.getProcAddress("vkGetInstanceProcAddr"); VULKAN_HPP_DEFAULT_DISPATCHER.init(vkGetInstanceProcAddr); @@ -176,12 +178,10 @@ vk::UniqueInstance CreateInstance(vk::DynamicLoader& dl, Frontend::WindowSystemT ? vk::enumerateInstanceVersion() : VK_API_VERSION_1_0; - if (available_version < TargetVulkanApiVersion) { - throw std::runtime_error(fmt::format( - "Vulkan {}.{} is required, but only {}.{} is supported by instance!", - VK_VERSION_MAJOR(TargetVulkanApiVersion), VK_VERSION_MINOR(TargetVulkanApiVersion), - VK_VERSION_MAJOR(available_version), VK_VERSION_MINOR(available_version))); - } + ASSERT_MSG(available_version >= TargetVulkanApiVersion, + "Vulkan {}.{} is required, but only {}.{} is supported by instance!", + VK_VERSION_MAJOR(TargetVulkanApiVersion), VK_VERSION_MINOR(TargetVulkanApiVersion), + VK_VERSION_MAJOR(available_version), VK_VERSION_MINOR(available_version)); const auto extensions = GetInstanceExtensions(window_type, true);