summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Rodolfo Bogado2018-11-26 20:45:21 -0300
committerGravatar Rodolfo Bogado2018-11-26 20:45:21 -0300
commit8e971f5062023e6710bcfe66d9ca740498ff4b97 (patch)
tree3918c554f9c17739df2caf7587f07b31b200b657
parentMerge pull request #1794 from Tinob/master (diff)
downloadyuzu-8e971f5062023e6710bcfe66d9ca740498ff4b97.tar.gz
yuzu-8e971f5062023e6710bcfe66d9ca740498ff4b97.tar.xz
yuzu-8e971f5062023e6710bcfe66d9ca740498ff4b97.zip
Add support for Clip Distance enabled register
-rw-r--r--src/video_core/engines/maxwell_3d.h16
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp11
-rw-r--r--src/video_core/renderer_opengl/gl_state.h2
3 files changed, 26 insertions, 3 deletions
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h
index 9324d9710..5ee383764 100644
--- a/src/video_core/engines/maxwell_3d.h
+++ b/src/video_core/engines/maxwell_3d.h
@@ -744,7 +744,20 @@ public:
744 744
745 u32 vb_element_base; 745 u32 vb_element_base;
746 746
747 INSERT_PADDING_WORDS(0x38); 747 INSERT_PADDING_WORDS(0x36);
748
749 union {
750 BitField<0, 1, u32> c0;
751 BitField<1, 1, u32> c1;
752 BitField<2, 1, u32> c2;
753 BitField<3, 1, u32> c3;
754 BitField<4, 1, u32> c4;
755 BitField<5, 1, u32> c5;
756 BitField<6, 1, u32> c6;
757 BitField<7, 1, u32> c7;
758 } clip_distance_enabled;
759
760 INSERT_PADDING_WORDS(0x1);
748 761
749 float point_size; 762 float point_size;
750 763
@@ -1201,6 +1214,7 @@ ASSERT_REG_POSITION(stencil_front_mask, 0x4E7);
1201ASSERT_REG_POSITION(frag_color_clamp, 0x4EA); 1214ASSERT_REG_POSITION(frag_color_clamp, 0x4EA);
1202ASSERT_REG_POSITION(screen_y_control, 0x4EB); 1215ASSERT_REG_POSITION(screen_y_control, 0x4EB);
1203ASSERT_REG_POSITION(vb_element_base, 0x50D); 1216ASSERT_REG_POSITION(vb_element_base, 0x50D);
1217ASSERT_REG_POSITION(clip_distance_enabled, 0x544);
1204ASSERT_REG_POSITION(point_size, 0x546); 1218ASSERT_REG_POSITION(point_size, 0x546);
1205ASSERT_REG_POSITION(zeta_enable, 0x54E); 1219ASSERT_REG_POSITION(zeta_enable, 0x54E);
1206ASSERT_REG_POSITION(multisample_control, 0x54F); 1220ASSERT_REG_POSITION(multisample_control, 0x54F);
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 98fb5a9aa..edb285a66 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -628,6 +628,7 @@ void RasterizerOpenGL::DrawArrays() {
628 SyncCullMode(); 628 SyncCullMode();
629 SyncPrimitiveRestart(); 629 SyncPrimitiveRestart();
630 SyncScissorTest(state); 630 SyncScissorTest(state);
631 SyncClipEnabled();
631 // Alpha Testing is synced on shaders. 632 // Alpha Testing is synced on shaders.
632 SyncTransformFeedback(); 633 SyncTransformFeedback();
633 SyncPointState(); 634 SyncPointState();
@@ -1010,7 +1011,15 @@ void RasterizerOpenGL::SyncViewport(OpenGLState& current_state) {
1010} 1011}
1011 1012
1012void RasterizerOpenGL::SyncClipEnabled() { 1013void RasterizerOpenGL::SyncClipEnabled() {
1013 UNREACHABLE(); 1014 const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs;
1015 state.clip_distance[0] = regs.clip_distance_enabled.c0 != 0;
1016 state.clip_distance[1] = regs.clip_distance_enabled.c1 != 0;
1017 state.clip_distance[2] = regs.clip_distance_enabled.c2 != 0;
1018 state.clip_distance[3] = regs.clip_distance_enabled.c3 != 0;
1019 state.clip_distance[4] = regs.clip_distance_enabled.c4 != 0;
1020 state.clip_distance[5] = regs.clip_distance_enabled.c5 != 0;
1021 state.clip_distance[6] = regs.clip_distance_enabled.c6 != 0;
1022 state.clip_distance[7] = regs.clip_distance_enabled.c7 != 0;
1014} 1023}
1015 1024
1016void RasterizerOpenGL::SyncClipCoef() { 1025void RasterizerOpenGL::SyncClipCoef() {
diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h
index 0bf19ed07..ad29aade6 100644
--- a/src/video_core/renderer_opengl/gl_state.h
+++ b/src/video_core/renderer_opengl/gl_state.h
@@ -185,7 +185,7 @@ public:
185 GLfloat clamp; 185 GLfloat clamp;
186 } polygon_offset; 186 } polygon_offset;
187 187
188 std::array<bool, 2> clip_distance; // GL_CLIP_DISTANCE 188 std::array<bool, 8> clip_distance; // GL_CLIP_DISTANCE
189 189
190 OpenGLState(); 190 OpenGLState();
191 191