The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.
Simple Directmedia Layer Forums
DX9 device lost -> SDL_TEXTUREACCESS_TARGET lost. Cleanu
Joined: 09 Jan 2017
Posted: Mon Jan 09, 2017 5:59 pm
Developing a 2D game using SDL2.0 and testing on an older system (XP SP3 actually, to ensure it works fine on older systems) and I've hit the DX9 device lost issue where rendered textures turn into garbage(?) data. (Alt-Enter, screensaver, Windows Key+L, opening a different program in fullscreen, etc)
I've already read a lot of threads about this and found that SDL now sends the event SDL_RENDER_TARGETS_RESET, which is great. So I'm listening for the event and I can tell the program to rebuild the textures when the device is lost. My actual question is somewhat more trivial:
Do I need to do any cleanup on the SDL_Texture when this happens? If I just tell the program to rebuild all of its rendered textures at the same locations/pointers where they were previously, am I leaking memory because I didn't free up the old SDL textures, from before when the device wasn't lost?
I'm not a graphics programmer so I haven't much idea what's going on behind the scenes regarding texture memory and devices etc. Thanks.