Avoid 'video_gpu_screenshot' with savestates (#14464)

This commit is contained in:
sonninnos 2022-10-03 16:13:01 +03:00 committed by GitHub
parent d774256e0d
commit 4fe477ee39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 10 deletions

View File

@ -2030,12 +2030,6 @@ bool video_driver_supports_viewport_read(void)
bool video_driver_prefer_viewport_read(void)
{
video_driver_state_t *video_st = &video_driver_st;
settings_t *settings = config_get_ptr();
#ifdef HAVE_SCREENSHOTS
bool video_gpu_screenshot = settings->bools.video_gpu_screenshot;
if (video_gpu_screenshot)
return true;
#endif
return (video_driver_is_hw_context() &&
!video_st->current_video->read_frame_raw);
}

View File

@ -534,13 +534,22 @@ static bool take_screenshot_choice(
bool take_screenshot(
const char *screenshot_dir,
const char *name_base,
bool silence, bool has_valid_framebuffer,
bool savestate, bool has_valid_framebuffer,
bool fullpath, bool use_thread)
{
runloop_state_t *runloop_st = runloop_state_get_ptr();
settings_t *settings = config_get_ptr();
bool video_gpu_screenshot = settings->bools.video_gpu_screenshot;
bool is_paused = false;
bool is_idle = false;
bool ret = false;
bool supports_viewport_read = video_driver_supports_viewport_read();
bool prefer_viewport_read = supports_viewport_read &&
video_driver_prefer_viewport_read();
/* Avoid GPU screenshots with savestates */
if (supports_viewport_read && video_gpu_screenshot && !savestate)
prefer_viewport_read = true;
if (runloop_st)
{
@ -555,10 +564,9 @@ bool take_screenshot(
ret = take_screenshot_choice(
screenshot_dir,
name_base, silence, is_paused, is_idle,
name_base, savestate, is_paused, is_idle,
has_valid_framebuffer, fullpath, use_thread,
video_driver_supports_viewport_read() &&
video_driver_prefer_viewport_read(),
prefer_viewport_read,
video_driver_supports_read_frame_raw(),
video_driver_get_pixel_format()
);