For some reason we use DrawActiveTexture in the GL stencil stuff, don't want to disable stencil unconditionally..

This commit is contained in:
Henrik Rydgård 2018-02-08 16:59:03 +01:00
parent 0fe4e70aef
commit 625595c6cc
3 changed files with 9 additions and 5 deletions

View File

@ -150,6 +150,7 @@ enum DrawTextureFlags {
DRAWTEX_NEAREST = 0,
DRAWTEX_LINEAR = 1,
DRAWTEX_KEEP_TEX = 2,
DRAWTEX_KEEP_STENCIL = 4,
};
inline Draw::DataFormat GEFormatToThin3D(int geFormat) {

View File

@ -419,11 +419,13 @@ void FramebufferManagerGLES::DrawActiveTexture(float x, float y, float w, float
pos[i * 3 + 1] = pos[i * 3 + 1] * invDestH - 1.0f;
}
// We always want a plain state here.
// We always want a plain state here, well, except for when it's used by the stencil stuff...
render_->SetNoBlendAndMask(0xF);
render_->SetDepth(false, false, GL_ALWAYS);
render_->SetStencilDisabled();
render_->SetRaster(false, GL_CCW, GL_FALSE, GL_FALSE);
render_->SetRaster(false, GL_CCW, GL_FRONT, GL_FALSE);
if (!(flags & DRAWTEX_KEEP_STENCIL)) {
render_->SetStencilDisabled();
}
// Upscaling postshaders don't look well with linear
if (flags & DRAWTEX_LINEAR) {

View File

@ -170,6 +170,7 @@ bool FramebufferManagerGLES::NotifyStencilUpload(u32 addr, int size, bool skipZe
render_->SetDepth(false, false, GL_ALWAYS);
render_->Clear(0, 0, 0, GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT, 0x8, 0, 0, 0, 0);
render_->SetStencilFunc(GL_TRUE, GL_ALWAYS, 0xFF, 0xFF);
render_->SetRaster(false, GL_CCW, GL_FRONT, GL_FALSE);
render_->BindProgram(stencilUploadProgram_);
render_->SetNoBlendAndMask(0x8);
@ -188,14 +189,14 @@ bool FramebufferManagerGLES::NotifyStencilUpload(u32 addr, int size, bool skipZe
render_->SetStencilOp(i, GL_REPLACE, GL_REPLACE, GL_REPLACE);
render_->SetUniformF1(&u_stencilValue, i * (1.0f / 255.0f));
}
DrawActiveTexture(0, 0, dstBuffer->width, dstBuffer->height, dstBuffer->bufferWidth, dstBuffer->bufferHeight, 0.0f, 0.0f, u1, v1, ROTATION_LOCKED_HORIZONTAL, DRAWTEX_NEAREST);
DrawActiveTexture(0, 0, dstBuffer->width, dstBuffer->height, dstBuffer->bufferWidth, dstBuffer->bufferHeight, 0.0f, 0.0f, u1, v1, ROTATION_LOCKED_HORIZONTAL, DRAWTEX_NEAREST | DRAWTEX_KEEP_STENCIL);
}
if (useBlit) {
draw_->BlitFramebuffer(blitFBO, 0, 0, w, h, dstBuffer->fbo, 0, 0, dstBuffer->renderWidth, dstBuffer->renderHeight, Draw::FB_STENCIL_BIT, Draw::FB_BLIT_NEAREST);
}
gstate_c.Dirty(DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_VIEWPORTSCISSOR_STATE);
gstate_c.Dirty(DIRTY_BLEND_STATE | DIRTY_RASTER_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_VIEWPORTSCISSOR_STATE);
RebindFramebuffer();
return true;
}