Fix F2 screenshots (#2160)

Fixes #2155
This commit is contained in:
ManDude 2023-01-24 00:38:21 +00:00 committed by GitHub
parent f3526652ee
commit fdcd67b095
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -782,7 +782,7 @@ void OpenGLRenderer::setup_frame(const RenderOptions& settings) {
window_fb.multisampled = false;
// see if the render FBO is still applicable
if (!m_fbo_state.render_fbo || window_resized ||
if (settings.save_screenshot || window_resized || !m_fbo_state.render_fbo ||
!m_fbo_state.render_fbo->matches(settings.game_res_w, settings.game_res_h,
settings.msaa_samples)) {
// doesn't match, set up a new one for these settings
@ -794,7 +794,10 @@ void OpenGLRenderer::setup_frame(const RenderOptions& settings) {
m_fbo_state.resources.resolve_buffer.clear();
// first, see if we can just render straight to the display framebuffer.
if (window_fb.matches(settings.game_res_w, settings.game_res_h, settings.msaa_samples)) {
// note: we always force a separate fbo on a screenshot so that it won't capture overlays.
// as an added bonus it also doesn't break the sprite distort buffer...
if (!settings.save_screenshot &&
window_fb.matches(settings.game_res_w, settings.game_res_h, settings.msaa_samples)) {
// it matches - no need for extra framebuffers.
lg::info("FBO Setup: rendering directly to window framebuffer");
m_fbo_state.render_fbo = &m_fbo_state.resources.window;

View File

@ -481,10 +481,7 @@ void render_game_frame(int game_width,
options.draw_region_height = window_fb_height;
}
want_hotkey_screenshot =
want_hotkey_screenshot && g_gfx_data->debug_gui.screenshot_hotkey_enabled;
if (want_hotkey_screenshot) {
want_hotkey_screenshot = false;
if (want_hotkey_screenshot && g_gfx_data->debug_gui.screenshot_hotkey_enabled) {
options.save_screenshot = true;
std::string screenshot_file_name = make_hotkey_screenshot_file_name();
options.screenshot_path = make_full_screenshot_output_file_path(screenshot_file_name);
@ -502,6 +499,7 @@ void render_game_frame(int game_width,
}
options.screenshot_path = make_full_screenshot_output_file_path(screenshot_file_name);
}
want_hotkey_screenshot = false;
options.draw_small_profiler_window = g_gfx_data->debug_gui.small_profiler;
options.pmode_alp_register = g_gfx_data->pmode_alp;