mirror of
https://github.com/JesseTG/melonds-ds.git
synced 2024-11-26 16:20:48 +00:00
Pass in the current framebuffer to CaptureFrame
This commit is contained in:
parent
419b2320b6
commit
1095c18697
@ -370,8 +370,9 @@ void MelonDsDs::OpenGLRenderState::Render(
|
||||
|
||||
glsm_ctl(GLSM_CTL_STATE_BIND, nullptr);
|
||||
|
||||
GLuint current_fbo = glsm_get_current_framebuffer();
|
||||
// Tell OpenGL that we want to draw to (and read from) the screen framebuffer
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, glsm_get_current_framebuffer());
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, current_fbo);
|
||||
|
||||
melonDS::GLRenderer& renderer = static_cast<melonDS::GLRenderer&>(nds.GetRenderer3D());
|
||||
|
||||
@ -437,7 +438,7 @@ void MelonDsDs::OpenGLRenderState::Render(
|
||||
|
||||
#ifdef HAVE_TRACY
|
||||
if (_tracyCapture) {
|
||||
_tracyCapture->CaptureFrame(config.ScaleFactor());
|
||||
_tracyCapture->CaptureFrame(current_fbo, config.ScaleFactor());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -105,7 +105,7 @@ MelonDsDs::OpenGlTracyCapture::~OpenGlTracyCapture() noexcept {
|
||||
}
|
||||
}
|
||||
|
||||
void MelonDsDs::OpenGlTracyCapture::CaptureFrame(float scale) noexcept {
|
||||
void MelonDsDs::OpenGlTracyCapture::CaptureFrame(GLuint current_fbo, float scale) noexcept {
|
||||
if (!tracy::ProfilerAvailable()) {
|
||||
return;
|
||||
}
|
||||
@ -156,7 +156,7 @@ void MelonDsDs::OpenGlTracyCapture::CaptureFrame(float scale) noexcept {
|
||||
glBlitFramebuffer(0, 0, NDS_SCREEN_WIDTH * scale, NDS_SCREEN_HEIGHT * 2 * scale, 0, 0, NDS_SCREEN_WIDTH, NDS_SCREEN_HEIGHT * 2, GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||
|
||||
// Okay, we're done downscaling the screen
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); // TODO: Use the retro_hw_render_callback's default FBO
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, current_fbo);
|
||||
|
||||
// Get the capture FBO ready to read its contents out...
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, _tracyFbos[_tracyIndex]);
|
||||
@ -168,8 +168,8 @@ void MelonDsDs::OpenGlTracyCapture::CaptureFrame(float scale) noexcept {
|
||||
// (nullptr means to read data into the bound PBO, not to the CPU)
|
||||
glReadPixels(0, 0, NDS_SCREEN_WIDTH, NDS_SCREEN_HEIGHT * 2, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
|
||||
|
||||
// Okay, now we're done with the capture FBO; you can have the default FBO back
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); // TODO: Use the retro_hw_render_callback's default FBO
|
||||
// Okay, now we're done with the capture FBO; you can have the current FBO back
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, current_fbo);
|
||||
|
||||
// Create a new fence that'll go off when every OpenGL command that came before it finishes
|
||||
// (No other acceptable arguments are currently defined for glFenceSync)
|
||||
|
@ -36,7 +36,7 @@ namespace MelonDsDs {
|
||||
OpenGlTracyCapture& operator=(const OpenGlTracyCapture&) = delete;
|
||||
OpenGlTracyCapture(OpenGlTracyCapture&&) = delete;
|
||||
OpenGlTracyCapture& operator=(OpenGlTracyCapture&&) = delete;
|
||||
void CaptureFrame(float scale) noexcept;
|
||||
void CaptureFrame(GLuint current_fbo, float scale) noexcept;
|
||||
private:
|
||||
static constexpr int FRAME_LAG = 4;
|
||||
std::array<GLuint, FRAME_LAG> _tracyTextures;
|
||||
|
Loading…
Reference in New Issue
Block a user