mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-12-26 17:00:05 +00:00
renderer_opengl: Fixes for properly flushing & rendering the framebuffer.
This commit is contained in:
parent
b5f3e7951b
commit
054393917e
@ -32,12 +32,6 @@ void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u3
|
|||||||
|
|
||||||
Core::System::GetInstance().perf_stats.EndGameFrame();
|
Core::System::GetInstance().perf_stats.EndGameFrame();
|
||||||
|
|
||||||
// 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.address,
|
|
||||||
framebuffer.width * framebuffer.height * 4,
|
|
||||||
Memory::FlushMode::FlushAndInvalidate);
|
|
||||||
|
|
||||||
VideoCore::g_renderer->SwapBuffers(framebuffer);
|
VideoCore::g_renderer->SwapBuffers(framebuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,9 +137,15 @@ void RendererOpenGL::SwapBuffers(boost::optional<const Tegra::FramebufferConfig&
|
|||||||
*/
|
*/
|
||||||
void RendererOpenGL::LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuffer,
|
void RendererOpenGL::LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuffer,
|
||||||
ScreenInfo& screen_info) {
|
ScreenInfo& screen_info) {
|
||||||
const u32 bpp{Tegra::FramebufferConfig::BytesPerPixel(framebuffer.pixel_format)};
|
const u32 bytes_per_pixel{Tegra::FramebufferConfig::BytesPerPixel(framebuffer.pixel_format)};
|
||||||
const u32 size_in_bytes{framebuffer.stride * framebuffer.height * bpp};
|
const u64 size_in_bytes{framebuffer.stride * framebuffer.height * bytes_per_pixel};
|
||||||
const VAddr framebuffer_addr{framebuffer.address};
|
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 orientation handling
|
||||||
framebuffer_transform_flags = framebuffer.transform_flags;
|
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_texture = screen_info.texture.resource.handle;
|
||||||
screen_info.display_texcoords = MathUtil::Rectangle<float>(0.f, 0.f, 1.f, 1.f);
|
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,
|
VideoCore::MortonCopyPixels128(framebuffer.width, framebuffer.height, bytes_per_pixel, 4,
|
||||||
Memory::GetPointer(framebuffer.address),
|
Memory::GetPointer(framebuffer_addr),
|
||||||
gl_framebuffer_data.data(), true);
|
gl_framebuffer_data.data(), true);
|
||||||
|
|
||||||
state.texture_units[0].texture_2d = screen_info.texture.resource.handle;
|
state.texture_units[0].texture_2d = screen_info.texture.resource.handle;
|
||||||
|
Loading…
Reference in New Issue
Block a user