diff options
| author | 2019-01-07 02:22:00 -0300 | |
|---|---|---|
| committer | 2019-01-07 16:23:23 -0300 | |
| commit | 19cf9952252fc0f9c31037676b56b6d7716ffd2f (patch) | |
| tree | fef129c05d10e9113450aa486518ffea1d4cc878 /src | |
| parent | gl_rasterizer_cache: Use dirty flags for the depth buffer (diff) | |
| download | yuzu-19cf9952252fc0f9c31037676b56b6d7716ffd2f.tar.gz yuzu-19cf9952252fc0f9c31037676b56b6d7716ffd2f.tar.xz yuzu-19cf9952252fc0f9c31037676b56b6d7716ffd2f.zip | |
gl_rasterizer: Skip framebuffer configuration if rendertargets have not been changed
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 14 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.h | 18 |
2 files changed, 31 insertions, 1 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 37f01d4f7..aa8dab0c2 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -488,7 +488,19 @@ void RasterizerOpenGL::ConfigureFramebuffers(OpenGLState& current_state, bool us | |||
| 488 | bool using_depth_fb, bool preserve_contents, | 488 | bool using_depth_fb, bool preserve_contents, |
| 489 | std::optional<std::size_t> single_color_target) { | 489 | std::optional<std::size_t> single_color_target) { |
| 490 | MICROPROFILE_SCOPE(OpenGL_Framebuffer); | 490 | MICROPROFILE_SCOPE(OpenGL_Framebuffer); |
| 491 | const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs; | 491 | const auto& gpu = Core::System::GetInstance().GPU().Maxwell3D(); |
| 492 | const auto& regs = gpu.regs; | ||
| 493 | |||
| 494 | const FramebufferConfigState fb_config_state{using_color_fb, using_depth_fb, preserve_contents, | ||
| 495 | single_color_target}; | ||
| 496 | if (fb_config_state == current_framebuffer_config_state && gpu.dirty_flags.color_buffer == 0 && | ||
| 497 | !gpu.dirty_flags.zeta_buffer) { | ||
| 498 | // Only skip if the previous ConfigureFramebuffers call was from the same kind (multiple or | ||
| 499 | // single color targets). This is done because the guest registers may not change but the | ||
| 500 | // host framebuffer may contain different attachments | ||
| 501 | return; | ||
| 502 | } | ||
| 503 | current_framebuffer_config_state = fb_config_state; | ||
| 492 | 504 | ||
| 493 | Surface depth_surface; | 505 | Surface depth_surface; |
| 494 | if (using_depth_fb) { | 506 | if (using_depth_fb) { |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index 8a891ffc7..45c988816 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h | |||
| @@ -94,6 +94,23 @@ private: | |||
| 94 | float max_anisotropic = 1.0f; | 94 | float max_anisotropic = 1.0f; |
| 95 | }; | 95 | }; |
| 96 | 96 | ||
| 97 | struct FramebufferConfigState { | ||
| 98 | bool using_color_fb{}; | ||
| 99 | bool using_depth_fb{}; | ||
| 100 | bool preserve_contents{}; | ||
| 101 | std::optional<std::size_t> single_color_target; | ||
| 102 | |||
| 103 | bool operator==(const FramebufferConfigState& rhs) const { | ||
| 104 | return std::tie(using_color_fb, using_depth_fb, preserve_contents, | ||
| 105 | single_color_target) == std::tie(rhs.using_color_fb, rhs.using_depth_fb, | ||
| 106 | rhs.preserve_contents, | ||
| 107 | rhs.single_color_target); | ||
| 108 | } | ||
| 109 | bool operator!=(const FramebufferConfigState& rhs) const { | ||
| 110 | return !operator==(rhs); | ||
| 111 | } | ||
| 112 | }; | ||
| 113 | |||
| 97 | /** | 114 | /** |
| 98 | * Configures the color and depth framebuffer states. | 115 | * Configures the color and depth framebuffer states. |
| 99 | * @param use_color_fb If true, configure color framebuffers. | 116 | * @param use_color_fb If true, configure color framebuffers. |
| @@ -197,6 +214,7 @@ private: | |||
| 197 | vertex_array_cache; | 214 | vertex_array_cache; |
| 198 | 215 | ||
| 199 | std::map<FramebufferCacheKey, OGLFramebuffer> framebuffer_cache; | 216 | std::map<FramebufferCacheKey, OGLFramebuffer> framebuffer_cache; |
| 217 | FramebufferConfigState current_framebuffer_config_state; | ||
| 200 | 218 | ||
| 201 | std::array<SamplerInfo, Tegra::Engines::Maxwell3D::Regs::NumTextureSamplers> texture_samplers; | 219 | std::array<SamplerInfo, Tegra::Engines::Maxwell3D::Regs::NumTextureSamplers> texture_samplers; |
| 202 | 220 | ||