Add a safe way to dispose textures and other graphics resources when using threaded rendering