Developer knowledge network · moderated exchange

Супольнасць UnreliableCode

Супольнасць распрацоўшчыкаў даследаванняў, зваротнага праектавання і кадавання

Knowledge indexжыць
4Categories
919Threads
2.8KПаведамленні
Guide

Handling DirectX 11 ResizeBuffers & Device Reset on Alt-Tab fullscreen switches [v2.4 Technical Discussion]

dx12_render_dev
DX12 Master
MEMBER
прадстаўнік: 55
Дата далучэння: Oct 2020
Паведамленні: 9
Дзякуй: 65
1 месяцаў таму · Jul 3, 2026 4:08 PM
#1

Why internal DirectX 11 overlays crash when the user Alt-Tabs or changes display resolution:

When resolution changes, the game calls IDXGISwapChain::ResizeBuffers. If your overlay still holds references to the ID3D11RenderTargetView, ResizeBuffers fails with DXGI_ERROR_INVALID_CALL and crashes!

The Fix:
Hook ResizeBuffers (VTable index 13):

CPP
HRESULT __stdcall hkResizeBuffers(IDXGISwapChain* pSwapChain, UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags) {
    if (g_pRenderTargetView) {
        g_pContext->OMSetRenderTargets(0, nullptr, nullptr);
        g_pRenderTargetView->Release();
        g_pRenderTargetView = nullptr;
    }
    HRESULT hr = oResizeBuffers(pSwapChain, BufferCount, Width, Height, NewFormat, SwapChainFlags);
    CreateRenderTarget(pSwapChain); // Recreate RTV for new backbuffer
    return hr;
}
imgui_artisan
UI Designer
MEMBER
прадстаўнік: 202
Дата далучэння: Apr 2019
Паведамленні: 54
Дзякуй: 28
1 месяцаў таму · Jul 3, 2026 8:20 PM
#2

Releasing the render target view in hkResizeBuffers before calling original completely eliminates Alt-Tab crashes!

ptr_arithmetic
C++ Wizard
MEMBER
прадстаўнік: 162
Дата далучэння: May 2018
Паведамленні: 73
Дзякуй: 42
1 месяцаў таму · Jul 4, 2026 5:59 AM
#3

Essential hook for any reliable internal DirectX overlay.