Developer knowledge network · moderated exchange

Zajednica UnreliableCode

Zajednica za istraživanje, obrnuti inženjering i programiranje programera

Knowledge indexŽivjeti
4Categories
919Threads
2.8KPostovi
Guide

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

dx12_render_dev
DX12 Master
MEMBER
Rep: 55
Datum pridruživanja: Oct 2020
Postovi: 9
Hvala: 65
prije 1 mjeseci · 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
Rep: 202
Datum pridruživanja: Apr 2019
Postovi: 54
Hvala: 28
prije 1 mjeseci · 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
Rep: 162
Datum pridruživanja: May 2018
Postovi: 73
Hvala: 42
prije 1 mjeseci · Jul 4, 2026 5:59 AM
#3

Essential hook for any reliable internal DirectX overlay.