Merge pull request #5657 from FearlessTobi/port-5158

Port yuzu-emu/yuzu#5158: "video_core: Remove unnecessary enum class casting in logging messages"
This commit is contained in:
Marshall Mohror 2021-02-04 10:51:29 -06:00 committed by GitHub
commit 6b2e7b77cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 32 additions and 42 deletions

View File

@ -200,7 +200,7 @@ struct FramebufferRegs {
case ColorFormat::RGBA4: case ColorFormat::RGBA4:
return 2; return 2;
default: default:
LOG_CRITICAL(HW_GPU, "Unknown color format {}", static_cast<u32>(format)); LOG_CRITICAL(HW_GPU, "Unknown color format {}", format);
UNIMPLEMENTED(); UNIMPLEMENTED();
} }
} }
@ -265,7 +265,7 @@ struct FramebufferRegs {
return 4; return 4;
} }
ASSERT_MSG(false, "Unknown depth format {}", static_cast<u32>(format)); ASSERT_MSG(false, "Unknown depth format {}", format);
} }
// Returns the number of bits per depth component of the specified depth format // Returns the number of bits per depth component of the specified depth format
@ -278,7 +278,7 @@ struct FramebufferRegs {
return 24; return 24;
} }
ASSERT_MSG(false, "Unknown depth format {}", static_cast<u32>(format)); ASSERT_MSG(false, "Unknown depth format {}", format);
} }
INSERT_PADDING_WORDS(0x10); // Gas related registers INSERT_PADDING_WORDS(0x10); // Gas related registers

View File

@ -127,7 +127,7 @@ struct LightingRegs {
"sampler should be one of Distribution0, Distribution1, " "sampler should be one of Distribution0, Distribution1, "
"SpotlightAttenuation, Fresnel, ReflectRed, ReflectGreen or " "SpotlightAttenuation, Fresnel, ReflectRed, ReflectGreen or "
"ReflectBlue, instead got %i", "ReflectBlue, instead got %i",
static_cast<int>(config)); config);
} }
} }

View File

@ -747,8 +747,7 @@ void CachedSurface::DumpTexture(GLuint target_tex, u64 tex_hash) {
return; return;
} }
dump_path += fmt::format("tex1_{}x{}_{:016X}_{}.png", width, height, tex_hash, dump_path += fmt::format("tex1_{}x{}_{:016X}_{}.png", width, height, tex_hash, pixel_format);
static_cast<u32>(pixel_format));
if (!custom_tex_cache.IsTextureDumped(tex_hash) && !FileUtil::Exists(dump_path)) { if (!custom_tex_cache.IsTextureDumped(tex_hash) && !FileUtil::Exists(dump_path)) {
custom_tex_cache.SetTextureDumped(tex_hash); custom_tex_cache.SetTextureDumped(tex_hash);

View File

@ -561,9 +561,9 @@ private:
const CompareOp op_y = instr.common.compare_op.y.Value(); const CompareOp op_y = instr.common.compare_op.y.Value();
if (cmp_ops.find(op_x) == cmp_ops.end()) { if (cmp_ops.find(op_x) == cmp_ops.end()) {
LOG_ERROR(HW_GPU, "Unknown compare mode {:x}", static_cast<int>(op_x)); LOG_ERROR(HW_GPU, "Unknown compare mode {:x}", op_x);
} else if (cmp_ops.find(op_y) == cmp_ops.end()) { } else if (cmp_ops.find(op_y) == cmp_ops.end()) {
LOG_ERROR(HW_GPU, "Unknown compare mode {:x}", static_cast<int>(op_y)); LOG_ERROR(HW_GPU, "Unknown compare mode {:x}", op_y);
} else if (op_x != op_y) { } else if (op_x != op_y) {
shader.AddLine("conditional_code.x = {}.x {} {}.x;", src1, shader.AddLine("conditional_code.x = {}.x {} {}.x;", src1,
cmp_ops.find(op_x)->second.first, src2); cmp_ops.find(op_x)->second.first, src2);

View File

@ -161,7 +161,7 @@ std::optional<std::vector<ShaderDiskCacheRaw>> ShaderDiskCache::LoadTransferable
} }
default: default:
LOG_ERROR(Render_OpenGL, "Unknown transferable shader cache entry kind={} - skipping", LOG_ERROR(Render_OpenGL, "Unknown transferable shader cache entry kind={} - skipping",
static_cast<u32>(kind)); kind);
return std::nullopt; return std::nullopt;
} }
} }

View File

@ -278,8 +278,7 @@ void PicaGSConfigCommonRaw::Init(const Pica::Regs& regs) {
if (static_cast<std::size_t>(semantic) < 24) { if (static_cast<std::size_t>(semantic) < 24) {
semantic_maps[static_cast<std::size_t>(semantic)] = {attrib, comp}; semantic_maps[static_cast<std::size_t>(semantic)] = {attrib, comp};
} else if (semantic != VSOutputAttributes::INVALID) { } else if (semantic != VSOutputAttributes::INVALID) {
LOG_ERROR(Render_OpenGL, "Invalid/unknown semantic id: {}", LOG_ERROR(Render_OpenGL, "Invalid/unknown semantic id: {}", semantic);
static_cast<u32>(semantic));
} }
} }
} }
@ -316,8 +315,7 @@ static std::string SampleTexture(const PicaFSConfig& config, unsigned texture_un
case TexturingRegs::TextureConfig::Disabled: case TexturingRegs::TextureConfig::Disabled:
return "vec4(0.0)"; return "vec4(0.0)";
default: default:
LOG_CRITICAL(HW_GPU, "Unhandled texture type {:x}", LOG_CRITICAL(HW_GPU, "Unhandled texture type {:x}", state.texture0_type);
static_cast<int>(state.texture0_type));
UNIMPLEMENTED(); UNIMPLEMENTED();
return "texture(tex0, texcoord0)"; return "texture(tex0, texcoord0)";
} }
@ -380,7 +378,7 @@ static void AppendSource(std::string& out, const PicaFSConfig& config,
break; break;
default: default:
out += "vec4(0.0)"; out += "vec4(0.0)";
LOG_CRITICAL(Render_OpenGL, "Unknown source op {}", static_cast<u32>(source)); LOG_CRITICAL(Render_OpenGL, "Unknown source op {}", source);
break; break;
} }
} }
@ -438,7 +436,7 @@ static void AppendColorModifier(std::string& out, const PicaFSConfig& config,
break; break;
default: default:
out += "vec3(0.0)"; out += "vec3(0.0)";
LOG_CRITICAL(Render_OpenGL, "Unknown color modifier op {}", static_cast<u32>(modifier)); LOG_CRITICAL(Render_OpenGL, "Unknown color modifier op {}", modifier);
break; break;
} }
} }
@ -487,7 +485,7 @@ static void AppendAlphaModifier(std::string& out, const PicaFSConfig& config,
break; break;
default: default:
out += "0.0"; out += "0.0";
LOG_CRITICAL(Render_OpenGL, "Unknown alpha modifier op {}", static_cast<u32>(modifier)); LOG_CRITICAL(Render_OpenGL, "Unknown alpha modifier op {}", modifier);
break; break;
} }
} }
@ -529,8 +527,7 @@ static void AppendColorCombiner(std::string& out, TevStageConfig::Operation oper
break; break;
default: default:
out += "vec3(0.0)"; out += "vec3(0.0)";
LOG_CRITICAL(Render_OpenGL, "Unknown color combiner operation: {}", LOG_CRITICAL(Render_OpenGL, "Unknown color combiner operation: {}", operation);
static_cast<u32>(operation));
break; break;
} }
out += ", vec3(0.0), vec3(1.0))"; // Clamp result to 0.0, 1.0 out += ", vec3(0.0), vec3(1.0))"; // Clamp result to 0.0, 1.0
@ -568,8 +565,7 @@ static void AppendAlphaCombiner(std::string& out, TevStageConfig::Operation oper
break; break;
default: default:
out += "0.0"; out += "0.0";
LOG_CRITICAL(Render_OpenGL, "Unknown alpha combiner operation: {}", LOG_CRITICAL(Render_OpenGL, "Unknown alpha combiner operation: {}", operation);
static_cast<u32>(operation));
break; break;
} }
out += ", 0.0, 1.0)"; out += ", 0.0, 1.0)";
@ -599,7 +595,7 @@ static void AppendAlphaTestCondition(std::string& out, FramebufferRegs::CompareF
default: default:
out += "false"; out += "false";
LOG_CRITICAL(Render_OpenGL, "Unknown alpha test condition {}", static_cast<u32>(func)); LOG_CRITICAL(Render_OpenGL, "Unknown alpha test condition {}", func);
break; break;
} }
} }
@ -831,8 +827,7 @@ static void WriteLighting(std::string& out, const PicaFSConfig& config) {
"{}.position) + {}.dist_atten_bias, 0.0, 1.0)", "{}.position) + {}.dist_atten_bias, 0.0, 1.0)",
light_src, light_src, light_src); light_src, light_src, light_src);
const auto sampler = LightingRegs::DistanceAttenuationSampler(light_config.num); const auto sampler = LightingRegs::DistanceAttenuationSampler(light_config.num);
dist_atten = dist_atten = fmt::format("LookupLightingLUTUnsigned({}, {})", sampler, index);
fmt::format("LookupLightingLUTUnsigned({}, {})", static_cast<u32>(sampler), index);
} }
if (light_config.geometric_factor_0 || light_config.geometric_factor_1) { if (light_config.geometric_factor_0 || light_config.geometric_factor_1) {
@ -985,7 +980,7 @@ static void AppendProcTexShiftOffset(std::string& out, std::string_view v, ProcT
out += fmt::format("{} * float(((int({}) + 1) / 2) % 2)", offset, v); out += fmt::format("{} * float(((int({}) + 1) / 2) % 2)", offset, v);
break; break;
default: default:
LOG_CRITICAL(HW_GPU, "Unknown shift mode {}", static_cast<u32>(mode)); LOG_CRITICAL(HW_GPU, "Unknown shift mode {}", mode);
out += "0.0"; out += "0.0";
break; break;
} }
@ -1010,7 +1005,7 @@ static void AppendProcTexClamp(std::string& out, std::string_view var, ProcTexCl
out += fmt::format("{0} = {0} > 0.5 ? 1.0 : 0.0;\n", var); out += fmt::format("{0} = {0} > 0.5 ? 1.0 : 0.0;\n", var);
break; break;
default: default:
LOG_CRITICAL(HW_GPU, "Unknown clamp mode {}", static_cast<u32>(mode)); LOG_CRITICAL(HW_GPU, "Unknown clamp mode {}", mode);
out += fmt::format("{0} = min({0}, 1.0);\n", var); out += fmt::format("{0} = min({0}, 1.0);\n", var);
break; break;
} }
@ -1041,7 +1036,7 @@ static void AppendProcTexCombineAndMap(std::string& out, ProcTexCombiner combine
case TexturingRegs::ProcTexCombiner::RMax: case TexturingRegs::ProcTexCombiner::RMax:
return "min(((u + v) * 0.5 + sqrt(u * u + v * v)) * 0.5, 1.0)"; return "min(((u + v) * 0.5 + sqrt(u * u + v * v)) * 0.5, 1.0)";
default: default:
LOG_CRITICAL(HW_GPU, "Unknown combiner {}", static_cast<u32>(combiner)); LOG_CRITICAL(HW_GPU, "Unknown combiner {}", combiner);
return "0.0"; return "0.0";
} }
}(); }();
@ -1592,10 +1587,8 @@ ShaderDecompiler::ProgramResult GenerateTrivialVertexShader(bool separable_shade
"layout(location = {}) in float vert_texcoord0_w;\n" "layout(location = {}) in float vert_texcoord0_w;\n"
"layout(location = {}) in vec4 vert_normquat;\n" "layout(location = {}) in vec4 vert_normquat;\n"
"layout(location = {}) in vec3 vert_view;\n", "layout(location = {}) in vec3 vert_view;\n",
static_cast<int>(ATTRIBUTE_POSITION), static_cast<int>(ATTRIBUTE_COLOR), ATTRIBUTE_POSITION, ATTRIBUTE_COLOR, ATTRIBUTE_TEXCOORD0, ATTRIBUTE_TEXCOORD1,
static_cast<int>(ATTRIBUTE_TEXCOORD0), static_cast<int>(ATTRIBUTE_TEXCOORD1), ATTRIBUTE_TEXCOORD2, ATTRIBUTE_TEXCOORD0_W, ATTRIBUTE_NORMQUAT, ATTRIBUTE_VIEW);
static_cast<int>(ATTRIBUTE_TEXCOORD2), static_cast<int>(ATTRIBUTE_TEXCOORD0_W),
static_cast<int>(ATTRIBUTE_NORMQUAT), static_cast<int>(ATTRIBUTE_VIEW));
out += GetVertexInterfaceDeclaration(true, separable_shader); out += GetVertexInterfaceDeclaration(true, separable_shader);

View File

@ -524,7 +524,7 @@ void ShaderProgramManager::LoadDiskCache(const std::atomic_bool& stop_loading,
// Unsupported shader type got stored somehow so nuke the cache // Unsupported shader type got stored somehow so nuke the cache
LOG_CRITICAL(Frontend, "failed to load raw programtype {}", LOG_CRITICAL(Frontend, "failed to load raw programtype {}",
static_cast<u32>(raw.GetProgramType())); raw.GetProgramType());
compilation_failed = true; compilation_failed = true;
return; return;
} }
@ -585,8 +585,7 @@ void ShaderProgramManager::LoadDiskCache(const std::atomic_bool& stop_loading,
result = std::move(r); result = std::move(r);
} else { } else {
// Unsupported shader type got stored somehow so nuke the cache // Unsupported shader type got stored somehow so nuke the cache
LOG_ERROR(Frontend, "failed to load raw programtype {}", LOG_ERROR(Frontend, "failed to load raw programtype {}", raw.GetProgramType());
static_cast<u32>(raw.GetProgramType()));
compilation_failed = true; compilation_failed = true;
return; return;
} }

View File

@ -38,7 +38,7 @@ inline GLenum TextureMagFilterMode(TextureFilter mode) {
if (mode == TextureFilter::Nearest) { if (mode == TextureFilter::Nearest) {
return GL_NEAREST; return GL_NEAREST;
} }
LOG_CRITICAL(Render_OpenGL, "Unknown texture filtering mode {}", static_cast<u32>(mode)); LOG_CRITICAL(Render_OpenGL, "Unknown texture filtering mode {}", mode);
UNIMPLEMENTED(); UNIMPLEMENTED();
return GL_LINEAR; return GL_LINEAR;
} }
@ -59,8 +59,7 @@ inline GLenum TextureMinFilterMode(TextureFilter min, TextureFilter mip) {
return GL_NEAREST_MIPMAP_NEAREST; return GL_NEAREST_MIPMAP_NEAREST;
} }
} }
LOG_CRITICAL(Render_OpenGL, "Unknown texture filtering mode {} and {}", static_cast<u32>(min), LOG_CRITICAL(Render_OpenGL, "Unknown texture filtering mode {} and {}", min, mip);
static_cast<u32>(mip));
UNIMPLEMENTED(); UNIMPLEMENTED();
return GL_LINEAR_MIPMAP_LINEAR; return GL_LINEAR_MIPMAP_LINEAR;
} }

View File

@ -297,7 +297,7 @@ Common::Vec4<u8> EvaluateBlendEquation(const Common::Vec4<u8>& src,
break; break;
default: default:
LOG_CRITICAL(HW_GPU, "Unknown RGB blend equation 0x{:x}", static_cast<u8>(equation)); LOG_CRITICAL(HW_GPU, "Unknown RGB blend equation 0x{:x}", equation);
UNIMPLEMENTED(); UNIMPLEMENTED();
} }

View File

@ -143,7 +143,7 @@ std::tuple<Common::Vec4<u8>, Common::Vec4<u8>> ComputeFragmentsColors(
} }
break; break;
default: default:
LOG_CRITICAL(HW_GPU, "Unknown lighting LUT input {}", static_cast<u32>(input)); LOG_CRITICAL(HW_GPU, "Unknown lighting LUT input {}", input);
UNIMPLEMENTED(); UNIMPLEMENTED();
result = 0.0f; result = 0.0f;
} }

View File

@ -76,7 +76,7 @@ static float GetShiftOffset(float v, ProcTexShift mode, ProcTexClamp clamp_mode)
case ProcTexShift::Even: case ProcTexShift::Even:
return offset * ((((int)v + 1) / 2) % 2); return offset * ((((int)v + 1) / 2) % 2);
default: default:
LOG_CRITICAL(HW_GPU, "Unknown shift mode {}", static_cast<u32>(mode)); LOG_CRITICAL(HW_GPU, "Unknown shift mode {}", mode);
return 0; return 0;
} }
}; };
@ -106,7 +106,7 @@ static void ClampCoord(float& coord, ProcTexClamp mode) {
coord = 1.0f; coord = 1.0f;
break; break;
default: default:
LOG_CRITICAL(HW_GPU, "Unknown clamp mode {}", static_cast<u32>(mode)); LOG_CRITICAL(HW_GPU, "Unknown clamp mode {}", mode);
coord = std::min(coord, 1.0f); coord = std::min(coord, 1.0f);
break; break;
} }
@ -147,7 +147,7 @@ static float CombineAndMap(float u, float v, ProcTexCombiner combiner,
f = std::min(((u + v) * 0.5f + std::sqrt(u * u + v * v)) * 0.5f, 1.0f); f = std::min(((u + v) * 0.5f + std::sqrt(u * u + v * v)) * 0.5f, 1.0f);
break; break;
default: default:
LOG_CRITICAL(HW_GPU, "Unknown combiner {}", static_cast<u32>(combiner)); LOG_CRITICAL(HW_GPU, "Unknown combiner {}", combiner);
f = 0.0f; f = 0.0f;
break; break;
} }

View File

@ -847,7 +847,7 @@ static void ProcessTriangleInternal(const Vertex& v0, const Vertex& v1, const Ve
return std::min(combiner_output.a(), static_cast<u8>(255 - dest.a())); return std::min(combiner_output.a(), static_cast<u8>(255 - dest.a()));
default: default:
LOG_CRITICAL(HW_GPU, "Unknown blend factor {:x}", static_cast<u32>(factor)); LOG_CRITICAL(HW_GPU, "Unknown blend factor {:x}", factor);
UNIMPLEMENTED(); UNIMPLEMENTED();
break; break;
} }