https://bugs.winehq.org/show_bug.cgi?id=37406
--- Comment #10 from Henri Verbeet hverbeet@gmail.com --- (In reply to Stefan Dösinger from comment #5)
Created attachment 49776 [details] wined3d: Remove texture locations after unloading all subresources.
The problem is that surface_unload calls wined3d_texture_force_reload, which invalidates the texture location of all mipmaps and not just the one that was unloaded. If the other mipmaps only have a valid texture copy, which is quite likely, they are lost.
The attached patch changes this behavior and controls the invalidation of the texture location from the container, which is also the place where the GL texture is actually deleted. Ideally we should call unload only on containers and not on subresources. I am not yet sure if the attached patch has any negative side effects because of that.
I think the patch is basically correct, but the same flaw probably applies to volume_unload(). And yeah, we really shouldn't be unloading sub-resources in e.g. delete_opengl_contexts().