Skip to content

Commit

Permalink
Engine: also release render targets when switching in fullscreen
Browse files Browse the repository at this point in the history
Unfortunately, it seems like Direct3D also must reset device when switching in back into fullscreen (after restoring minimized window).

Judging by the tests, when switching back to fullscreen (after alt+tabbing out), there may be 2 window events:
* window size changed
* window focus received

The former sometimes either is not received, or received too late(?), but latter is guaranteed.
  • Loading branch information
ivan-mogilko committed Jan 29, 2023
1 parent 278ba3b commit 1c337a3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Engine/ac/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1332,6 +1332,10 @@ void display_switch_in_resume()
}
video_resume();

// release render targets if switching back to the full screen mode;
// unfortunately, otherwise Direct3D fails to reset device when restoring fullscreen.
if (gfxDriver && gfxDriver->GetDisplayMode().IsRealFullscreen())
release_drawobj_rendertargets();
// clear the screen if necessary
if (gfxDriver && gfxDriver->UsesMemoryBackBuffer())
gfxDriver->ClearRectangle(0, 0, game.GetGameRes().Width - 1, game.GetGameRes().Height - 1, nullptr);
Expand Down

0 comments on commit 1c337a3

Please sign in to comment.