End the scene before resetting the D3D device, since we'll start with BeginScene after that.

If we don't do this, we'll end up with unbalanced Begin/End scene pairs which causes D3DERR_INVALIDCALL in the present.

Fixes https://github.com/libsdl-org/SDL/issues/4933
This commit is contained in:
Sam Lantinga 2021-11-10 05:24:31 -08:00
parent 6b64c47b69
commit 3a31a45028
1 changed files with 6 additions and 0 deletions

View File

@ -1425,6 +1425,12 @@ D3D_Reset(SDL_Renderer * renderer)
SDL_Texture *texture;
int i;
/* Cancel any scene that we've started */
if (!data->beginScene) {
IDirect3DDevice9_EndScene(data->device);
data->beginScene = SDL_TRUE;
}
/* Release the default render target before reset */
if (data->defaultRenderTarget) {
IDirect3DSurface9_Release(data->defaultRenderTarget);