mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-16 04:00:04 +00:00
gl_state: Remove depth tracking
This commit is contained in:
parent
0f343d32c4
commit
e1a16a52fa
@ -446,12 +446,8 @@ void RasterizerOpenGL::Clear() {
|
|||||||
ASSERT_MSG(regs.zeta_enable != 0, "Tried to clear Z but buffer is not enabled!");
|
ASSERT_MSG(regs.zeta_enable != 0, "Tried to clear Z but buffer is not enabled!");
|
||||||
use_depth = true;
|
use_depth = true;
|
||||||
|
|
||||||
// Always enable the depth write when clearing the depth buffer. The depth write mask is
|
// TODO: Signal state tracker about these changes
|
||||||
// ignored when clearing the buffer in the Switch, but OpenGL obeys it so we set it to
|
glDepthMask(GL_TRUE);
|
||||||
// true.
|
|
||||||
clear_state.depth.test_enabled = true;
|
|
||||||
clear_state.depth.test_func = GL_ALWAYS;
|
|
||||||
clear_state.depth.write_mask = GL_TRUE;
|
|
||||||
}
|
}
|
||||||
if (regs.clear_buffers.S) {
|
if (regs.clear_buffers.S) {
|
||||||
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!");
|
||||||
@ -1036,14 +1032,12 @@ void RasterizerOpenGL::SyncPrimitiveRestart() {
|
|||||||
void RasterizerOpenGL::SyncDepthTestState() {
|
void RasterizerOpenGL::SyncDepthTestState() {
|
||||||
const auto& regs = system.GPU().Maxwell3D().regs;
|
const auto& regs = system.GPU().Maxwell3D().regs;
|
||||||
|
|
||||||
state.depth.test_enabled = regs.depth_test_enable != 0;
|
glDepthMask(regs.depth_write_enabled ? GL_TRUE : GL_FALSE);
|
||||||
state.depth.write_mask = regs.depth_write_enabled ? GL_TRUE : GL_FALSE;
|
|
||||||
|
|
||||||
if (!state.depth.test_enabled) {
|
oglEnable(GL_DEPTH_TEST, regs.depth_test_enable);
|
||||||
return;
|
if (regs.depth_test_enable) {
|
||||||
|
glDepthFunc(MaxwellToGL::ComparisonOp(regs.depth_test_func));
|
||||||
}
|
}
|
||||||
|
|
||||||
state.depth.test_func = MaxwellToGL::ComparisonOp(regs.depth_test_func);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerOpenGL::SyncStencilTestState() {
|
void RasterizerOpenGL::SyncStencilTestState() {
|
||||||
|
@ -183,20 +183,6 @@ void OpenGLState::ApplyColorMask() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLState::ApplyDepth() {
|
|
||||||
Enable(GL_DEPTH_TEST, cur_state.depth.test_enabled, depth.test_enabled);
|
|
||||||
|
|
||||||
if (cur_state.depth.test_func != depth.test_func) {
|
|
||||||
cur_state.depth.test_func = depth.test_func;
|
|
||||||
glDepthFunc(depth.test_func);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cur_state.depth.write_mask != depth.write_mask) {
|
|
||||||
cur_state.depth.write_mask = depth.write_mask;
|
|
||||||
glDepthMask(depth.write_mask);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void OpenGLState::ApplyStencilTest() {
|
void OpenGLState::ApplyStencilTest() {
|
||||||
Enable(GL_STENCIL_TEST, cur_state.stencil.test_enabled, stencil.test_enabled);
|
Enable(GL_STENCIL_TEST, cur_state.stencil.test_enabled, stencil.test_enabled);
|
||||||
|
|
||||||
@ -380,7 +366,6 @@ void OpenGLState::Apply() {
|
|||||||
ApplyViewport();
|
ApplyViewport();
|
||||||
ApplyStencilTest();
|
ApplyStencilTest();
|
||||||
ApplySRgb();
|
ApplySRgb();
|
||||||
ApplyDepth();
|
|
||||||
ApplyBlending();
|
ApplyBlending();
|
||||||
ApplyTextures();
|
ApplyTextures();
|
||||||
ApplySamplers();
|
ApplySamplers();
|
||||||
|
@ -31,12 +31,6 @@ public:
|
|||||||
bool near_plane = false;
|
bool near_plane = false;
|
||||||
} depth_clamp; // GL_DEPTH_CLAMP
|
} depth_clamp; // GL_DEPTH_CLAMP
|
||||||
|
|
||||||
struct {
|
|
||||||
bool test_enabled = false; // GL_DEPTH_TEST
|
|
||||||
GLboolean write_mask = GL_TRUE; // GL_DEPTH_WRITEMASK
|
|
||||||
GLenum test_func = GL_LESS; // GL_DEPTH_FUNC
|
|
||||||
} depth;
|
|
||||||
|
|
||||||
bool rasterizer_discard = false; // GL_RASTERIZER_DISCARD
|
bool rasterizer_discard = false; // GL_RASTERIZER_DISCARD
|
||||||
|
|
||||||
struct ColorMask {
|
struct ColorMask {
|
||||||
@ -137,7 +131,6 @@ public:
|
|||||||
void ApplySRgb();
|
void ApplySRgb();
|
||||||
void ApplyRasterizerDiscard();
|
void ApplyRasterizerDiscard();
|
||||||
void ApplyColorMask();
|
void ApplyColorMask();
|
||||||
void ApplyDepth();
|
|
||||||
void ApplyStencilTest();
|
void ApplyStencilTest();
|
||||||
void ApplyViewport();
|
void ApplyViewport();
|
||||||
void ApplyTargetBlending(std::size_t target, bool force);
|
void ApplyTargetBlending(std::size_t target, bool force);
|
||||||
|
@ -576,6 +576,7 @@ void RendererOpenGL::DrawScreenTriangles(const ScreenInfo& screen_info, float x,
|
|||||||
glEnable(GL_CULL_FACE);
|
glEnable(GL_CULL_FACE);
|
||||||
glDisable(GL_COLOR_LOGIC_OP);
|
glDisable(GL_COLOR_LOGIC_OP);
|
||||||
glDisable(GL_ALPHA_TEST);
|
glDisable(GL_ALPHA_TEST);
|
||||||
|
glDisable(GL_DEPTH_TEST);
|
||||||
glDisable(GL_POLYGON_OFFSET_FILL);
|
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||||
glCullFace(GL_BACK);
|
glCullFace(GL_BACK);
|
||||||
glFrontFace(GL_CW);
|
glFrontFace(GL_CW);
|
||||||
|
Loading…
Reference in New Issue
Block a user