From 574939b6831517857d46dffc7fad4ca259e88183 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Mon, 24 Oct 2022 22:36:43 -0700 Subject: [PATCH] VideoCommon: Treat invalid normal count as NormalTangentBinormal See https://bugs.dolphin-emu.org/issues/13070. --- Source/Core/VideoCommon/VertexLoaderManager.cpp | 4 +--- Source/Core/VideoCommon/XFMemory.h | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Source/Core/VideoCommon/VertexLoaderManager.cpp b/Source/Core/VideoCommon/VertexLoaderManager.cpp index 08dbe8a4d5..55f3514486 100644 --- a/Source/Core/VideoCommon/VertexLoaderManager.cpp +++ b/Source/Core/VideoCommon/VertexLoaderManager.cpp @@ -270,11 +270,9 @@ static void CheckCPConfiguration(int vtx_attr_group) num_xf_normals = 1; break; case NormalCount::NormalTangentBinormal: + case NormalCount::Invalid: // see https://bugs.dolphin-emu.org/issues/13070 num_xf_normals = 3; break; - default: - PanicAlertFmt("xfmem.invtxspec.numnormals is invalid: {}", xfmem.invtxspec.numnormals); - break; } if (num_cp_colors != xfmem.invtxspec.numcolors || num_cp_normals != num_xf_normals || diff --git a/Source/Core/VideoCommon/XFMemory.h b/Source/Core/VideoCommon/XFMemory.h index aa8a28a608..71d38cb8bd 100644 --- a/Source/Core/VideoCommon/XFMemory.h +++ b/Source/Core/VideoCommon/XFMemory.h @@ -45,12 +45,21 @@ enum class NormalCount : u32 { None = 0, Normal = 1, - NormalTangentBinormal = 2 + NormalTangentBinormal = 2, + // Hardware testing indicates that this beahves the same as NormalTangentBinormal. + // Call of Duty: Black Ops uses this in some cases; see https://bugs.dolphin-emu.org/issues/13070 + Invalid = 3, }; template <> -struct fmt::formatter : EnumFormatter +struct fmt::formatter : EnumFormatter { - constexpr formatter() : EnumFormatter({"None", "Normal only", "Normal, tangent, and binormal"}) {} + static constexpr array_type names = { + "None", + "Normal only", + "Normal, tangent, and binormal", + "Invalid (Normal, tangent, and binormal)", + }; + constexpr formatter() : EnumFormatter(names) {} }; // Texture generation type