1
0
Fork 0
forked from suyu/suyu

GPU: Set up the depth test state on every draw.

This commit is contained in:
Subv 2018-07-02 13:33:06 -05:00
parent d480b63e0d
commit 18c8ae7750
2 changed files with 14 additions and 0 deletions

View file

@ -304,6 +304,9 @@ void RasterizerOpenGL::DrawArrays() {
MICROPROFILE_SCOPE(OpenGL_Drawing); MICROPROFILE_SCOPE(OpenGL_Drawing);
const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs; const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs;
// Sync the depth test state before configuring the framebuffer surfaces.
SyncDepthTestState();
// TODO(bunnei): Implement these // TODO(bunnei): Implement these
const bool has_stencil = false; const bool has_stencil = false;
const bool using_color_fb = true; const bool using_color_fb = true;
@ -719,6 +722,14 @@ void RasterizerOpenGL::SyncDepthOffset() {
UNREACHABLE(); UNREACHABLE();
} }
void RasterizerOpenGL::SyncDepthTestState() {
const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs;
state.depth.test_enabled = regs.depth_test_enable != 0;
state.depth.write_mask = regs.depth_write_enabled ? GL_TRUE : GL_FALSE;
state.depth.test_func = MaxwellToGL::ComparisonOp(regs.depth_test_func);
}
void RasterizerOpenGL::SyncBlendState() { void RasterizerOpenGL::SyncBlendState() {
const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs; const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs;

View file

@ -126,6 +126,9 @@ private:
/// Syncs the depth offset to match the guest state /// Syncs the depth offset to match the guest state
void SyncDepthOffset(); void SyncDepthOffset();
/// Syncs the depth test state to match the guest state
void SyncDepthTestState();
/// Syncs the blend state to match the guest state /// Syncs the blend state to match the guest state
void SyncBlendState(); void SyncBlendState();