summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp26
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.h10
2 files changed, 20 insertions, 16 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 6bc0dbd38..6f05f24a0 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -349,6 +349,9 @@ void RasterizerOpenGL::DrawArrays() {
349 // Sync the viewport 349 // Sync the viewport
350 SyncViewport(surfaces_rect, res_scale); 350 SyncViewport(surfaces_rect, res_scale);
351 351
352 // Sync the blend state registers
353 SyncBlendState();
354
352 // TODO(bunnei): Sync framebuffer_scale uniform here 355 // TODO(bunnei): Sync framebuffer_scale uniform here
353 // TODO(bunnei): Sync scissorbox uniform(s) here 356 // TODO(bunnei): Sync scissorbox uniform(s) here
354 357
@@ -735,14 +738,21 @@ void RasterizerOpenGL::SyncDepthOffset() {
735 UNREACHABLE(); 738 UNREACHABLE();
736} 739}
737 740
738void RasterizerOpenGL::SyncBlendEnabled() { 741void RasterizerOpenGL::SyncBlendState() {
739 UNREACHABLE(); 742 const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs;
740} 743 ASSERT_MSG(regs.independent_blend_enable == 1, "Only independent blending is implemented");
741 744
742void RasterizerOpenGL::SyncBlendFuncs() { 745 // TODO(Subv): Support more than just render target 0.
743 UNREACHABLE(); 746 state.blend.enabled = regs.blend.enable[0] != 0;
744}
745 747
746void RasterizerOpenGL::SyncBlendColor() { 748 if (!state.blend.enabled)
747 UNREACHABLE(); 749 return;
750
751 ASSERT_MSG(!regs.independent_blend[0].separate_alpha, "Unimplemented");
752 state.blend.rgb_equation = MaxwellToGL::BlendEquation(regs.independent_blend[0].equation_rgb);
753 state.blend.src_rgb_func = MaxwellToGL::BlendFunc(regs.independent_blend[0].factor_source_rgb);
754 state.blend.dst_rgb_func = MaxwellToGL::BlendFunc(regs.independent_blend[0].factor_dest_rgb);
755 state.blend.a_equation = MaxwellToGL::BlendEquation(regs.independent_blend[0].equation_a);
756 state.blend.src_a_func = MaxwellToGL::BlendFunc(regs.independent_blend[0].factor_source_a);
757 state.blend.dst_a_func = MaxwellToGL::BlendFunc(regs.independent_blend[0].factor_dest_a);
748} 758}
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h
index d3f0558ed..b7c8cf843 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer.h
@@ -121,14 +121,8 @@ private:
121 /// Syncs the depth offset to match the guest state 121 /// Syncs the depth offset to match the guest state
122 void SyncDepthOffset(); 122 void SyncDepthOffset();
123 123
124 /// Syncs the blend enabled status to match the guest state 124 /// Syncs the blend state to match the guest state
125 void SyncBlendEnabled(); 125 void SyncBlendState();
126
127 /// Syncs the blend functions to match the guest state
128 void SyncBlendFuncs();
129
130 /// Syncs the blend color to match the guest state
131 void SyncBlendColor();
132 126
133 bool has_ARB_buffer_storage; 127 bool has_ARB_buffer_storage;
134 bool has_ARB_direct_state_access; 128 bool has_ARB_direct_state_access;