yuzu-emu
/
yuzu
Archived
1
0
Fork 0

gl_state: Remove depth tracking

This commit is contained in:
ReinUsesLisp 2019-12-25 21:52:39 -03:00
parent 0f343d32c4
commit e1a16a52fa
4 changed files with 7 additions and 34 deletions

View File

@ -446,12 +446,8 @@ void RasterizerOpenGL::Clear() {
ASSERT_MSG(regs.zeta_enable != 0, "Tried to clear Z but buffer is not enabled!");
use_depth = true;
// Always enable the depth write when clearing the depth buffer. The depth write mask is
// ignored when clearing the buffer in the Switch, but OpenGL obeys it so we set it to
// true.
clear_state.depth.test_enabled = true;
clear_state.depth.test_func = GL_ALWAYS;
clear_state.depth.write_mask = GL_TRUE;
// TODO: Signal state tracker about these changes
glDepthMask(GL_TRUE);
}
if (regs.clear_buffers.S) {
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() {
const auto& regs = system.GPU().Maxwell3D().regs;
state.depth.test_enabled = regs.depth_test_enable != 0;
state.depth.write_mask = regs.depth_write_enabled ? GL_TRUE : GL_FALSE;
glDepthMask(regs.depth_write_enabled ? GL_TRUE : GL_FALSE);
if (!state.depth.test_enabled) {
return;
oglEnable(GL_DEPTH_TEST, regs.depth_test_enable);
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() {

View File

@ -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() {
Enable(GL_STENCIL_TEST, cur_state.stencil.test_enabled, stencil.test_enabled);
@ -380,7 +366,6 @@ void OpenGLState::Apply() {
ApplyViewport();
ApplyStencilTest();
ApplySRgb();
ApplyDepth();
ApplyBlending();
ApplyTextures();
ApplySamplers();

View File

@ -31,12 +31,6 @@ public:
bool near_plane = false;
} 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
struct ColorMask {
@ -137,7 +131,6 @@ public:
void ApplySRgb();
void ApplyRasterizerDiscard();
void ApplyColorMask();
void ApplyDepth();
void ApplyStencilTest();
void ApplyViewport();
void ApplyTargetBlending(std::size_t target, bool force);

View File

@ -576,6 +576,7 @@ void RendererOpenGL::DrawScreenTriangles(const ScreenInfo& screen_info, float x,
glEnable(GL_CULL_FACE);
glDisable(GL_COLOR_LOGIC_OP);
glDisable(GL_ALPHA_TEST);
glDisable(GL_DEPTH_TEST);
glDisable(GL_POLYGON_OFFSET_FILL);
glCullFace(GL_BACK);
glFrontFace(GL_CW);