diff options
author | bunnei <bunneidev@gmail.com> | 2018-07-03 03:24:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-03 03:24:43 +0200 |
commit | 92c713506542d5e628a5495943792b11e8de5c20 (patch) | |
tree | 1b46282f09e46b163be059965aaf1dc410ba1be4 /src/video_core/renderer_opengl/gl_rasterizer.cpp | |
parent | Merge pull request #606 from Subv/base_vertex (diff) | |
parent | GPU: Set up the culling configuration on each draw. (diff) | |
download | yuzu-92c713506542d5e628a5495943792b11e8de5c20.tar yuzu-92c713506542d5e628a5495943792b11e8de5c20.tar.gz yuzu-92c713506542d5e628a5495943792b11e8de5c20.tar.bz2 yuzu-92c713506542d5e628a5495943792b11e8de5c20.tar.lz yuzu-92c713506542d5e628a5495943792b11e8de5c20.tar.xz yuzu-92c713506542d5e628a5495943792b11e8de5c20.tar.zst yuzu-92c713506542d5e628a5495943792b11e8de5c20.zip |
Diffstat (limited to 'src/video_core/renderer_opengl/gl_rasterizer.cpp')
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 324c28d1b..ca3814cfc 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -304,10 +304,15 @@ void RasterizerOpenGL::DrawArrays() { MICROPROFILE_SCOPE(OpenGL_Drawing); const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs; - // TODO(bunnei): Implement these + // Sync the depth test state before configuring the framebuffer surfaces. + SyncDepthTestState(); + + // TODO(bunnei): Implement this const bool has_stencil = false; + const bool using_color_fb = true; - const bool using_depth_fb = false; + const bool using_depth_fb = regs.zeta.Address() != 0; + const MathUtil::Rectangle<s32> viewport_rect{regs.viewport_transform[0].GetRect()}; const bool write_color_fb = @@ -338,11 +343,9 @@ void RasterizerOpenGL::DrawArrays() { // Bind the framebuffer surfaces BindFramebufferSurfaces(color_surface, depth_surface, has_stencil); - // Sync the viewport SyncViewport(surfaces_rect); - - // Sync the blend state registers SyncBlendState(); + SyncCullMode(); // TODO(bunnei): Sync framebuffer_scale uniform here // TODO(bunnei): Sync scissorbox uniform(s) here @@ -712,7 +715,11 @@ void RasterizerOpenGL::SyncClipCoef() { } void RasterizerOpenGL::SyncCullMode() { - UNREACHABLE(); + const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs; + + state.cull.enabled = regs.cull.enabled != 0; + state.cull.front_face = MaxwellToGL::FrontFace(regs.cull.front_face); + state.cull.mode = MaxwellToGL::CullFace(regs.cull.cull_face); } void RasterizerOpenGL::SyncDepthScale() { @@ -723,6 +730,14 @@ void RasterizerOpenGL::SyncDepthOffset() { 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() { const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs; |