render: Fix internal state getting out of sync when destroying a texture that was just rendered and then creating a new one, in the GL and GLES2 backends. Fixes bug #4433.

This commit is contained in:
Alex Szpakowski 2018-12-21 20:53:31 -04:00
parent 0a70590118
commit dc3443602b
2 changed files with 14 additions and 0 deletions

View file

@ -1388,6 +1388,13 @@ GL_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
GL_ActivateRenderer(renderer);
if (renderdata->drawstate.texture == texture) {
renderdata->drawstate.texture = NULL;
}
if (renderdata->drawstate.target == texture) {
renderdata->drawstate.target = NULL;
}
if (!data) {
return;
}

View file

@ -1766,6 +1766,13 @@ GLES2_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
GLES2_ActivateRenderer(renderer);
if (data->drawstate.texture == texture) {
data->drawstate.texture = NULL;
}
if (data->drawstate.target == texture) {
data->drawstate.target = NULL;
}
/* Destroy the texture */
if (tdata) {
data->glDeleteTextures(1, &tdata->texture);