mirror of https://github.com/encounter/SDL.git
D3D11: Fixed a crash after a GPU device-reset on Win32
This commit is contained in:
parent
6ce684e92b
commit
46a80b04d8
|
@ -851,6 +851,12 @@ D3D11_ReleaseAll(SDL_Renderer * renderer)
|
||||||
D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
|
D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
|
||||||
SDL_Texture *texture = NULL;
|
SDL_Texture *texture = NULL;
|
||||||
|
|
||||||
|
/* Release all textures */
|
||||||
|
for (texture = renderer->textures; texture; texture = texture->next) {
|
||||||
|
D3D11_DestroyTexture(renderer, texture);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Release/reset everything else */
|
||||||
if (data) {
|
if (data) {
|
||||||
SAFE_RELEASE(data->dxgiFactory);
|
SAFE_RELEASE(data->dxgiFactory);
|
||||||
SAFE_RELEASE(data->dxgiAdapter);
|
SAFE_RELEASE(data->dxgiAdapter);
|
||||||
|
@ -874,13 +880,6 @@ D3D11_ReleaseAll(SDL_Renderer * renderer)
|
||||||
SAFE_RELEASE(data->clippedRasterizer);
|
SAFE_RELEASE(data->clippedRasterizer);
|
||||||
SAFE_RELEASE(data->vertexShaderConstants);
|
SAFE_RELEASE(data->vertexShaderConstants);
|
||||||
|
|
||||||
if (data->hD3D11Mod) {
|
|
||||||
SDL_UnloadObject(data->hD3D11Mod);
|
|
||||||
}
|
|
||||||
if (data->hDXGIMod) {
|
|
||||||
SDL_UnloadObject(data->hDXGIMod);
|
|
||||||
}
|
|
||||||
|
|
||||||
data->swapEffect = (DXGI_SWAP_EFFECT) 0;
|
data->swapEffect = (DXGI_SWAP_EFFECT) 0;
|
||||||
data->rotation = DXGI_MODE_ROTATION_UNSPECIFIED;
|
data->rotation = DXGI_MODE_ROTATION_UNSPECIFIED;
|
||||||
data->currentRenderTargetView = NULL;
|
data->currentRenderTargetView = NULL;
|
||||||
|
@ -889,11 +888,18 @@ D3D11_ReleaseAll(SDL_Renderer * renderer)
|
||||||
data->currentShader = NULL;
|
data->currentShader = NULL;
|
||||||
data->currentShaderResource = NULL;
|
data->currentShaderResource = NULL;
|
||||||
data->currentSampler = NULL;
|
data->currentSampler = NULL;
|
||||||
}
|
|
||||||
|
|
||||||
/* Release all textures */
|
/* Unload the D3D libraries. This should be done last, in order
|
||||||
for (texture = renderer->textures; texture; texture = texture->next) {
|
* to prevent IUnknown::Release() calls from crashing.
|
||||||
D3D11_DestroyTexture(renderer, texture);
|
*/
|
||||||
|
if (data->hD3D11Mod) {
|
||||||
|
SDL_UnloadObject(data->hD3D11Mod);
|
||||||
|
data->hD3D11Mod = NULL;
|
||||||
|
}
|
||||||
|
if (data->hDXGIMod) {
|
||||||
|
SDL_UnloadObject(data->hDXGIMod);
|
||||||
|
data->hDXGIMod = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue