diff options
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 20 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 7 |
2 files changed, 23 insertions, 4 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 81b6099f9..2d2bbd6ac 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -968,18 +968,27 @@ Surface RasterizerCacheOpenGL::GetColorBufferSurface(std::size_t index, bool pre | |||
| 968 | gpu.dirty_flags.color_buffer.reset(index); | 968 | gpu.dirty_flags.color_buffer.reset(index); |
| 969 | 969 | ||
| 970 | ASSERT(index < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets); | 970 | ASSERT(index < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets); |
| 971 | auto Notify = [&]() { | ||
| 972 | if (last_color_buffers[index] != current_color_buffers[index]) { | ||
| 973 | NotifyFrameBufferChange(current_color_buffers[index]); | ||
| 974 | } | ||
| 975 | last_color_buffers[index] = current_color_buffers[index]; | ||
| 976 | }; | ||
| 971 | 977 | ||
| 972 | if (index >= regs.rt_control.count) { | 978 | if (index >= regs.rt_control.count) { |
| 973 | return last_color_buffers[index] = {}; | 979 | Notify(); |
| 980 | return current_color_buffers[index] = {}; | ||
| 974 | } | 981 | } |
| 975 | 982 | ||
| 976 | if (regs.rt[index].Address() == 0 || regs.rt[index].format == Tegra::RenderTargetFormat::NONE) { | 983 | if (regs.rt[index].Address() == 0 || regs.rt[index].format == Tegra::RenderTargetFormat::NONE) { |
| 977 | return last_color_buffers[index] = {}; | 984 | Notify(); |
| 985 | return current_color_buffers[index] = {}; | ||
| 978 | } | 986 | } |
| 979 | 987 | ||
| 980 | const SurfaceParams color_params{SurfaceParams::CreateForFramebuffer(index)}; | 988 | const SurfaceParams color_params{SurfaceParams::CreateForFramebuffer(index)}; |
| 981 | 989 | ||
| 982 | return last_color_buffers[index] = GetSurface(color_params, preserve_contents); | 990 | Notify(); |
| 991 | return current_color_buffers[index] = GetSurface(color_params, preserve_contents); | ||
| 983 | } | 992 | } |
| 984 | 993 | ||
| 985 | void RasterizerCacheOpenGL::LoadSurface(const Surface& surface) { | 994 | void RasterizerCacheOpenGL::LoadSurface(const Surface& surface) { |
| @@ -1290,4 +1299,9 @@ Surface RasterizerCacheOpenGL::TryGetReservedSurface(const SurfaceParams& params | |||
| 1290 | return {}; | 1299 | return {}; |
| 1291 | } | 1300 | } |
| 1292 | 1301 | ||
| 1302 | void RasterizerCacheOpenGL::NotifyFrameBufferChange(Surface triggering_surface) { | ||
| 1303 | if (triggering_surface == nullptr) | ||
| 1304 | return; | ||
| 1305 | } | ||
| 1306 | |||
| 1293 | } // namespace OpenGL | 1307 | } // namespace OpenGL |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 838554c35..cc27fefb5 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h | |||
| @@ -34,6 +34,7 @@ using SurfaceTarget = VideoCore::Surface::SurfaceTarget; | |||
| 34 | using SurfaceType = VideoCore::Surface::SurfaceType; | 34 | using SurfaceType = VideoCore::Surface::SurfaceType; |
| 35 | using PixelFormat = VideoCore::Surface::PixelFormat; | 35 | using PixelFormat = VideoCore::Surface::PixelFormat; |
| 36 | using ComponentType = VideoCore::Surface::ComponentType; | 36 | using ComponentType = VideoCore::Surface::ComponentType; |
| 37 | using Maxwell = Tegra::Engines::Maxwell3D::Regs; | ||
| 37 | 38 | ||
| 38 | struct SurfaceParams { | 39 | struct SurfaceParams { |
| 39 | enum class SurfaceClass { | 40 | enum class SurfaceClass { |
| @@ -449,6 +450,9 @@ private: | |||
| 449 | /// Tries to get a reserved surface for the specified parameters | 450 | /// Tries to get a reserved surface for the specified parameters |
| 450 | Surface TryGetReservedSurface(const SurfaceParams& params); | 451 | Surface TryGetReservedSurface(const SurfaceParams& params); |
| 451 | 452 | ||
| 453 | /// When a render target is changed, this method is called with the previous render target | ||
| 454 | void NotifyFrameBufferChange(Surface triggering_surface); | ||
| 455 | |||
| 452 | /// Performs a slow but accurate surface copy, flushing to RAM and reinterpreting the data | 456 | /// Performs a slow but accurate surface copy, flushing to RAM and reinterpreting the data |
| 453 | void AccurateCopySurface(const Surface& src_surface, const Surface& dst_surface); | 457 | void AccurateCopySurface(const Surface& src_surface, const Surface& dst_surface); |
| 454 | void FastLayeredCopySurface(const Surface& src_surface, const Surface& dst_surface); | 458 | void FastLayeredCopySurface(const Surface& src_surface, const Surface& dst_surface); |
| @@ -469,7 +473,8 @@ private: | |||
| 469 | /// using the new format. | 473 | /// using the new format. |
| 470 | OGLBuffer copy_pbo; | 474 | OGLBuffer copy_pbo; |
| 471 | 475 | ||
| 472 | std::array<Surface, Tegra::Engines::Maxwell3D::Regs::NumRenderTargets> last_color_buffers; | 476 | std::array<Surface, Maxwell::NumRenderTargets> last_color_buffers; |
| 477 | std::array<Surface, Maxwell::NumRenderTargets> current_color_buffers; | ||
| 473 | Surface last_depth_buffer; | 478 | Surface last_depth_buffer; |
| 474 | }; | 479 | }; |
| 475 | 480 | ||