diff options
| author | degasus <wickmarkus@web.de> | 2016-11-07 22:32:54 +0100 |
|---|---|---|
| committer | degasus <wickmarkus@web.de> | 2016-11-07 22:32:54 +0100 |
| commit | 741debe2291b0788ec2fb54ec24f49490704d609 (patch) | |
| tree | 6b4519d96351c45f39b352d96c8b3b7929e490fd /Source/Core/VideoBackends/OGL/Render.cpp | |
| parent | f6a6cc9c6743c1f9e9262775a6da7afbd153b19c (diff) | |
OGL: Avoid reallocation of frame dumping PBO.
Diffstat (limited to 'Source/Core/VideoBackends/OGL/Render.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/OGL/Render.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index f0ab819815..b1fae3b98c 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -1589,10 +1589,10 @@ void Renderer::FlushFrameDump() FinishFrameData(); glBindBuffer(GL_PIXEL_PACK_BUFFER, m_frame_dumping_pbo[0]); m_frame_pbo_is_mapped[0] = true; - void* data = glMapBufferRange(GL_PIXEL_PACK_BUFFER, 0, - m_last_frame_width * m_last_frame_height * 4, GL_MAP_READ_BIT); - DumpFrameData(reinterpret_cast<u8*>(data), m_last_frame_width, m_last_frame_height, - m_last_frame_width * 4, m_last_frame_state, true); + void* data = glMapBufferRange( + GL_PIXEL_PACK_BUFFER, 0, m_last_frame_width[0] * m_last_frame_height[0] * 4, GL_MAP_READ_BIT); + DumpFrameData(reinterpret_cast<u8*>(data), m_last_frame_width[0], m_last_frame_height[0], + m_last_frame_width[0] * 4, m_last_frame_state, true); glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); m_last_frame_exported = false; } @@ -1611,21 +1611,28 @@ void Renderer::DumpFrame(const TargetRectangle& flipped_trc, u64 ticks) { std::swap(m_frame_dumping_pbo[0], m_frame_dumping_pbo[1]); std::swap(m_frame_pbo_is_mapped[0], m_frame_pbo_is_mapped[1]); + std::swap(m_last_frame_width[0], m_last_frame_width[1]); + std::swap(m_last_frame_height[0], m_last_frame_height[1]); glBindBuffer(GL_PIXEL_PACK_BUFFER, m_frame_dumping_pbo[0]); if (m_frame_pbo_is_mapped[0]) glUnmapBuffer(GL_PIXEL_PACK_BUFFER); m_frame_pbo_is_mapped[0] = false; } - m_last_frame_width = flipped_trc.GetWidth(); - m_last_frame_height = flipped_trc.GetHeight(); + if (flipped_trc.GetWidth() != m_last_frame_width[0] || + flipped_trc.GetHeight() != m_last_frame_height[0]) + { + m_last_frame_width[0] = flipped_trc.GetWidth(); + m_last_frame_height[0] = flipped_trc.GetHeight(); + glBufferData(GL_PIXEL_PACK_BUFFER, m_last_frame_width[0] * m_last_frame_height[0] * 4, nullptr, + GL_STREAM_READ); + } + m_last_frame_state = AVIDump::FetchState(ticks); m_last_frame_exported = true; - glBufferData(GL_PIXEL_PACK_BUFFER, m_last_frame_width * m_last_frame_height * 4, nullptr, - GL_STREAM_READ); glPixelStorei(GL_PACK_ALIGNMENT, 1); - glReadPixels(flipped_trc.left, flipped_trc.bottom, m_last_frame_width, m_last_frame_height, + glReadPixels(flipped_trc.left, flipped_trc.bottom, m_last_frame_width[0], m_last_frame_height[0], GL_RGBA, GL_UNSIGNED_BYTE, 0); glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); } |
