Merge pull request #410 from lioncash/generic

core/renderer_opengl: Replace usages of LOG_GENERIC with fmt-capable equivalents
This commit is contained in:
bunnei 2018-04-27 15:59:12 -04:00 committed by GitHub
commit 41dde2394b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 12 deletions

View file

@ -134,7 +134,7 @@ void Process::Run(VAddr entry_point, s32 main_thread_priority, u32 stack_size) {
HandleSpecialMapping(vm_manager, mapping); HandleSpecialMapping(vm_manager, mapping);
} }
vm_manager.LogLayout(Log::Level::Debug); vm_manager.LogLayout();
status = ProcessStatus::Running; status = ProcessStatus::Running;
Kernel::SetupMainThread(entry_point, main_thread_priority, this); Kernel::SetupMainThread(entry_point, main_thread_priority, this);

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <cinttypes>
#include <iterator> #include <iterator>
#include "common/assert.h" #include "common/assert.h"
#include "common/logging/log.h" #include "common/logging/log.h"
@ -225,11 +224,10 @@ void VMManager::RefreshMemoryBlockMappings(const std::vector<u8>* block) {
} }
} }
void VMManager::LogLayout(Log::Level log_level) const { void VMManager::LogLayout() const {
for (const auto& p : vma_map) { for (const auto& p : vma_map) {
const VirtualMemoryArea& vma = p.second; const VirtualMemoryArea& vma = p.second;
LOG_GENERIC(Log::Class::Kernel, log_level, NGLOG_DEBUG(Kernel, "{:016X} - {:016X} size: {:016X} {}{}{} {}", vma.base,
"%016" PRIx64 " - %016" PRIx64 " size: %16" PRIx64 " %c%c%c %s", vma.base,
vma.base + vma.size, vma.size, vma.base + vma.size, vma.size,
(u8)vma.permissions & (u8)VMAPermission::Read ? 'R' : '-', (u8)vma.permissions & (u8)VMAPermission::Read ? 'R' : '-',
(u8)vma.permissions & (u8)VMAPermission::Write ? 'W' : '-', (u8)vma.permissions & (u8)VMAPermission::Write ? 'W' : '-',

View file

@ -187,7 +187,7 @@ public:
void RefreshMemoryBlockMappings(const std::vector<u8>* block); void RefreshMemoryBlockMappings(const std::vector<u8>* block);
/// Dumps the address space layout to the log, for debugging /// Dumps the address space layout to the log, for debugging
void LogLayout(Log::Level log_level) const; void LogLayout() const;
/// Gets the total memory usage, used by svcGetInfo /// Gets the total memory usage, used by svcGetInfo
u64 GetTotalMemoryUsage(); u64 GetTotalMemoryUsage();

View file

@ -398,21 +398,22 @@ static const char* GetType(GLenum type) {
static void APIENTRY DebugHandler(GLenum source, GLenum type, GLuint id, GLenum severity, static void APIENTRY DebugHandler(GLenum source, GLenum type, GLuint id, GLenum severity,
GLsizei length, const GLchar* message, const void* user_param) { GLsizei length, const GLchar* message, const void* user_param) {
Log::Level level; const char format[] = "{} {} {}: {}";
const char* const str_source = GetSource(source);
const char* const str_type = GetType(type);
switch (severity) { switch (severity) {
case GL_DEBUG_SEVERITY_HIGH: case GL_DEBUG_SEVERITY_HIGH:
level = Log::Level::Error; NGLOG_ERROR(Render_OpenGL, format, str_source, str_type, id, message);
break; break;
case GL_DEBUG_SEVERITY_MEDIUM: case GL_DEBUG_SEVERITY_MEDIUM:
level = Log::Level::Warning; NGLOG_WARNING(Render_OpenGL, format, str_source, str_type, id, message);
break; break;
case GL_DEBUG_SEVERITY_NOTIFICATION: case GL_DEBUG_SEVERITY_NOTIFICATION:
case GL_DEBUG_SEVERITY_LOW: case GL_DEBUG_SEVERITY_LOW:
level = Log::Level::Debug; NGLOG_DEBUG(Render_OpenGL, format, str_source, str_type, id, message);
break; break;
} }
LOG_GENERIC(Log::Class::Render_OpenGL, level, "%s %s %d: %s", GetSource(source), GetType(type),
id, message);
} }
/// Initialize the renderer /// Initialize the renderer