summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/VertexShaderManager.cpp
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2020-11-21 02:55:50 +0100
committerGitHub <noreply@github.com>2020-11-21 02:55:50 +0100
commit608dd6a37b1f0208340063b5ffe34193eea7ebc3 (patch)
treef271cab8f4c9b0a80a58fcd7118f668898a009e1 /Source/Core/VideoCommon/VertexShaderManager.cpp
parentfa73b1a23f9b0c5104909de410f9ae533cbf8af4 (diff)
parentd6ce8eef36f5b0bfd0078c51701b052cc9a77005 (diff)
Merge pull request #9122 from Pokechu22/pr-4601-test
Fix Super Mario Sunshine debug cubes (originally PR #4601 by stenzek)
Diffstat (limited to 'Source/Core/VideoCommon/VertexShaderManager.cpp')
-rw-r--r--Source/Core/VideoCommon/VertexShaderManager.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/Source/Core/VideoCommon/VertexShaderManager.cpp b/Source/Core/VideoCommon/VertexShaderManager.cpp
index aa57161d71..04cb3b2f6f 100644
--- a/Source/Core/VideoCommon/VertexShaderManager.cpp
+++ b/Source/Core/VideoCommon/VertexShaderManager.cpp
@@ -452,7 +452,6 @@ void VertexShaderManager::SetConstants()
constants.xfmem_pack1[i][3] = xfmem.alpha[i].hex;
}
constants.xfmem_numColorChans = xfmem.numChan.numColorChans;
-
dirty = true;
}
}
@@ -617,6 +616,17 @@ void VertexShaderManager::SetVertexFormat(u32 components)
constants.components = components;
dirty = true;
}
+
+ // The default alpha channel seems to depend on the number of components in the vertex format.
+ // If the vertex attribute has an alpha channel, zero is used, otherwise one.
+ const u32 color_chan_alpha =
+ (g_main_cp_state.vtx_attr[g_main_cp_state.last_id].g0.Color0Elements ^ 1) |
+ ((g_main_cp_state.vtx_attr[g_main_cp_state.last_id].g0.Color1Elements ^ 1) << 1);
+ if (color_chan_alpha != constants.color_chan_alpha)
+ {
+ constants.color_chan_alpha = color_chan_alpha;
+ dirty = true;
+ }
}
void VertexShaderManager::SetTexMatrixInfoChanged(int index)