Skip to content

Conversation

PathogenDavid
Copy link
Contributor

(Apologies for the notification spam, apparently you can't reopen a PR if you force-push to it while it is closed.)

This PR fixes #4346 as well as the unnecessary recreation of backend-owned device objects mentioned in #4347 (comment).

Not sure why this example was recreating the entire swap chain on resize (it's been like that forever), but ResizeBuffers is the correct way to react to WM_SIZE.

Only the Direct3D 12 sample was affected, other samples and viewport-aware backends are fine:


Note that there is still an unrelated alt+enter debug layer crash on the docking branch even with this fix. It's a more complicated issue that I need to investigate further. (It seems that command queues owned by platform windows are referencing the main viewport's back buffers for some reason.)

This also removes unnecessary recreation of backend-owned device objects when the window is resized.
Fixes ocornut#4346
ocornut pushed a commit that referenced this pull request Jul 26, 2021
…#4346, #4348)

This also removes unnecessary recreation of backend-owned device objects when the window is resized.
+ amend original PR with a g_pSwapChain->SetFullscreenState(false, NULL); call.
@ocornut
Copy link
Owner

ocornut commented Jul 26, 2021

Hello,

When using it I get a crash on shutdown at the time of g_pSwapChain->Release():

The thread 0xaa0 has exited with code 0 (0x0).
DXGI ERROR: IDXGISwapChain::Release: Swapchain Released while fullscreen. Switch it to the windowed state first. [ MISCELLANEOUS ERROR #66: ]

Doing this:
https://stackoverflow.com/questions/27116521/switch-swapchain-to-windowed-mode

Fixed the issue. I find it a little strange that DX12 can't just do that to be honest, maybe it'll bite us back but for now I've merged your PR with this change (squashed as 923bd2f)

Thank you!

@ocornut ocornut closed this Jul 26, 2021
@PathogenDavid
Copy link
Contributor Author

Oops, that's what I get for always terminating the app via Visual Studio.

No problem, and thanks for fixing that mistake!

I find it a little strange that DX12 can't just do that to be honest, maybe it'll bite us back but for now I've merged your PR with this change

Yeah, the legacy fullscreen stuff is pretty quirky. The DirectX developers will tell you not to use it anymore if you ask about it, but people use it anyway because it's easy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DX12 example app crashes immediately after going into fullscreen
2 participants