diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp index 82ee8d1623..8dd13f3e3b 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp @@ -154,6 +154,9 @@ void VertexManager::vFlush() VertexShaderManager::SetConstants(); PixelShaderManager::SetConstants(); + int stride = g_nativeVertexFmt->GetVertexStride(); + g_nativeVertexFmt->SetupVertexPointers(); + if (!VertexShaderCache::SetShader(g_nativeVertexFmt->m_components)) { GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set vertex shader\n");}); @@ -161,22 +164,6 @@ void VertexManager::vFlush() } - int stride = g_nativeVertexFmt->GetVertexStride(); - g_nativeVertexFmt->SetupVertexPointers(); - bool UseZcomploc = bpmem.zcontrol.zcomploc && bpmem.zmode.updateenable && g_ActiveConfig.bAcurateZcomploc; - if (UseZcomploc) - { - if (!PixelShaderCache::SetShader(DSTALPHA_ZCOMPLOC,g_nativeVertexFmt->m_components)) - { - GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");}); - goto shader_fail; - } - g_renderer->ApplyState(RSM_Zcomploc); - Draw(stride); - g_renderer->RestoreState(RSM_Zcomploc); - g_renderer->ApplyState(RSM_Multipass); - } - if (!PixelShaderCache::SetShader(DSTALPHA_NONE,g_nativeVertexFmt->m_components)) { GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");}); @@ -196,16 +183,28 @@ void VertexManager::vFlush() } // update alpha only g_renderer->ApplyState(RSM_UseDstAlpha); - if(!UseZcomploc && bpmem.zmode.updateenable) + if (bpmem.zmode.updateenable) g_renderer->ApplyState(RSM_Multipass); Draw(stride); g_renderer->RestoreState(RSM_UseDstAlpha); + if (bpmem.zmode.updateenable) + g_renderer->RestoreState(RSM_Multipass); } - - if (UseZcomploc || (useDstAlpha && bpmem.zmode.updateenable)) + + bool UseZcomploc = bpmem.zcontrol.zcomploc && bpmem.zmode.updateenable && g_ActiveConfig.bAcurateZcomploc; + + if (UseZcomploc) { - g_renderer->RestoreState(RSM_Multipass); + if (!PixelShaderCache::SetShader(DSTALPHA_ZCOMPLOC,g_nativeVertexFmt->m_components)) + { + GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");}); + goto shader_fail; + } + g_renderer->ApplyState(RSM_Zcomploc); + Draw(stride); + g_renderer->RestoreState(RSM_Zcomploc); } + GFX_DEBUGGER_PAUSE_AT(NEXT_FLUSH, true); shader_fail: