diff options
| author | 2020-01-02 22:41:20 -0300 | |
|---|---|---|
| committer | 2020-02-28 17:56:43 -0300 | |
| commit | 2eeea907138926e7d712bf20f92c1f3d1cc2d594 (patch) | |
| tree | c5086c7c9394ec8a4bccc4957870720f398f28ba /src | |
| parent | gl_rasterizer: Disable scissor 0 when scissor is not used on clear (diff) | |
| download | yuzu-2eeea907138926e7d712bf20f92c1f3d1cc2d594.tar.gz yuzu-2eeea907138926e7d712bf20f92c1f3d1cc2d594.tar.xz yuzu-2eeea907138926e7d712bf20f92c1f3d1cc2d594.zip | |
gl_state_tracker: Implement dirty flags for depth clamp enabling
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 12 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_state_tracker.cpp | 5 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_state_tracker.h | 1 |
3 files changed, 15 insertions, 3 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index e035be867..3ffa9988e 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -493,6 +493,7 @@ void RasterizerOpenGL::Draw(bool is_indexed, bool is_instanced) { | |||
| 493 | SyncFragmentColorClampState(); | 493 | SyncFragmentColorClampState(); |
| 494 | SyncMultiSampleState(); | 494 | SyncMultiSampleState(); |
| 495 | SyncDepthTestState(); | 495 | SyncDepthTestState(); |
| 496 | SyncDepthClamp(); | ||
| 496 | SyncStencilTestState(); | 497 | SyncStencilTestState(); |
| 497 | SyncBlendState(); | 498 | SyncBlendState(); |
| 498 | SyncLogicOpState(); | 499 | SyncLogicOpState(); |
| @@ -967,11 +968,16 @@ void RasterizerOpenGL::SyncViewport() { | |||
| 967 | } | 968 | } |
| 968 | 969 | ||
| 969 | void RasterizerOpenGL::SyncDepthClamp() { | 970 | void RasterizerOpenGL::SyncDepthClamp() { |
| 970 | const auto& regs = system.GPU().Maxwell3D().regs; | 971 | auto& gpu = system.GPU().Maxwell3D(); |
| 971 | const auto& state = regs.view_volume_clip_control; | 972 | auto& flags = gpu.dirty.flags; |
| 973 | if (!flags[Dirty::DepthClampEnabled]) { | ||
| 974 | return; | ||
| 975 | } | ||
| 976 | flags[Dirty::DepthClampEnabled] = false; | ||
| 972 | 977 | ||
| 978 | const auto& state = gpu.regs.view_volume_clip_control; | ||
| 973 | UNIMPLEMENTED_IF_MSG(state.depth_clamp_far != state.depth_clamp_near, | 979 | UNIMPLEMENTED_IF_MSG(state.depth_clamp_far != state.depth_clamp_near, |
| 974 | "Unimplemented Depth clamp separation!"); | 980 | "Unimplemented depth clamp separation!"); |
| 975 | 981 | ||
| 976 | oglEnable(GL_DEPTH_CLAMP, state.depth_clamp_far || state.depth_clamp_near); | 982 | oglEnable(GL_DEPTH_CLAMP, state.depth_clamp_far || state.depth_clamp_near); |
| 977 | } | 983 | } |
diff --git a/src/video_core/renderer_opengl/gl_state_tracker.cpp b/src/video_core/renderer_opengl/gl_state_tracker.cpp index 3d64b1ea4..fa8733028 100644 --- a/src/video_core/renderer_opengl/gl_state_tracker.cpp +++ b/src/video_core/renderer_opengl/gl_state_tracker.cpp | |||
| @@ -217,6 +217,10 @@ void SetupDirtyClipControl(Tables& tables) { | |||
| 217 | table[OFF(depth_mode)] = ClipControl; | 217 | table[OFF(depth_mode)] = ClipControl; |
| 218 | } | 218 | } |
| 219 | 219 | ||
| 220 | void SetupDirtyDepthClampEnabled(Tables& tables) { | ||
| 221 | tables[0][OFF(view_volume_clip_control)] = DepthClampEnabled; | ||
| 222 | } | ||
| 223 | |||
| 220 | void SetupDirtyMisc(Tables& tables) { | 224 | void SetupDirtyMisc(Tables& tables) { |
| 221 | auto& table = tables[0]; | 225 | auto& table = tables[0]; |
| 222 | 226 | ||
| @@ -255,6 +259,7 @@ void StateTracker::Initialize() { | |||
| 255 | SetupDirtyFragmentClampColor(tables); | 259 | SetupDirtyFragmentClampColor(tables); |
| 256 | SetupDirtyPointSize(tables); | 260 | SetupDirtyPointSize(tables); |
| 257 | SetupDirtyClipControl(tables); | 261 | SetupDirtyClipControl(tables); |
| 262 | SetupDirtyDepthClampEnabled(tables); | ||
| 258 | SetupDirtyMisc(tables); | 263 | SetupDirtyMisc(tables); |
| 259 | 264 | ||
| 260 | auto& store = dirty.on_write_stores; | 265 | auto& store = dirty.on_write_stores; |
diff --git a/src/video_core/renderer_opengl/gl_state_tracker.h b/src/video_core/renderer_opengl/gl_state_tracker.h index a390e0b99..38b38c4a7 100644 --- a/src/video_core/renderer_opengl/gl_state_tracker.h +++ b/src/video_core/renderer_opengl/gl_state_tracker.h | |||
| @@ -75,6 +75,7 @@ enum : u8 { | |||
| 75 | FragmentClampColor, | 75 | FragmentClampColor, |
| 76 | PointSize, | 76 | PointSize, |
| 77 | ClipControl, | 77 | ClipControl, |
| 78 | DepthClampEnabled, | ||
| 78 | 79 | ||
| 79 | Last | 80 | Last |
| 80 | }; | 81 | }; |