mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-27 12:24:22 +01:00
Merge pull request #2833 from ReinUsesLisp/fix-stencil
gl_rasterizer: Fix stencil testing
This commit is contained in:
commit
03badbdd9b
@ -537,8 +537,7 @@ std::pair<bool, bool> RasterizerOpenGL::ConfigureFramebuffers(
|
|||||||
texture_cache.MarkDepthBufferInUse();
|
texture_cache.MarkDepthBufferInUse();
|
||||||
|
|
||||||
fbkey.zeta = depth_surface;
|
fbkey.zeta = depth_surface;
|
||||||
fbkey.stencil_enable = regs.stencil_enable &&
|
fbkey.stencil_enable = depth_surface->GetSurfaceParams().type == SurfaceType::DepthStencil;
|
||||||
depth_surface->GetSurfaceParams().type == SurfaceType::DepthStencil;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
texture_cache.GuardRenderTargets(false);
|
texture_cache.GuardRenderTargets(false);
|
||||||
@ -577,16 +576,15 @@ void RasterizerOpenGL::ConfigureClearFramebuffer(OpenGLState& current_state, boo
|
|||||||
if (depth_surface) {
|
if (depth_surface) {
|
||||||
const auto& params = depth_surface->GetSurfaceParams();
|
const auto& params = depth_surface->GetSurfaceParams();
|
||||||
switch (params.type) {
|
switch (params.type) {
|
||||||
case VideoCore::Surface::SurfaceType::Depth: {
|
case VideoCore::Surface::SurfaceType::Depth:
|
||||||
depth_surface->Attach(GL_DEPTH_ATTACHMENT, GL_DRAW_FRAMEBUFFER);
|
depth_surface->Attach(GL_DEPTH_ATTACHMENT, GL_DRAW_FRAMEBUFFER);
|
||||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0, 0);
|
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0, 0);
|
||||||
break;
|
break;
|
||||||
}
|
case VideoCore::Surface::SurfaceType::DepthStencil:
|
||||||
case VideoCore::Surface::SurfaceType::DepthStencil: {
|
depth_surface->Attach(GL_DEPTH_STENCIL_ATTACHMENT, GL_DRAW_FRAMEBUFFER);
|
||||||
depth_surface->Attach(GL_DEPTH_ATTACHMENT, GL_DRAW_FRAMEBUFFER);
|
|
||||||
break;
|
break;
|
||||||
}
|
default:
|
||||||
default: { UNIMPLEMENTED(); }
|
UNIMPLEMENTED();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0,
|
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0,
|
||||||
@ -639,6 +637,7 @@ void RasterizerOpenGL::Clear() {
|
|||||||
ASSERT_MSG(regs.zeta_enable != 0, "Tried to clear stencil but buffer is not enabled!");
|
ASSERT_MSG(regs.zeta_enable != 0, "Tried to clear stencil but buffer is not enabled!");
|
||||||
use_stencil = true;
|
use_stencil = true;
|
||||||
clear_state.stencil.test_enabled = true;
|
clear_state.stencil.test_enabled = true;
|
||||||
|
|
||||||
if (regs.clear_flags.stencil) {
|
if (regs.clear_flags.stencil) {
|
||||||
// Stencil affects the clear so fill it with the used masks
|
// Stencil affects the clear so fill it with the used masks
|
||||||
clear_state.stencil.front.test_func = GL_ALWAYS;
|
clear_state.stencil.front.test_func = GL_ALWAYS;
|
||||||
@ -1119,9 +1118,12 @@ void RasterizerOpenGL::SyncStencilTestState() {
|
|||||||
if (!maxwell3d.dirty.stencil_test) {
|
if (!maxwell3d.dirty.stencil_test) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto& regs = maxwell3d.regs;
|
maxwell3d.dirty.stencil_test = false;
|
||||||
|
|
||||||
|
const auto& regs = maxwell3d.regs;
|
||||||
state.stencil.test_enabled = regs.stencil_enable != 0;
|
state.stencil.test_enabled = regs.stencil_enable != 0;
|
||||||
|
state.MarkDirtyStencilState();
|
||||||
|
|
||||||
if (!regs.stencil_enable) {
|
if (!regs.stencil_enable) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1150,8 +1152,6 @@ void RasterizerOpenGL::SyncStencilTestState() {
|
|||||||
state.stencil.back.action_depth_fail = GL_KEEP;
|
state.stencil.back.action_depth_fail = GL_KEEP;
|
||||||
state.stencil.back.action_depth_pass = GL_KEEP;
|
state.stencil.back.action_depth_pass = GL_KEEP;
|
||||||
}
|
}
|
||||||
state.MarkDirtyStencilState();
|
|
||||||
maxwell3d.dirty.stencil_test = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerOpenGL::SyncColorMask() {
|
void RasterizerOpenGL::SyncColorMask() {
|
||||||
|
Loading…
Reference in New Issue
Block a user