NVIDIAGameWorks / Streamline

Streamline Integration Framework
Other
377 stars 79 forks source link

sl.interposer: IDXGIFactory2_CreateSwapChainForHwnd behavior differs from D3D11 #2

Closed JoshParnell closed 2 years ago

JoshParnell commented 2 years ago

dxgi.cpp:195

if (*ppSwapChain)
{
    // Handled by one of the plugins
    hr = S_OK;
}

results in a major difference from the native implementation of this function. You can't assume that, just because the output ptr is non-null, you already handled creation of the swap chain. Use your own internal pointer and initialize it to zero, because previously, it was entirely valid to call CreateSwapChainForHwnd without bothering to initialize our output ptr to null. Now, doing so causes a silent failure to create a swap chain if the sl interposer is loaded.

In other words,

IDXGISwapChain1* swapChain;
auto result = factory->CreateSwapChainForHwnd(..., &swapChain);

works fine with standard D3D11, causes silent, non-deterministic failure (which results in later crashes) with SL interposer. For SL we have to ensure that swapChain is initialized to nullptr to get it to work.

JoshParnell commented 2 years ago

fixed in 1.0.4, thank you 👍