HansKristian-Work / vkd3d-proton

Fork of VKD3D. Development branches for Proton's Direct3D 12 implementation.
GNU Lesser General Public License v2.1
1.76k stars 184 forks source link

Swapchain format query memoization #2038

Closed HansKristian-Work closed 1 week ago

HansKristian-Work commented 1 week ago

Fixes a memory leak as explained in https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30014. Even if drivers fix all the leaks, we should still memoize, since it's still a dumb memory allocation that should not be necessary, and our existing code to do format query was quite awkward in hindsight. Some games tend to spam CheckColorSpaceSupport every frame, which we should optimize for.

Also fixes a bug with cleanup should swapchain creation fail for whatever reason. It would be possible for uninitialized mutexes to be destroyed, and the wait thread join might deadlock or segfault.