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.
This commit is contained in:
rodolfoosvaldobogado
2012-03-27 15:44:58 -03:00
parent 48eb791a4e
commit 450dcc9d2c
14 changed files with 114 additions and 48 deletions

View File

@ -1211,11 +1211,11 @@ void Renderer::RestoreAPIState()
BPFunctions::SetScissor();
}
void Renderer::ApplyState(bool bUseDstAlpha)
void Renderer::ApplyState(RenderStateMode mode)
{
HRESULT hr;
if (bUseDstAlpha)
if (mode == RSM_UseDstAlpha)
{
// Colors should blend against SRC1_ALPHA
if (gx_state.blenddc.RenderTarget[0].SrcBlend == D3D11_BLEND_SRC_ALPHA)
@ -1275,7 +1275,7 @@ void Renderer::ApplyState(bool bUseDstAlpha)
D3D::stateman->Apply();
if (bUseDstAlpha)
if (mode == RSM_UseDstAlpha)
{
// restore actual state
SetBlendMode(false);
@ -1289,7 +1289,7 @@ void Renderer::ApplyState(bool bUseDstAlpha)
D3D::context->VSSetShader(VertexShaderCache::GetActiveShader(), NULL, 0);
}
void Renderer::RestoreState()
void Renderer::RestoreState(RenderStateMode mode)
{
ID3D11ShaderResourceView* shader_resources[8] = { NULL };
D3D::context->PSSetShaderResources(0, 8, shader_resources);

View File

@ -25,8 +25,8 @@ public:
void SetInterlacingMode();
// TODO: Fix confusing names (see ResetAPIState and RestoreAPIState)
void ApplyState(bool bUseDstAlpha);
void RestoreState();
void ApplyState(RenderStateMode mode);
void RestoreState(RenderStateMode mode);
void ApplyCullDisable();
void RestoreCull();

View File

@ -264,13 +264,13 @@ void VertexManager::vFlush()
unsigned int stride = g_nativeVertexFmt->GetVertexStride();
g_nativeVertexFmt->SetupVertexPointers();
g_renderer->ApplyState(useDstAlpha);
g_renderer->ApplyState(useDstAlpha ? RSM_UseDstAlpha : RSM_None);
LoadBuffers();
Draw(stride);
GFX_DEBUGGER_PAUSE_AT(NEXT_FLUSH, true);
g_renderer->RestoreState();
g_renderer->RestoreState(useDstAlpha ? RSM_UseDstAlpha : RSM_None);
shader_fail:
ResetBuffer();