I'm happy that you replied. I'm your fun, your book is amazing .
I found a workaround, but still have questions. Hope that experienced guys help me.
On Win8 everything works without problems. So I'll talk about Win7 only. On Win7 I have lastest updates. Previously I used this code to get a factory:
ComPtr<IDXGIFactory2> factory2; HRESULT hr = CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)(&factory2));
This code was called after device and context creation. Now I can see that I'm creating IDXGIFactory2 with CreateDXGIFactory1 method. That's weird, but this works!! How!!??
Now I use this this code for factory obtain:
ComPtr<IDXGIDevice> dxgiDevice; device->QueryInterface(__uuidof(IDXGIDevice), reinterpret_cast<void**>(dxgiDevice.GetAddressOf())); ComPtr<IDXGIAdapter> adapter; dxgiDevice->GetAdapter(&adapter); ComPtr<IDXGIFactory1> factory1; adapter->GetParent(__uuidof(IDXGIFactory1), reinterpret_cast<void**>(factory1.GetAddressOf())); ComPtr<IDXGIFactory2> factory2; factory1.Get()->QueryInterface(__uuidof(IDXGIFactory2), reinterpret_cast<void**>(factory2.GetAddressOf()));
This code also works. And in addition debugger works too.
So my question - what is a correct way to get a factory? Is it absolutelly wrong to get it using CreateDXGIFactory1? Or should I obtain it throug existing device? Sorry if unclear, please feel free to correct/ask.
@SeanMiddleditch Thank you for reply. You're right - CreateSwapChainForHwnd needs IDXGIFactory2 interface. I tried win32 sample on Win7 - https://code.msdn.microsoft.com/windowsdesktop/Direct3D-Tutorial-Win32-829979ef - this sample uses lastest factory and it works.