First Stage:

Fix depth related errors in dstalpha pass.
best place to test: water splash effect in super mario galaxy
This commit is contained in:
rodolfoosvaldobogado
2012-04-02 14:26:12 -03:00
parent f7ce27c91d
commit a0d60210fd
10 changed files with 101 additions and 26 deletions

View File

@ -245,6 +245,7 @@ int GetNumMSAACoverageSamples(int MSAAMode)
// Init functions
Renderer::Renderer()
{
Renderer::LastMode = RSM_None;
OSDInternalW = 0;
OSDInternalH = 0;
@ -515,6 +516,49 @@ Renderer::~Renderer()
delete g_framebuffer_manager;
}
void Renderer::ApplyState(u32 mode)
{
if(mode & RSM_Zcomploc)
{
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
}
if(mode & RSM_Multipass)
{
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_FALSE);
glDepthFunc(GL_EQUAL);
}
if (mode & RSM_UseDstAlpha)
{
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
glDisable(GL_BLEND);
}
Renderer::LastMode |= mode;
}
void Renderer::RestoreState()
{
if(Renderer::LastMode & RSM_Zcomploc)
{
SetColorMask();
}
if(Renderer::LastMode & RSM_Multipass)
{
SetDepthMode();
}
if (Renderer::LastMode & RSM_UseDstAlpha)
{
SetColorMask();
if (bpmem.blendmode.blendenable || bpmem.blendmode.subtract)
glEnable(GL_BLEND);
}
Renderer::LastMode = RSM_None;
}
// Create On-Screen-Messages
void Renderer::DrawDebugInfo()
{

View File

@ -11,6 +11,8 @@ void ClearEFBCache();
class Renderer : public ::Renderer
{
private:
u32 LastMode;
public:
Renderer();
~Renderer();
@ -27,8 +29,8 @@ public:
void SetInterlacingMode();
// TODO: Implement and use these
void ApplyState(bool bUseDstAlpha) {}
void RestoreState() {}
void ApplyState(u32 mode);
void RestoreState();
void RenderText(const char* pstr, int left, int top, u32 color);
void DrawDebugInfo();

View File

@ -224,17 +224,9 @@ void VertexManager::vFlush()
ps = PixelShaderCache::SetShader(DSTALPHA_ALPHA_PASS,g_nativeVertexFmt->m_components);
if (ps) PixelShaderCache::SetCurrentShader(ps->glprogid);
// only update alpha
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
glDisable(GL_BLEND);
Draw();
// restore color mask
g_renderer->SetColorMask();
if (bpmem.blendmode.blendenable || bpmem.blendmode.subtract)
glEnable(GL_BLEND);
g_renderer->ApplyState(RSM_UseDstAlpha | (bpmem.zmode.updateenable ? RSM_Multipass : RSM_None));
Draw();
g_renderer->RestoreState();
}
GFX_DEBUGGER_PAUSE_AT(NEXT_FLUSH, true);