summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/VertexLoader.cpp
diff options
context:
space:
mode:
authorPokechu22 <Pokechu022@gmail.com>2023-12-02 14:14:58 -0800
committerPokechu22 <Pokechu022@gmail.com>2023-12-02 15:54:52 -0800
commit36796abc089357a74dc10851190522137bb1d5ed (patch)
treeb19e0a4f5a02cb664e8f6c8f156662a1cc2bc25e /Source/Core/VideoCommon/VertexLoader.cpp
parent1ee6824324979b186baca2b5266be9c20e88c78a (diff)
VertexLoader: Fix wrong array being used if color 1 is present but color 0 isn't
This worked correctly on the JIT vertex loaders, and for the equivalent case with texture coordinates. I'm not aware of any games this affects (but libogc does mention a semi-related scenario at https://github.com/devkitPro/libogc/blob/6bc0317c7d52063c2d2b48b721520093c76432a9/gc/ogc/gx.h#L1855-L1857.)
Diffstat (limited to 'Source/Core/VideoCommon/VertexLoader.cpp')
-rw-r--r--Source/Core/VideoCommon/VertexLoader.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/VertexLoader.cpp b/Source/Core/VideoCommon/VertexLoader.cpp
index c2d3c1bd29..89965f8710 100644
--- a/Source/Core/VideoCommon/VertexLoader.cpp
+++ b/Source/Core/VideoCommon/VertexLoader.cpp
@@ -149,9 +149,16 @@ void VertexLoader::CompileVertexTranslator()
VertexLoader_Color::GetFunction(m_VtxDesc.low.Color[i], m_VtxAttr.GetColorFormat(i));
if (pFunc != nullptr)
+ {
WriteCall(pFunc);
+ }
else
+ {
ASSERT(m_VtxDesc.low.Color[i] == VertexComponentFormat::NotPresent);
+ // Keep colIndex in sync if color 0 is absent but color 1 is present
+ if (i == 0 && m_VtxDesc.low.Color[1] != VertexComponentFormat::NotPresent)
+ WriteCall(VertexLoader_Color::GetDummyFunction());
+ }
if (m_VtxDesc.low.Color[i] != VertexComponentFormat::NotPresent)
{