- fixed stencil marking for SSAO.

This commit is contained in:
Christoph Oelckers 2018-10-30 23:33:45 +01:00
parent 0b460ccb03
commit aafa445aac
3 changed files with 6 additions and 4 deletions

View File

@ -440,7 +440,8 @@ void FGLRenderState::SetStencil(int offs, int op, int flags)
glStencilOp(GL_KEEP, GL_KEEP, op2gl[op]); // this stage doesn't modify the stencil
bool cmon = !(flags & SF_ColorMaskOff);
glColorMask(cmon, cmon, cmon, cmon); // don't write to the graphics buffer
bool cmalpha = cmon || (flags & SF_ColorMaskAlpha);
glColorMask(cmon, cmon, cmon, cmalpha); // don't write to the graphics buffer
glDepthMask(!(flags & SF_DepthMaskOff));
}

View File

@ -301,7 +301,7 @@ void HWPortal::RemoveStencil(HWDrawInfo *di, FRenderState &state, bool usestenci
state.EnableTexture(false);
state.SetRenderStyle(STYLE_Source);
state.SetStencil(0, SOP_Keep, SF_ColorMaskOff);
state.SetStencil(0, SOP_Keep, SF_ColorMaskOff | SF_ColorMaskAlpha); // SSAO needs the alpha channel as a marker.
if (needdepth) state.Clear(CT_Depth);
state.SetDepthRange(0, 1);
state.SetDepthFunc(DF_LEqual);
@ -946,8 +946,8 @@ void HWEEHorizonPortal::DrawContents(HWDrawInfo *di, FRenderState &state)
{
GLSkyInfo skyinfo;
skyinfo.init(sector->sky, 0);
//GLSkyPortal sky(mState, &skyinfo, true);
//sky.DrawContents(di, state);
HWSkyPortal sky(screen->mSkyData, mState, &skyinfo, true);
sky.DrawContents(di, state);
}
if (sector->GetTexture(sector_t::ceiling) != skyflatnum)
{

View File

@ -57,6 +57,7 @@ enum EStencilFlags
SF_AllOn = 0,
SF_ColorMaskOff = 1,
SF_DepthMaskOff = 2,
SF_ColorMaskAlpha = 4, // hack value for SSAO
};
enum EStencilOp