video-core: Migrate logging macros (#3878)

* video-core: Migrate logging macros

* video-core: Fixed missed clang format

* video-core: Migrated LOG_GENERIC macro
This commit is contained in:
NarcolepticK 2018-06-28 17:13:30 -04:00 committed by Weiyi Wang
parent 3cf5c1a5b4
commit 9ae70e733f
22 changed files with 156 additions and 149 deletions

View file

@ -1600,8 +1600,8 @@ void RasterizerOpenGL::SyncCullMode() {
break;
default:
LOG_CRITICAL(Render_OpenGL, "Unknown cull mode %u",
static_cast<u32>(regs.rasterizer.cull_mode.Value()));
NGLOG_CRITICAL(Render_OpenGL, "Unknown cull mode {}",
static_cast<u32>(regs.rasterizer.cull_mode.Value()));
UNIMPLEMENTED();
break;
}

View file

@ -1390,8 +1390,8 @@ SurfaceSurfaceRect_Tuple RasterizerCacheOpenGL::GetFramebufferSurfaces(
// Make sure that framebuffers don't overlap if both color and depth are being used
if (using_color_fb && using_depth_fb &&
boost::icl::length(color_vp_interval & depth_vp_interval)) {
LOG_CRITICAL(Render_OpenGL, "Color and depth framebuffer memory regions overlap; "
"overlapping framebuffers not supported!");
NGLOG_CRITICAL(Render_OpenGL, "Color and depth framebuffer memory regions overlap; "
"overlapping framebuffers not supported!");
using_depth_fb = false;
}

View file

@ -546,9 +546,9 @@ private:
const CompareOp op_y = instr.common.compare_op.y.Value();
if (cmp_ops.find(op_x) == cmp_ops.end()) {
LOG_ERROR(HW_GPU, "Unknown compare mode %x", static_cast<int>(op_x));
NGLOG_ERROR(HW_GPU, "Unknown compare mode {:x}", static_cast<int>(op_x));
} else if (cmp_ops.find(op_y) == cmp_ops.end()) {
LOG_ERROR(HW_GPU, "Unknown compare mode %x", static_cast<int>(op_y));
NGLOG_ERROR(HW_GPU, "Unknown compare mode {:x}", static_cast<int>(op_y));
} else if (op_x != op_y) {
shader.AddLine("conditional_code.x = " + src1 + ".x " +
cmp_ops.find(op_x)->second.first + " " + src2 + ".x;");
@ -572,9 +572,9 @@ private:
}
default: {
LOG_ERROR(HW_GPU, "Unhandled arithmetic instruction: 0x%02x (%s): 0x%08x",
(int)instr.opcode.Value().EffectiveOpCode(),
instr.opcode.Value().GetInfo().name, instr.hex);
NGLOG_ERROR(HW_GPU, "Unhandled arithmetic instruction: 0x{:02x} ({}): 0x{:08x}",
(int)instr.opcode.Value().EffectiveOpCode(),
instr.opcode.Value().GetInfo().name, instr.hex);
throw DecompileFail("Unhandled instruction");
break;
}
@ -616,9 +616,9 @@ private:
SetDest(swizzle, dest_reg, src1 + " * " + src2 + " + " + src3, 4, 4);
}
} else {
LOG_ERROR(HW_GPU, "Unhandled multiply-add instruction: 0x%02x (%s): 0x%08x",
(int)instr.opcode.Value().EffectiveOpCode(),
instr.opcode.Value().GetInfo().name, instr.hex);
NGLOG_ERROR(HW_GPU, "Unhandled multiply-add instruction: 0x{:02x} ({}): 0x{:08x}",
(int)instr.opcode.Value().EffectiveOpCode(),
instr.opcode.Value().GetInfo().name, instr.hex);
throw DecompileFail("Unhandled instruction");
}
break;
@ -770,9 +770,9 @@ private:
}
default: {
LOG_ERROR(HW_GPU, "Unhandled instruction: 0x%02x (%s): 0x%08x",
(int)instr.opcode.Value().EffectiveOpCode(),
instr.opcode.Value().GetInfo().name, instr.hex);
NGLOG_ERROR(HW_GPU, "Unhandled instruction: 0x{:02x} ({}): 0x{:08x}",
(int)instr.opcode.Value().EffectiveOpCode(),
instr.opcode.Value().GetInfo().name, instr.hex);
throw DecompileFail("Unhandled instruction");
break;
}
@ -921,7 +921,7 @@ boost::optional<std::string> DecompileProgram(const ProgramCode& program_code,
inputreg_getter, outputreg_getter, sanitize_mul, is_gs);
return generator.MoveShaderCode();
} catch (const DecompileFail& exception) {
LOG_INFO(HW_GPU, "Shader decompilation failed: %s", exception.what());
NGLOG_INFO(HW_GPU, "Shader decompilation failed: {}", exception.what());
return boost::none;
}
}

View file

@ -320,8 +320,8 @@ static std::string SampleTexture(const PicaFSConfig& config, unsigned texture_un
case TexturingRegs::TextureConfig::ShadowCube:
return "shadowTextureCube(texcoord0, texcoord0_w)";
default:
LOG_CRITICAL(HW_GPU, "Unhandled texture type %x",
static_cast<int>(state.texture0_type));
NGLOG_CRITICAL(HW_GPU, "Unhandled texture type {:x}",
static_cast<int>(state.texture0_type));
UNIMPLEMENTED();
return "texture(tex0, texcoord0)";
}
@ -383,7 +383,7 @@ static void AppendSource(std::string& out, const PicaFSConfig& config,
break;
default:
out += "vec4(0.0)";
LOG_CRITICAL(Render_OpenGL, "Unknown source op %u", static_cast<u32>(source));
NGLOG_CRITICAL(Render_OpenGL, "Unknown source op {}", static_cast<u32>(source));
break;
}
}
@ -441,7 +441,7 @@ static void AppendColorModifier(std::string& out, const PicaFSConfig& config,
break;
default:
out += "vec3(0.0)";
LOG_CRITICAL(Render_OpenGL, "Unknown color modifier op %u", static_cast<u32>(modifier));
NGLOG_CRITICAL(Render_OpenGL, "Unknown color modifier op {}", static_cast<u32>(modifier));
break;
}
}
@ -490,7 +490,7 @@ static void AppendAlphaModifier(std::string& out, const PicaFSConfig& config,
break;
default:
out += "0.0";
LOG_CRITICAL(Render_OpenGL, "Unknown alpha modifier op %u", static_cast<u32>(modifier));
NGLOG_CRITICAL(Render_OpenGL, "Unknown alpha modifier op {}", static_cast<u32>(modifier));
break;
}
}
@ -534,8 +534,8 @@ static void AppendColorCombiner(std::string& out, TevStageConfig::Operation oper
break;
default:
out += "vec3(0.0)";
LOG_CRITICAL(Render_OpenGL, "Unknown color combiner operation: %u",
static_cast<u32>(operation));
NGLOG_CRITICAL(Render_OpenGL, "Unknown color combiner operation: {}",
static_cast<u32>(operation));
break;
}
out += ", vec3(0.0), vec3(1.0))"; // Clamp result to 0.0, 1.0
@ -575,8 +575,8 @@ static void AppendAlphaCombiner(std::string& out, TevStageConfig::Operation oper
break;
default:
out += "0.0";
LOG_CRITICAL(Render_OpenGL, "Unknown alpha combiner operation: %u",
static_cast<u32>(operation));
NGLOG_CRITICAL(Render_OpenGL, "Unknown alpha combiner operation: {}",
static_cast<u32>(operation));
break;
}
out += ", 0.0, 1.0)";
@ -606,7 +606,7 @@ static void AppendAlphaTestCondition(std::string& out, FramebufferRegs::CompareF
default:
out += "false";
LOG_CRITICAL(Render_OpenGL, "Unknown alpha test condition %u", static_cast<u32>(func));
NGLOG_CRITICAL(Render_OpenGL, "Unknown alpha test condition {}", static_cast<u32>(func));
break;
}
}
@ -776,7 +776,7 @@ static void WriteLighting(std::string& out, const PicaFSConfig& config) {
break;
default:
LOG_CRITICAL(HW_GPU, "Unknown lighting LUT input %d\n", (int)input);
NGLOG_CRITICAL(HW_GPU, "Unknown lighting LUT input {}\n", (int)input);
UNIMPLEMENTED();
index = "0.0";
break;
@ -992,7 +992,7 @@ void AppendProcTexShiftOffset(std::string& out, const std::string& v, ProcTexShi
out += offset + " * (((int(" + v + ") + 1) / 2) % 2)";
break;
default:
LOG_CRITICAL(HW_GPU, "Unknown shift mode %u", static_cast<u32>(mode));
NGLOG_CRITICAL(HW_GPU, "Unknown shift mode {}", static_cast<u32>(mode));
out += "0";
break;
}
@ -1018,7 +1018,7 @@ void AppendProcTexClamp(std::string& out, const std::string& var, ProcTexClamp m
out += var + " = " + var + " > 0.5 ? 1.0 : 0.0;\n";
break;
default:
LOG_CRITICAL(HW_GPU, "Unknown clamp mode %u", static_cast<u32>(mode));
NGLOG_CRITICAL(HW_GPU, "Unknown clamp mode {}", static_cast<u32>(mode));
out += var + " = " + "min(" + var + ", 1.0);\n";
break;
}
@ -1059,7 +1059,7 @@ void AppendProcTexCombineAndMap(std::string& out, ProcTexCombiner combiner,
combined = "min(((u + v) * 0.5 + sqrt(u * u + v * v)) * 0.5, 1.0)";
break;
default:
LOG_CRITICAL(HW_GPU, "Unknown combiner %u", static_cast<u32>(combiner));
NGLOG_CRITICAL(HW_GPU, "Unknown combiner {}", static_cast<u32>(combiner));
combined = "0.0";
break;
}
@ -1499,7 +1499,7 @@ vec4 secondary_fragment_color = vec4(0.0);
} else if (state.fog_mode == TexturingRegs::FogMode::Gas) {
Core::Telemetry().AddField(Telemetry::FieldType::Session, "VideoCore_Pica_UseGasMode",
true);
LOG_CRITICAL(Render_OpenGL, "Unimplemented gas mode");
NGLOG_CRITICAL(Render_OpenGL, "Unimplemented gas mode");
out += "discard; }";
return out;
}

View file

@ -171,9 +171,9 @@ void RendererOpenGL::LoadFBToScreenInfo(const GPU::Regs::FramebufferConfig& fram
? (!right_eye ? framebuffer.address_left1 : framebuffer.address_right1)
: (!right_eye ? framebuffer.address_left2 : framebuffer.address_right2);
LOG_TRACE(Render_OpenGL, "0x%08x bytes from 0x%08x(%dx%d), fmt %x",
framebuffer.stride * framebuffer.height, framebuffer_addr, (int)framebuffer.width,
(int)framebuffer.height, (int)framebuffer.format);
NGLOG_TRACE(Render_OpenGL, "0x{:08x} bytes from 0x{:08x}({}x{}), fmt {:x}",
framebuffer.stride * framebuffer.height, framebuffer_addr, (int)framebuffer.width,
(int)framebuffer.height, (int)framebuffer.format);
int bpp = GPU::Regs::BytesPerPixel(framebuffer.color_format);
size_t pixel_stride = framebuffer.stride / bpp;
@ -494,8 +494,8 @@ static void APIENTRY DebugHandler(GLenum source, GLenum type, GLuint id, GLenum
level = Log::Level::Debug;
break;
}
LOG_GENERIC(Log::Class::Render_OpenGL, level, "%s %s %d: %s", GetSource(source), GetType(type),
id, message);
NGLOG_GENERIC(Log::Class::Render_OpenGL, level, "{} {} {}: {}", GetSource(source),
GetType(type), id, message);
}
/// Initialize the renderer
@ -511,9 +511,9 @@ bool RendererOpenGL::Init() {
const char* gpu_vendor{reinterpret_cast<char const*>(glGetString(GL_VENDOR))};
const char* gpu_model{reinterpret_cast<char const*>(glGetString(GL_RENDERER))};
LOG_INFO(Render_OpenGL, "GL_VERSION: %s", gl_version);
LOG_INFO(Render_OpenGL, "GL_VENDOR: %s", gpu_vendor);
LOG_INFO(Render_OpenGL, "GL_RENDERER: %s", gpu_model);
NGLOG_INFO(Render_OpenGL, "GL_VERSION: {}", gl_version);
NGLOG_INFO(Render_OpenGL, "GL_VENDOR: {}", gpu_vendor);
NGLOG_INFO(Render_OpenGL, "GL_RENDERER: {}", gpu_model);
Core::Telemetry().AddField(Telemetry::FieldType::UserSystem, "GPU_Vendor", gpu_vendor);
Core::Telemetry().AddField(Telemetry::FieldType::UserSystem, "GPU_Model", gpu_model);