mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Revert Rodolfo's recent zcomploc commits until they actually work correctly.
This reverts commit402006a83a
. This reverts commit48d8d71391
. This reverts commit450dcc9d2c
.
This commit is contained in:
@ -1211,11 +1211,11 @@ void Renderer::RestoreAPIState()
|
||||
BPFunctions::SetScissor();
|
||||
}
|
||||
|
||||
void Renderer::ApplyState(RenderStateMode mode)
|
||||
void Renderer::ApplyState(bool bUseDstAlpha)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
if (mode == RSM_UseDstAlpha)
|
||||
if (bUseDstAlpha)
|
||||
{
|
||||
// Colors should blend against SRC1_ALPHA
|
||||
if (gx_state.blenddc.RenderTarget[0].SrcBlend == D3D11_BLEND_SRC_ALPHA)
|
||||
@ -1275,7 +1275,7 @@ void Renderer::ApplyState(RenderStateMode mode)
|
||||
|
||||
D3D::stateman->Apply();
|
||||
|
||||
if (mode == RSM_UseDstAlpha)
|
||||
if (bUseDstAlpha)
|
||||
{
|
||||
// restore actual state
|
||||
SetBlendMode(false);
|
||||
@ -1289,7 +1289,7 @@ void Renderer::ApplyState(RenderStateMode mode)
|
||||
D3D::context->VSSetShader(VertexShaderCache::GetActiveShader(), NULL, 0);
|
||||
}
|
||||
|
||||
void Renderer::RestoreState(RenderStateMode mode)
|
||||
void Renderer::RestoreState()
|
||||
{
|
||||
ID3D11ShaderResourceView* shader_resources[8] = { NULL };
|
||||
D3D::context->PSSetShaderResources(0, 8, shader_resources);
|
||||
|
@ -25,8 +25,8 @@ public:
|
||||
void SetInterlacingMode();
|
||||
|
||||
// TODO: Fix confusing names (see ResetAPIState and RestoreAPIState)
|
||||
void ApplyState(RenderStateMode mode);
|
||||
void RestoreState(RenderStateMode mode);
|
||||
void ApplyState(bool bUseDstAlpha);
|
||||
void RestoreState();
|
||||
|
||||
void ApplyCullDisable();
|
||||
void RestoreCull();
|
||||
|
@ -264,13 +264,13 @@ void VertexManager::vFlush()
|
||||
unsigned int stride = g_nativeVertexFmt->GetVertexStride();
|
||||
g_nativeVertexFmt->SetupVertexPointers();
|
||||
|
||||
g_renderer->ApplyState(useDstAlpha ? RSM_UseDstAlpha : RSM_None);
|
||||
g_renderer->ApplyState(useDstAlpha);
|
||||
LoadBuffers();
|
||||
Draw(stride);
|
||||
|
||||
GFX_DEBUGGER_PAUSE_AT(NEXT_FLUSH, true);
|
||||
|
||||
g_renderer->RestoreState(useDstAlpha ? RSM_UseDstAlpha : RSM_None);
|
||||
g_renderer->RestoreState();
|
||||
|
||||
shader_fail:
|
||||
ResetBuffer();
|
||||
|
@ -1204,43 +1204,19 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
||||
XFBWrited = false;
|
||||
}
|
||||
|
||||
void Renderer::ApplyState(RenderStateMode mode)
|
||||
void Renderer::ApplyState(bool bUseDstAlpha)
|
||||
{
|
||||
if(mode == RSM_Zcomploc)
|
||||
{
|
||||
D3D::ChangeRenderState(D3DRS_COLORWRITEENABLE, 0);
|
||||
}
|
||||
else if(mode == RSM_Multipass)
|
||||
{
|
||||
D3D::ChangeRenderState(D3DRS_ZENABLE, TRUE);
|
||||
D3D::ChangeRenderState(D3DRS_ZWRITEENABLE, false);
|
||||
D3D::ChangeRenderState(D3DRS_ZFUNC, D3DCMP_EQUAL);
|
||||
}
|
||||
else if (mode == RSM_UseDstAlpha)
|
||||
if (bUseDstAlpha)
|
||||
{
|
||||
D3D::ChangeRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA);
|
||||
D3D::ChangeRenderState(D3DRS_ALPHABLENDENABLE, false);
|
||||
}
|
||||
}
|
||||
|
||||
void Renderer::RestoreState(RenderStateMode mode)
|
||||
void Renderer::RestoreState()
|
||||
{
|
||||
if(mode == RSM_Zcomploc)
|
||||
{
|
||||
D3D::RefreshRenderState(D3DRS_COLORWRITEENABLE);
|
||||
}
|
||||
else if(mode == RSM_Multipass)
|
||||
{
|
||||
D3D::RefreshRenderState(D3DRS_ALPHABLENDENABLE);
|
||||
D3D::RefreshRenderState(D3DRS_ZENABLE);
|
||||
D3D::RefreshRenderState(D3DRS_ZWRITEENABLE);
|
||||
D3D::RefreshRenderState(D3DRS_ZFUNC);
|
||||
}
|
||||
else if(mode == RSM_UseDstAlpha)
|
||||
{
|
||||
D3D::RefreshRenderState(D3DRS_COLORWRITEENABLE);
|
||||
D3D::RefreshRenderState(D3DRS_ALPHABLENDENABLE);
|
||||
}
|
||||
D3D::RefreshRenderState(D3DRS_COLORWRITEENABLE);
|
||||
D3D::RefreshRenderState(D3DRS_ALPHABLENDENABLE);
|
||||
|
||||
// TODO: Enable this code. Caused glitches for me however (neobrain)
|
||||
// for (unsigned int i = 0; i < 8; ++i)
|
||||
|
@ -24,8 +24,8 @@ public:
|
||||
void SetSamplerState(int stage,int texindex);
|
||||
void SetInterlacingMode();
|
||||
|
||||
void ApplyState(RenderStateMode mode);
|
||||
void RestoreState(RenderStateMode mode);
|
||||
void ApplyState(bool bUseDstAlpha);
|
||||
void RestoreState();
|
||||
|
||||
void RenderText(const char* pstr, int left, int top, u32 color);
|
||||
|
||||
|
@ -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);
|
||||
g_renderer->ApplyState(true);
|
||||
Draw(stride);
|
||||
g_renderer->RestoreState(RSM_UseDstAlpha);
|
||||
if (bpmem.zmode.updateenable)
|
||||
g_renderer->RestoreState(RSM_Multipass);
|
||||
g_renderer->RestoreState();
|
||||
}
|
||||
|
||||
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);
|
||||
Draw(stride);
|
||||
g_renderer->RestoreState(RSM_Zcomploc);
|
||||
}
|
||||
|
||||
GFX_DEBUGGER_PAUSE_AT(NEXT_FLUSH, true);
|
||||
|
||||
shader_fail:
|
||||
|
@ -632,43 +632,6 @@ void Renderer::SetScissorRect(const TargetRectangle& rc)
|
||||
glScissor(rc.left, rc.bottom, rc.GetWidth(), rc.GetHeight());
|
||||
}
|
||||
|
||||
void Renderer::ApplyState(RenderStateMode mode)
|
||||
{
|
||||
if(mode == RSM_Zcomploc)
|
||||
{
|
||||
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
|
||||
}
|
||||
else if(mode == RSM_Multipass)
|
||||
{
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthMask(GL_FALSE);
|
||||
glDepthFunc(GL_EQUAL);
|
||||
}
|
||||
else if (mode == RSM_UseDstAlpha)
|
||||
{
|
||||
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
}
|
||||
|
||||
void Renderer::RestoreState(RenderStateMode mode)
|
||||
{
|
||||
if(mode == RSM_Zcomploc)
|
||||
{
|
||||
SetColorMask();
|
||||
}
|
||||
else if(mode == RSM_Multipass)
|
||||
{
|
||||
SetDepthMode();
|
||||
}
|
||||
else if (mode == RSM_UseDstAlpha)
|
||||
{
|
||||
SetColorMask();
|
||||
if (bpmem.blendmode.blendenable || bpmem.blendmode.subtract)
|
||||
glEnable(GL_BLEND);
|
||||
}
|
||||
}
|
||||
|
||||
void Renderer::SetColorMask()
|
||||
{
|
||||
// Only enable alpha channel if it's supported by the current EFB format
|
||||
|
@ -26,8 +26,9 @@ public:
|
||||
void SetSamplerState(int stage,int texindex);
|
||||
void SetInterlacingMode();
|
||||
|
||||
void ApplyState(RenderStateMode mode);
|
||||
void RestoreState(RenderStateMode mode);
|
||||
// TODO: Implement and use these
|
||||
void ApplyState(bool bUseDstAlpha) {}
|
||||
void RestoreState() {}
|
||||
|
||||
void RenderText(const char* pstr, int left, int top, u32 color);
|
||||
void DrawDebugInfo();
|
||||
|
@ -224,26 +224,17 @@ void VertexManager::vFlush()
|
||||
ps = PixelShaderCache::SetShader(DSTALPHA_ALPHA_PASS,g_nativeVertexFmt->m_components);
|
||||
if (ps) PixelShaderCache::SetCurrentShader(ps->glprogid);
|
||||
|
||||
g_renderer->ApplyState(RSM_UseDstAlpha);
|
||||
if (bpmem.zmode.updateenable)
|
||||
g_renderer->ApplyState(RSM_Multipass);
|
||||
// only update alpha
|
||||
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
Draw();
|
||||
|
||||
g_renderer->RestoreState(RSM_UseDstAlpha);
|
||||
if (bpmem.zmode.updateenable)
|
||||
g_renderer->RestoreState(RSM_Multipass);
|
||||
}
|
||||
// restore color mask
|
||||
g_renderer->SetColorMask();
|
||||
|
||||
bool UseZcomploc = bpmem.zcontrol.zcomploc && bpmem.zmode.updateenable && !g_ActiveConfig.bEnableFastZcomploc;
|
||||
|
||||
if (UseZcomploc)
|
||||
{
|
||||
FRAGMENTSHADER* ps = PixelShaderCache::SetShader(DSTALPHA_ZCOMPLOC,g_nativeVertexFmt->m_components);
|
||||
if (ps) PixelShaderCache::SetCurrentShader(ps->glprogid);
|
||||
g_renderer->ApplyState(RSM_Zcomploc);
|
||||
Draw();
|
||||
g_renderer->RestoreState(RSM_Zcomploc);
|
||||
if (bpmem.blendmode.blendenable || bpmem.blendmode.subtract)
|
||||
glEnable(GL_BLEND);
|
||||
}
|
||||
GFX_DEBUGGER_PAUSE_AT(NEXT_FLUSH, true);
|
||||
|
||||
|
Reference in New Issue
Block a user