On Fri Aug 21 14:01:32 2026 +0000, Stian Low wrote:
ERR logs for back buffer 0 being held back for swapchain resize was introduced a few years ago: ``` ebaa0a9426864cfa6e36955f26ff4c66c1d5af76 Author: Elizabeth Figura <zfigura@codeweavers.com> CommitDate: Thu Jun 29 12:04:35 2023 +0200 wined3d: Recreate swapchain textures in wined3d_swapchain_resize_buffers(). ``` Originally swapchain backbuffers were reused with `wined3d_texture_update_desc` vs deref/destroyed and recreated. Unclear if back buffers still being held for resize was a regression but the commit seems to have correctly added an ERR message whenever it happens as @stefan referenced from MSDN: - https://learn.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiswapch... However according to MSDN, if that ERR is ever logged then it is expected to return an error code instead of S_OK. Unclear if returning error code for ERR log was skipped to reduce risks of breaking apps but it definitely breaks NieR without whatever is holding back buffer back is fixed which seems like a bug. I added some extra logs and confirmed that a UAV is involved for incrementing back buffer 0 on init +1 greater than the other 2 backbuffers for NieR but still unclear if this means UAVs may also need to be handled and rotated by this merge. I will try to add some basic UAV rotation handling since it may need to be handled eventually anyways to see if resolves the ERR log. If not then I'll preserve the UAV logic to be split as a separate merge later. [swapchain.diff](/uploads/c86cb078cfe086fd505327fd4461b800/swapchain.diff)
I played around a bit with swapchain RTVs on Windows. The attached swapchain.diff is a way to invoke ResizeBuffers() while having a live RTV on a backbuffer. It creates a RTV, sets it on the (d3d10) device, then releases the reference to both the RTV and back buffer. It doesn't get destroyed - the "Pre resize buf ok" runs successfully with heap validation enabled. ResizeBuffers returns success. The post resize buf runs into a use-after-free heap issue. Running it with heap validation enabled (set via gflags from the Windows SDK), it crashes after ResizeBuffers. So I guess that ResizeBuffer succeeds is a bug in native. I am pretty sure we have the same bug, considering that we are checking if a texture or view is alive via refcount. If this is indeed what Nier is running into that would be annoying. It would mean we have to replicate the bug and tiptoe around the consequences well enough to keep Nier working. It is of course possible that Nier has an entirely different problem. I'll try to download the game over night. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10567#note_149604