From 80421156b6e16b2ae68a1214c1598c2db3f750b4 Mon Sep 17 00:00:00 2001 From: Jens Nyberg Date: Tue, 18 Mar 2014 19:44:23 +0100 Subject: [PATCH 1/2] OGL/VertexManager: Minor cleanup of if case --- Source/Core/VideoBackends/OGL/VertexManager.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/Source/Core/VideoBackends/OGL/VertexManager.cpp b/Source/Core/VideoBackends/OGL/VertexManager.cpp index e58b2d777f..668ebcd7a7 100644 --- a/Source/Core/VideoBackends/OGL/VertexManager.cpp +++ b/Source/Core/VideoBackends/OGL/VertexManager.cpp @@ -143,19 +143,11 @@ void VertexManager::vFlush(bool useDstAlpha) // Makes sure we can actually do Dual source blending bool dualSourcePossible = g_ActiveConfig.backend_info.bSupportsDualSourceBlend; - // finally bind - if (dualSourcePossible) + // If host supports GL_ARB_blend_func_extended, we can do dst alpha in + // the same pass as regular rendering. + if (useDstAlpha && dualSourcePossible) { - if (useDstAlpha) - { - // If host supports GL_ARB_blend_func_extended, we can do dst alpha in - // the same pass as regular rendering. - ProgramShaderCache::SetShader(DSTALPHA_DUAL_SOURCE_BLEND, g_nativeVertexFmt->m_components); - } - else - { - ProgramShaderCache::SetShader(DSTALPHA_NONE,g_nativeVertexFmt->m_components); - } + ProgramShaderCache::SetShader(DSTALPHA_DUAL_SOURCE_BLEND, g_nativeVertexFmt->m_components); } else { From ae260e55e45a745156ad7d5fe3e5eb38e4718df7 Mon Sep 17 00:00:00 2001 From: Jens Nyberg Date: Tue, 18 Mar 2014 19:48:00 +0100 Subject: [PATCH 2/2] OGL/VertexManager: Do not check if g_nativeVertexFmt is zero The variable is already dereferenced both before and after this check which means that if this variable would ever be zero it would have crashed dolphin already. --- Source/Core/VideoBackends/OGL/VertexManager.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/Core/VideoBackends/OGL/VertexManager.cpp b/Source/Core/VideoBackends/OGL/VertexManager.cpp index 668ebcd7a7..b8bc676169 100644 --- a/Source/Core/VideoBackends/OGL/VertexManager.cpp +++ b/Source/Core/VideoBackends/OGL/VertexManager.cpp @@ -158,8 +158,7 @@ void VertexManager::vFlush(bool useDstAlpha) ProgramShaderCache::UploadConstants(); // setup the pointers - if (g_nativeVertexFmt) - g_nativeVertexFmt->SetupVertexPointers(); + g_nativeVertexFmt->SetupVertexPointers(); GL_REPORT_ERRORD(); Draw(stride);