diff options
author | bunnei <bunneidev@gmail.com> | 2018-03-23 20:49:04 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2018-03-23 20:49:04 +0100 |
commit | 054393917e99d307eea0aabc78c0c6e5e709b2c7 (patch) | |
tree | 9e497f01b4cbb18deb1e7afc9979954b60ee848b /src/video_core | |
parent | memory: Fix typo in RasterizerFlushVirtualRegion. (diff) | |
download | yuzu-054393917e99d307eea0aabc78c0c6e5e709b2c7.tar yuzu-054393917e99d307eea0aabc78c0c6e5e709b2c7.tar.gz yuzu-054393917e99d307eea0aabc78c0c6e5e709b2c7.tar.bz2 yuzu-054393917e99d307eea0aabc78c0c6e5e709b2c7.tar.lz yuzu-054393917e99d307eea0aabc78c0c6e5e709b2c7.tar.xz yuzu-054393917e99d307eea0aabc78c0c6e5e709b2c7.tar.zst yuzu-054393917e99d307eea0aabc78c0c6e5e709b2c7.zip |
Diffstat (limited to 'src/video_core')
-rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index ef63cbcf0..4628f6db0 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -137,9 +137,15 @@ void RendererOpenGL::SwapBuffers(boost::optional<const Tegra::FramebufferConfig& */ void RendererOpenGL::LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuffer, ScreenInfo& screen_info) { - const u32 bpp{Tegra::FramebufferConfig::BytesPerPixel(framebuffer.pixel_format)}; - const u32 size_in_bytes{framebuffer.stride * framebuffer.height * bpp}; - const VAddr framebuffer_addr{framebuffer.address}; + const u32 bytes_per_pixel{Tegra::FramebufferConfig::BytesPerPixel(framebuffer.pixel_format)}; + const u64 size_in_bytes{framebuffer.stride * framebuffer.height * bytes_per_pixel}; + const VAddr framebuffer_addr{framebuffer.address + framebuffer.offset}; + + // TODO(bunnei): The framebuffer region should only be flushed and invalidated if it is + // written to, not every frame. When we find the right place for this, the below line can be + // removed. + Memory::RasterizerFlushVirtualRegion(framebuffer_addr, size_in_bytes, + Memory::FlushMode::FlushAndInvalidate); // Framebuffer orientation handling framebuffer_transform_flags = framebuffer.transform_flags; @@ -154,10 +160,10 @@ void RendererOpenGL::LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuf screen_info.display_texture = screen_info.texture.resource.handle; screen_info.display_texcoords = MathUtil::Rectangle<float>(0.f, 0.f, 1.f, 1.f); - Rasterizer()->FlushRegion(framebuffer_addr, framebuffer.stride * framebuffer.height); + Rasterizer()->FlushRegion(framebuffer_addr, size_in_bytes); - VideoCore::MortonCopyPixels128(framebuffer.width, framebuffer.height, bpp, 4, - Memory::GetPointer(framebuffer.address), + VideoCore::MortonCopyPixels128(framebuffer.width, framebuffer.height, bytes_per_pixel, 4, + Memory::GetPointer(framebuffer_addr), gl_framebuffer_data.data(), true); state.texture_units[0].texture_2d = screen_info.texture.resource.handle; |