Question

In the renderer I'm designing in DirectX11 I need to be able to create a swap chain at any time, however the method I use crashes right at the CreateSwapChain() call:

    IDXGIDevice * device;
    HR(d3ddevice->QueryInterface(__uuidof(IDXGIDevice), (void**)&device));

    IDXGIAdapter * adapter;
    HR(device->GetParent(__uuidof(IDXGIAdapter), (void**)&adapter));

    IDXGIFactory * factory;
    HR(adapter->GetParent(__uuidof(IDXGIAdapter), (void**)&factory));

    IDXGISwapChain* swapChain = 0;
    HR(factory->CreateSwapChain(_device->GetContent(), &description, &swapChain));

d3ddevice is a pointer to ID3D11Device, fully initialized and everything, I tested it out. description is a DXGI_SWAP_CHAIN_DESC structure, each field is filled out.However, the function returns E_NOINTERFACE.My system supports shader model 5/directx 11

Was it helpful?

Solution

You're using the UUID of IDXGIAdapter when you query for IDXGIFactory:

IDXGIFactory * factory;
HR(adapter->GetParent(__uuidof(IDXGIAdapter), (void**)&factory));

Try changing that to _uuidof(IDXGIFactory).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top