diff options
| author | Pokechu22 <Pokechu022@gmail.com> | 2024-09-24 23:46:45 -0700 |
|---|---|---|
| committer | Pokechu22 <Pokechu022@gmail.com> | 2024-10-12 10:32:41 -0700 |
| commit | 937bb2aa2e12b635ba328af8de7c9a5d5963d084 (patch) | |
| tree | f7e24ca237cdda8cde7e611ee52806fdea96292a /Source/UnitTests/VideoCommon/VertexLoaderTest.cpp | |
| parent | 35ec2e97a8ea90730cb33eceec701f81597f98f7 (diff) | |
Cache normals in addition to binormals and tangents
Fixes LIT (https://bugs.dolphin-emu.org/issues/13635). The text does not include normals, but has lighting enabled. With the previous default of (0, 0, 0), lighting was always black (as dot(X, (0, 0, 0)) is always 0). It seems like the normal from the map in the background (0, 0, 1) is re-used.
LIT also has the vertex color enabled while vertex color is not specified, the same as SMS's debug cubes; the default MissingColorValue GameINI value of solid white seems to work correctly in this case.
Diffstat (limited to 'Source/UnitTests/VideoCommon/VertexLoaderTest.cpp')
| -rw-r--r-- | Source/UnitTests/VideoCommon/VertexLoaderTest.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Source/UnitTests/VideoCommon/VertexLoaderTest.cpp b/Source/UnitTests/VideoCommon/VertexLoaderTest.cpp index 83b1f813da..675be35355 100644 --- a/Source/UnitTests/VideoCommon/VertexLoaderTest.cpp +++ b/Source/UnitTests/VideoCommon/VertexLoaderTest.cpp @@ -702,6 +702,7 @@ TEST_P(VertexLoaderNormalTest, NormalAll) input_with_expected_type(i / 32.f); // Pre-fill these values to detect if they're modified + VertexLoaderManager::normal_cache = {-42.f, -43.f, -44.f, -45.f}; VertexLoaderManager::binormal_cache = {42.f, 43.f, 44.f, 45.f}; VertexLoaderManager::tangent_cache = {46.f, 47.f, 48.f, 49.f}; @@ -738,6 +739,9 @@ TEST_P(VertexLoaderNormalTest, NormalAll) ExpectOut(10 / 32.f); ExpectOut(11 / 32.f); ExpectOut(12 / 32.f); + EXPECT_EQ(VertexLoaderManager::normal_cache[0], 10 / 32.f); + EXPECT_EQ(VertexLoaderManager::normal_cache[1], 11 / 32.f); + EXPECT_EQ(VertexLoaderManager::normal_cache[2], 12 / 32.f); if (elements == NormalComponentCount::NTB) { // Tangent @@ -759,6 +763,14 @@ TEST_P(VertexLoaderNormalTest, NormalAll) } } + if (addr == VertexComponentFormat::NotPresent) + { + // Expect these to not be written + EXPECT_EQ(VertexLoaderManager::normal_cache[0], -42.f); + EXPECT_EQ(VertexLoaderManager::normal_cache[1], -43.f); + EXPECT_EQ(VertexLoaderManager::normal_cache[2], -44.f); + EXPECT_EQ(VertexLoaderManager::normal_cache[3], -45.f); + } if (addr == VertexComponentFormat::NotPresent || elements == NormalComponentCount::N) { // Expect these to not be written |
