On Sat Aug 22 15:50:29 2026 +0000, Stefan Dösinger wrote:
[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. Here is the output of my test hack:
``` dxgi.c:4615: Test failed: d3d10: rtv ref 0 dxgi.c:4617: Test failed: d3d10: tex ref 1 dxgi.c:4631: Test failed: d3d10: Pre resize buf ok dxgi.c:4641: Test failed: d3d10: post resize buf ok 4f9c:dxgi: 307 tests executed (0 marked as todo, 0 as flaky, 4 failures), 0 skipped. ``` The "test failed" are my ok(0, ...) debug lines. With heap validation: ``` dxgi.c:4615: Test failed: d3d10: rtv ref 0 dxgi.c:4617: Test failed: d3d10: tex ref 1 dxgi.c:4631: Test failed: d3d10: Pre resize buf ok dxgi.c:4635: this is the last test seen before the exception 0e68:dxgi: unhandled exception c0000005 at 00007FF622E73E91 ``` So an assigned RTV with ref=0 stays alive ("pre resize buf" addref/release cycle succeeds), ResizeBuffers does its thing and returns success and frees the texture object. I see the following possibilities: 1) My guess is just wrong and something different is going on 2) Nier tries to resize while objects are active but gets an error on Windows 3) Nier tries to resize and expects it to succeed and is (un)lucky not to run into a crash with the defective textures/views afterwards 4) Something before the ResizeBuffers call goes wrong and Nier enters a codepath it does not enter on Windows -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10567#note_149605