From fee98b426b5a0c4d78042a2db3b352c4fe79ef56 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Sat, 24 Mar 2012 04:47:28 +0100 Subject: Revert r41bcf657f89d, r3a9fed0ba285, r9adc119e3c2f and re58692653afd (all of them are wrong). --- Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp') diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp index 2083d4f1d8..c4e8225db1 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp @@ -143,7 +143,7 @@ void VertexManager::vFlush() if (tentry) { // 0s are probably for no manual wrapping needed. - PixelShaderManager::SetTexDims(i, tentry->native_width, tentry->native_height, tentry->virtual_width, tentry->virtual_height, 0, 0, API_D3D9); + PixelShaderManager::SetTexDims(i, tentry->native_width, tentry->native_height, 0, 0); } else ERROR_LOG(VIDEO, "error loading texture"); @@ -152,7 +152,7 @@ void VertexManager::vFlush() // set global constants VertexShaderManager::SetConstants(); - PixelShaderManager::SetConstants(API_D3D9); + PixelShaderManager::SetConstants(); if (!PixelShaderCache::SetShader(DSTALPHA_NONE,g_nativeVertexFmt->m_components)) { -- cgit v1.2.3 From 450dcc9d2cd874f6ab40d4a339afc29f55751319 Mon Sep 17 00:00:00 2001 From: rodolfoosvaldobogado Date: Tue, 27 Mar 2012 15:44:58 -0300 Subject: As requested, this is my implementation of zcomploc using a multi-pass algorithm. My apologize to the others devs for committing in the main branch but is the only way to get this tested as soon as possible. please test for regressions, speed and for other issues fixed, as a example, the black color in water splash in super mario galaxy are fixed with this rev. please as soon as yo find a bug let me know. --- .../Plugins/Plugin_VideoDX9/Src/VertexManager.cpp | 36 +++++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp') diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp index c4e8225db1..82ee8d1623 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp @@ -154,11 +154,6 @@ void VertexManager::vFlush() VertexShaderManager::SetConstants(); PixelShaderManager::SetConstants(); - if (!PixelShaderCache::SetShader(DSTALPHA_NONE,g_nativeVertexFmt->m_components)) - { - GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");}); - goto shader_fail; - } if (!VertexShaderCache::SetShader(g_nativeVertexFmt->m_components)) { GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set vertex shader\n");}); @@ -168,6 +163,25 @@ 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");}); + goto shader_fail; + } Draw(stride); @@ -175,16 +189,22 @@ void VertexManager::vFlush() bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24; if (useDstAlpha) { - DWORD write = 0; if (!PixelShaderCache::SetShader(DSTALPHA_ALPHA_PASS, g_nativeVertexFmt->m_components)) { GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");}); goto shader_fail; } // update alpha only - g_renderer->ApplyState(true); + g_renderer->ApplyState(RSM_UseDstAlpha); + if(!UseZcomploc && bpmem.zmode.updateenable) + g_renderer->ApplyState(RSM_Multipass); Draw(stride); - g_renderer->RestoreState(); + g_renderer->RestoreState(RSM_UseDstAlpha); + } + + if (UseZcomploc || (useDstAlpha && bpmem.zmode.updateenable)) + { + g_renderer->RestoreState(RSM_Multipass); } GFX_DEBUGGER_PAUSE_AT(NEXT_FLUSH, true); -- cgit v1.2.3 From 48d8d71391fc2cc40d85732680eb6421164bf87c Mon Sep 17 00:00:00 2001 From: rodolfoosvaldobogado Date: Tue, 27 Mar 2012 23:14:59 -0300 Subject: Fix for my last commit, this must fix the problem in the algorithm pointed by neobrain. thanks --- .../Plugins/Plugin_VideoDX9/Src/VertexManager.cpp | 39 +++++++++++----------- 1 file changed, 19 insertions(+), 20 deletions(-) (limited to 'Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp') 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: -- cgit v1.2.3 From 402006a83a89bc0f790934096e915f0e8c23f808 Mon Sep 17 00:00:00 2001 From: rodolfoosvaldobogado Date: Thu, 29 Mar 2012 18:26:58 -0300 Subject: more fixes to zcomplock and opengl implementation --- Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp') diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp index 8dd13f3e3b..af5bc3c839 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp @@ -191,7 +191,7 @@ void VertexManager::vFlush() g_renderer->RestoreState(RSM_Multipass); } - bool UseZcomploc = bpmem.zcontrol.zcomploc && bpmem.zmode.updateenable && g_ActiveConfig.bAcurateZcomploc; + bool UseZcomploc = bpmem.zcontrol.zcomploc && bpmem.zmode.updateenable && !g_ActiveConfig.bEnableFastZcomploc; if (UseZcomploc) { -- cgit v1.2.3 From 460610ea0e0d5083e261ed9d137048f2a5fc7e59 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Fri, 30 Mar 2012 01:56:24 +0200 Subject: Revert Rodolfo's recent zcomploc commits until they actually work correctly. This reverts commit 402006a83a89bc0f790934096e915f0e8c23f808. This reverts commit 48d8d71391fc2cc40d85732680eb6421164bf87c. This reverts commit 450dcc9d2cd874f6ab40d4a339afc29f55751319. --- .../Plugins/Plugin_VideoDX9/Src/VertexManager.cpp | 39 ++++++---------------- 1 file changed, 10 insertions(+), 29 deletions(-) (limited to 'Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp') diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp index af5bc3c839..c4e8225db1 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp @@ -154,9 +154,11 @@ void VertexManager::vFlush() VertexShaderManager::SetConstants(); PixelShaderManager::SetConstants(); - int stride = g_nativeVertexFmt->GetVertexStride(); - g_nativeVertexFmt->SetupVertexPointers(); - + if (!PixelShaderCache::SetShader(DSTALPHA_NONE,g_nativeVertexFmt->m_components)) + { + GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");}); + goto shader_fail; + } if (!VertexShaderCache::SetShader(g_nativeVertexFmt->m_components)) { GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set vertex shader\n");}); @@ -164,11 +166,8 @@ void VertexManager::vFlush() } - if (!PixelShaderCache::SetShader(DSTALPHA_NONE,g_nativeVertexFmt->m_components)) - { - GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");}); - goto shader_fail; - } + int stride = g_nativeVertexFmt->GetVertexStride(); + g_nativeVertexFmt->SetupVertexPointers(); Draw(stride); @@ -176,35 +175,17 @@ void VertexManager::vFlush() bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24; if (useDstAlpha) { + DWORD write = 0; if (!PixelShaderCache::SetShader(DSTALPHA_ALPHA_PASS, g_nativeVertexFmt->m_components)) { GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");}); goto shader_fail; } // update alpha only - g_renderer->ApplyState(RSM_UseDstAlpha); - 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); - } - - bool UseZcomploc = bpmem.zcontrol.zcomploc && bpmem.zmode.updateenable && !g_ActiveConfig.bEnableFastZcomploc; - - 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); + g_renderer->ApplyState(true); Draw(stride); - g_renderer->RestoreState(RSM_Zcomploc); + g_renderer->RestoreState(); } - GFX_DEBUGGER_PAUSE_AT(NEXT_FLUSH, true); shader_fail: -- cgit v1.2.3