mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 16:19:28 +01:00
OGL: Avoid reallocation of frame dumping PBO.
This commit is contained in:
parent
f6a6cc9c67
commit
741debe229
@ -1589,10 +1589,10 @@ void Renderer::FlushFrameDump()
|
|||||||
FinishFrameData();
|
FinishFrameData();
|
||||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, m_frame_dumping_pbo[0]);
|
glBindBuffer(GL_PIXEL_PACK_BUFFER, m_frame_dumping_pbo[0]);
|
||||||
m_frame_pbo_is_mapped[0] = true;
|
m_frame_pbo_is_mapped[0] = true;
|
||||||
void* data = glMapBufferRange(GL_PIXEL_PACK_BUFFER, 0,
|
void* data = glMapBufferRange(
|
||||||
m_last_frame_width * m_last_frame_height * 4, GL_MAP_READ_BIT);
|
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, m_last_frame_height,
|
DumpFrameData(reinterpret_cast<u8*>(data), m_last_frame_width[0], m_last_frame_height[0],
|
||||||
m_last_frame_width * 4, m_last_frame_state, true);
|
m_last_frame_width[0] * 4, m_last_frame_state, true);
|
||||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
|
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
|
||||||
m_last_frame_exported = false;
|
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_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_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]);
|
glBindBuffer(GL_PIXEL_PACK_BUFFER, m_frame_dumping_pbo[0]);
|
||||||
if (m_frame_pbo_is_mapped[0])
|
if (m_frame_pbo_is_mapped[0])
|
||||||
glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
|
glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
|
||||||
m_frame_pbo_is_mapped[0] = false;
|
m_frame_pbo_is_mapped[0] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_last_frame_width = flipped_trc.GetWidth();
|
if (flipped_trc.GetWidth() != m_last_frame_width[0] ||
|
||||||
m_last_frame_height = flipped_trc.GetHeight();
|
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_state = AVIDump::FetchState(ticks);
|
||||||
m_last_frame_exported = true;
|
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);
|
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);
|
GL_RGBA, GL_UNSIGNED_BYTE, 0);
|
||||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
|
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
|
||||||
}
|
}
|
||||||
|
@ -119,9 +119,9 @@ private:
|
|||||||
// avi dumping state to delay one frame
|
// avi dumping state to delay one frame
|
||||||
std::array<u32, 2> m_frame_dumping_pbo = {};
|
std::array<u32, 2> m_frame_dumping_pbo = {};
|
||||||
std::array<bool, 2> m_frame_pbo_is_mapped = {};
|
std::array<bool, 2> m_frame_pbo_is_mapped = {};
|
||||||
|
std::array<int, 2> m_last_frame_width = {};
|
||||||
|
std::array<int, 2> m_last_frame_height = {};
|
||||||
bool m_last_frame_exported = false;
|
bool m_last_frame_exported = false;
|
||||||
int m_last_frame_width = 0;
|
|
||||||
int m_last_frame_height = 0;
|
|
||||||
AVIDump::Frame m_last_frame_state;
|
AVIDump::Frame m_last_frame_state;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user