summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/video_core/engines/maxwell_3d.cpp6
-rw-r--r--src/video_core/engines/maxwell_3d.h7
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp7
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.h3
-rw-r--r--src/video_core/renderer_opengl/gl_state.cpp5
-rw-r--r--src/video_core/renderer_opengl/gl_state.h4
6 files changed, 28 insertions, 4 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index 15a7a9d6a..e1cb8b0b0 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -88,11 +88,11 @@ void Maxwell3D::InitializeRegisterDefaults() {
88 color_mask.A.Assign(1); 88 color_mask.A.Assign(1);
89 } 89 }
90 90
91 // Commercial games seem to assume this value is enabled and nouveau sets this value manually. 91 // NVN games expect these values to be enabled at boot
92 regs.rasterize_enable = 1;
92 regs.rt_separate_frag_data = 1; 93 regs.rt_separate_frag_data = 1;
93
94 // Some games (like Super Mario Odyssey) assume that SRGB is enabled.
95 regs.framebuffer_srgb = 1; 94 regs.framebuffer_srgb = 1;
95
96 mme_inline[MAXWELL3D_REG_INDEX(draw.vertex_end_gl)] = true; 96 mme_inline[MAXWELL3D_REG_INDEX(draw.vertex_end_gl)] = true;
97 mme_inline[MAXWELL3D_REG_INDEX(draw.vertex_begin_gl)] = true; 97 mme_inline[MAXWELL3D_REG_INDEX(draw.vertex_begin_gl)] = true;
98 mme_inline[MAXWELL3D_REG_INDEX(vertex_buffer.count)] = true; 98 mme_inline[MAXWELL3D_REG_INDEX(vertex_buffer.count)] = true;
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h
index 2bd10cee5..a35e7a195 100644
--- a/src/video_core/engines/maxwell_3d.h
+++ b/src/video_core/engines/maxwell_3d.h
@@ -657,7 +657,11 @@ public:
657 std::array<f32, 4> tess_level_outer; 657 std::array<f32, 4> tess_level_outer;
658 std::array<f32, 2> tess_level_inner; 658 std::array<f32, 2> tess_level_inner;
659 659
660 INSERT_UNION_PADDING_WORDS(0x102); 660 INSERT_UNION_PADDING_WORDS(0x10);
661
662 u32 rasterize_enable;
663
664 INSERT_UNION_PADDING_WORDS(0xF1);
661 665
662 u32 tfb_enabled; 666 u32 tfb_enabled;
663 667
@@ -1427,6 +1431,7 @@ ASSERT_REG_POSITION(sync_info, 0xB2);
1427ASSERT_REG_POSITION(tess_mode, 0xC8); 1431ASSERT_REG_POSITION(tess_mode, 0xC8);
1428ASSERT_REG_POSITION(tess_level_outer, 0xC9); 1432ASSERT_REG_POSITION(tess_level_outer, 0xC9);
1429ASSERT_REG_POSITION(tess_level_inner, 0xCD); 1433ASSERT_REG_POSITION(tess_level_inner, 0xCD);
1434ASSERT_REG_POSITION(rasterize_enable, 0xDF);
1430ASSERT_REG_POSITION(tfb_enabled, 0x1D1); 1435ASSERT_REG_POSITION(tfb_enabled, 0x1D1);
1431ASSERT_REG_POSITION(rt, 0x200); 1436ASSERT_REG_POSITION(rt, 0x200);
1432ASSERT_REG_POSITION(viewport_transform, 0x280); 1437ASSERT_REG_POSITION(viewport_transform, 0x280);
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index f20967d85..dbb08dd80 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -514,6 +514,7 @@ void RasterizerOpenGL::Clear() {
514 ConfigureClearFramebuffer(clear_state, use_color, use_depth, use_stencil); 514 ConfigureClearFramebuffer(clear_state, use_color, use_depth, use_stencil);
515 515
516 SyncViewport(clear_state); 516 SyncViewport(clear_state);
517 SyncRasterizeEnable(clear_state);
517 if (regs.clear_flags.scissor) { 518 if (regs.clear_flags.scissor) {
518 SyncScissorTest(clear_state); 519 SyncScissorTest(clear_state);
519 } 520 }
@@ -541,6 +542,7 @@ void RasterizerOpenGL::Clear() {
541void RasterizerOpenGL::DrawPrelude() { 542void RasterizerOpenGL::DrawPrelude() {
542 auto& gpu = system.GPU().Maxwell3D(); 543 auto& gpu = system.GPU().Maxwell3D();
543 544
545 SyncRasterizeEnable(state);
544 SyncColorMask(); 546 SyncColorMask();
545 SyncFragmentColorClampState(); 547 SyncFragmentColorClampState();
546 SyncMultiSampleState(); 548 SyncMultiSampleState();
@@ -1133,6 +1135,11 @@ void RasterizerOpenGL::SyncStencilTestState() {
1133 } 1135 }
1134} 1136}
1135 1137
1138void RasterizerOpenGL::SyncRasterizeEnable(OpenGLState& current_state) {
1139 const auto& regs = system.GPU().Maxwell3D().regs;
1140 current_state.rasterizer_discard = regs.rasterize_enable == 0;
1141}
1142
1136void RasterizerOpenGL::SyncColorMask() { 1143void RasterizerOpenGL::SyncColorMask() {
1137 auto& maxwell3d = system.GPU().Maxwell3D(); 1144 auto& maxwell3d = system.GPU().Maxwell3D();
1138 if (!maxwell3d.dirty.color_mask) { 1145 if (!maxwell3d.dirty.color_mask) {
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h
index 04c1ca551..6a27cf497 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer.h
@@ -168,6 +168,9 @@ private:
168 /// Syncs the point state to match the guest state 168 /// Syncs the point state to match the guest state
169 void SyncPointState(); 169 void SyncPointState();
170 170
171 /// Syncs the rasterizer enable state to match the guest state
172 void SyncRasterizeEnable(OpenGLState& current_state);
173
171 /// Syncs Color Mask 174 /// Syncs Color Mask
172 void SyncColorMask(); 175 void SyncColorMask();
173 176
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp
index ccc1e050a..df2e2395a 100644
--- a/src/video_core/renderer_opengl/gl_state.cpp
+++ b/src/video_core/renderer_opengl/gl_state.cpp
@@ -182,6 +182,10 @@ void OpenGLState::ApplyCulling() {
182 } 182 }
183} 183}
184 184
185void OpenGLState::ApplyRasterizerDiscard() {
186 Enable(GL_RASTERIZER_DISCARD, cur_state.rasterizer_discard, rasterizer_discard);
187}
188
185void OpenGLState::ApplyColorMask() { 189void OpenGLState::ApplyColorMask() {
186 if (!dirty.color_mask) { 190 if (!dirty.color_mask) {
187 return; 191 return;
@@ -455,6 +459,7 @@ void OpenGLState::Apply() {
455 ApplyPointSize(); 459 ApplyPointSize();
456 ApplyFragmentColorClamp(); 460 ApplyFragmentColorClamp();
457 ApplyMultisample(); 461 ApplyMultisample();
462 ApplyRasterizerDiscard();
458 ApplyColorMask(); 463 ApplyColorMask();
459 ApplyDepthClamp(); 464 ApplyDepthClamp();
460 ApplyViewport(); 465 ApplyViewport();
diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h
index 0b5895084..fb180f302 100644
--- a/src/video_core/renderer_opengl/gl_state.h
+++ b/src/video_core/renderer_opengl/gl_state.h
@@ -48,6 +48,8 @@ public:
48 GLuint index = 0; 48 GLuint index = 0;
49 } primitive_restart; // GL_PRIMITIVE_RESTART 49 } primitive_restart; // GL_PRIMITIVE_RESTART
50 50
51 bool rasterizer_discard = false; // GL_RASTERIZER_DISCARD
52
51 struct ColorMask { 53 struct ColorMask {
52 GLboolean red_enabled = GL_TRUE; 54 GLboolean red_enabled = GL_TRUE;
53 GLboolean green_enabled = GL_TRUE; 55 GLboolean green_enabled = GL_TRUE;
@@ -56,6 +58,7 @@ public:
56 }; 58 };
57 std::array<ColorMask, Tegra::Engines::Maxwell3D::Regs::NumRenderTargets> 59 std::array<ColorMask, Tegra::Engines::Maxwell3D::Regs::NumRenderTargets>
58 color_mask; // GL_COLOR_WRITEMASK 60 color_mask; // GL_COLOR_WRITEMASK
61
59 struct { 62 struct {
60 bool test_enabled = false; // GL_STENCIL_TEST 63 bool test_enabled = false; // GL_STENCIL_TEST
61 struct { 64 struct {
@@ -174,6 +177,7 @@ public:
174 void ApplyMultisample(); 177 void ApplyMultisample();
175 void ApplySRgb(); 178 void ApplySRgb();
176 void ApplyCulling(); 179 void ApplyCulling();
180 void ApplyRasterizerDiscard();
177 void ApplyColorMask(); 181 void ApplyColorMask();
178 void ApplyDepth(); 182 void ApplyDepth();
179 void ApplyPrimitiveRestart(); 183 void ApplyPrimitiveRestart();