summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/VertexLoaderBase.cpp
diff options
context:
space:
mode:
authorTilka <tilkax@gmail.com>2024-10-12 19:49:48 +0100
committerGitHub <noreply@github.com>2024-10-12 19:49:48 +0100
commitd43c6dc555fea0b0ec84d05779a62dc876b70bf4 (patch)
treef7e24ca237cdda8cde7e611ee52806fdea96292a /Source/Core/VideoCommon/VertexLoaderBase.cpp
parent35ec2e97a8ea90730cb33eceec701f81597f98f7 (diff)
parent937bb2aa2e12b635ba328af8de7c9a5d5963d084 (diff)
Merge pull request #13074 from Pokechu22/normal-cache
Cache normals in addition to binormals and tangents
Diffstat (limited to 'Source/Core/VideoCommon/VertexLoaderBase.cpp')
-rw-r--r--Source/Core/VideoCommon/VertexLoaderBase.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/VertexLoaderBase.cpp b/Source/Core/VideoCommon/VertexLoaderBase.cpp
index 3284a2ccdb..a3597b53e5 100644
--- a/Source/Core/VideoCommon/VertexLoaderBase.cpp
+++ b/Source/Core/VideoCommon/VertexLoaderBase.cpp
@@ -68,6 +68,7 @@ public:
VertexLoaderManager::position_matrix_index_cache;
const std::array<std::array<float, 4>, 3> old_position_cache =
VertexLoaderManager::position_cache;
+ const std::array<float, 4> old_normal_cache = VertexLoaderManager::normal_cache;
const std::array<float, 4> old_tangent_cache = VertexLoaderManager::tangent_cache;
const std::array<float, 4> old_binormal_cache = VertexLoaderManager::binormal_cache;
@@ -77,12 +78,14 @@ public:
VertexLoaderManager::position_matrix_index_cache;
const std::array<std::array<float, 4>, 3> a_position_cache =
VertexLoaderManager::position_cache;
+ const std::array<float, 4> a_normal_cache = VertexLoaderManager::normal_cache;
const std::array<float, 4> a_tangent_cache = VertexLoaderManager::tangent_cache;
const std::array<float, 4> a_binormal_cache = VertexLoaderManager::binormal_cache;
// Reset state before running b
VertexLoaderManager::position_matrix_index_cache = old_position_matrix_index_cache;
VertexLoaderManager::position_cache = old_position_cache;
+ VertexLoaderManager::normal_cache = old_normal_cache;
VertexLoaderManager::tangent_cache = old_tangent_cache;
VertexLoaderManager::binormal_cache = old_binormal_cache;
@@ -92,6 +95,7 @@ public:
VertexLoaderManager::position_matrix_index_cache;
const std::array<std::array<float, 4>, 3> b_position_cache =
VertexLoaderManager::position_cache;
+ const std::array<float, 4> b_normal_cache = VertexLoaderManager::normal_cache;
const std::array<float, 4> b_tangent_cache = VertexLoaderManager::tangent_cache;
const std::array<float, 4> b_binormal_cache = VertexLoaderManager::binormal_cache;
@@ -141,6 +145,12 @@ public:
// The last element is allowed to be garbage for SIMD overwrites
ASSERT_MSG(VIDEO,
+ std::equal(a_normal_cache.begin(), a_normal_cache.begin() + 3,
+ b_normal_cache.begin(), b_normal_cache.begin() + 3, bit_equal),
+ "Expected matching normal caches after loading (a: {}; b: {})",
+ fmt::join(a_normal_cache, ", "), fmt::join(b_normal_cache, ", "));
+
+ ASSERT_MSG(VIDEO,
std::equal(a_tangent_cache.begin(), a_tangent_cache.begin() + 3,
b_tangent_cache.begin(), b_tangent_cache.begin() + 3, bit_equal),
"Expected matching tangent caches after loading (a: {}; b: {})",