diff --git a/stepmania/src/RageDisplay_D3D.cpp b/stepmania/src/RageDisplay_D3D.cpp index 4841842244..0d001cf6c6 100644 --- a/stepmania/src/RageDisplay_D3D.cpp +++ b/stepmania/src/RageDisplay_D3D.cpp @@ -859,6 +859,7 @@ void RageDisplay_D3D::SetTextureFiltering( bool b ) void RageDisplay_D3D::SetBlendMode( BlendMode mode ) { g_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE ); + g_pd3dDevice->SetRenderState( D3DRS_ZBIAS, 0 ); switch( mode ) { case BLEND_NORMAL: @@ -872,6 +873,11 @@ void RageDisplay_D3D::SetBlendMode( BlendMode mode ) case BLEND_NO_EFFECT: g_pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_ZERO ); g_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_ONE ); + + /* This is almost exclusively used to draw masks to the Z-buffer. Make sure + * masks always win the depth test when drawn at the same position. */ + g_pd3dDevice->SetRenderState( D3DRS_ZBIAS, 1 ); + break; default: ASSERT(0); diff --git a/stepmania/src/RageDisplay_OGL.cpp b/stepmania/src/RageDisplay_OGL.cpp index 7a169f3a23..5834247ae9 100644 --- a/stepmania/src/RageDisplay_OGL.cpp +++ b/stepmania/src/RageDisplay_OGL.cpp @@ -1023,6 +1023,7 @@ void RageDisplay_OGL::SetBlendMode( BlendMode mode ) { glEnable(GL_BLEND); + glDepthRange( 0.05, 1.0 ); switch( mode ) { case BLEND_NORMAL: @@ -1033,6 +1034,10 @@ void RageDisplay_OGL::SetBlendMode( BlendMode mode ) break; case BLEND_NO_EFFECT: glBlendFunc( GL_ZERO, GL_ONE ); + + /* This is almost exclusively used to draw masks to the Z-buffer. Make sure + * masks always win the depth test when drawn at the same position. */ + glDepthRange( 0.0, 0.95 ); break; default: ASSERT(0);